]> O.S.I.I.S - jp/vkvg.git/commitdiff
add layer check functions in device internal
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 25 Dec 2021 00:49:48 +0000 (01:49 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 25 Dec 2021 00:49:48 +0000 (01:49 +0100)
src/vkvg_device_internal.c
src/vkvg_device_internal.h

index 5f55970d0e05f834a7c38c387e85e813b0f98277..a9d64857722269d3c015b7d1f1eeef8fc93fa3e8 100644 (file)
@@ -525,6 +525,24 @@ void _instance_extensions_check_init () {
 void _instance_extensions_check_release () {
        free (instExtProps);
 }
+
+static VkLayerProperties* instLayerProps;
+static uint32_t instance_layer_count;
+bool _layer_is_present (const char* layerName) {
+       for (uint32_t i=0; i<instance_layer_count; i++) {
+               if (!strcmp(instLayerProps[i].layerName, layerName))
+                       return true;
+       }
+       return false;
+}
+void _layers_check_init () {
+       VK_CHECK_RESULT(vkEnumerateInstanceLayerProperties(&instance_layer_count, NULL));
+       instLayerProps =(VkLayerProperties*)malloc(instance_layer_count * sizeof(VkLayerProperties));
+       VK_CHECK_RESULT(vkEnumerateInstanceLayerProperties(&instance_layer_count, instLayerProps));
+}
+void _layers_check_release () {
+       free (instLayerProps);
+}
 void _dump_image_format_properties (VkvgDevice dev, VkFormat format) {
        /*VkImageFormatProperties imgProps;
        VK_CHECK_RESULT(vkGetPhysicalDeviceImageFormatProperties(dev->phy,
index 4e6653f17b1373917d9d220dab8651ab5d99b6f4..5ff8dc9ebedeedceb416539523d0ab984d24bddb 100644 (file)
@@ -125,4 +125,7 @@ bool _instance_extension_supported          (const char* instanceName);
 void _instance_extensions_check_init   ();
 void _instance_extensions_check_release ();
 
+bool _layer_is_present (const char* layerName);
+void _layers_check_init ();
+void _layers_check_release ();
 #endif