]> O.S.I.I.S - jp/vkhelpers.git/commitdiff
add layer and instance ext check methods
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 24 Jan 2022 20:47:39 +0000 (21:47 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 24 Jan 2022 20:47:39 +0000 (21:47 +0100)
include/vkh.h
src/vkhelpers.c

index 0a6eada1e3eb012d45f19c30be5ceb0b558ca62c..94a912a34a0b7ba6f90a7ad4a33a66ccb9081932 100644 (file)
@@ -312,6 +312,18 @@ void        vkh_queue_destroy   (VkhQueue queue);
 //VkhQueue    vkh_queue_find      (VkhDevice dev, VkQueueFlags flags);
 /////////////////////
 
+vkh_public
+bool vkh_instance_extension_supported (const char* instanceName);
+vkh_public
+void vkh_instance_extensions_check_init ();
+vkh_public
+void vkh_instance_extensions_check_release ();
+vkh_public
+bool vkh_layer_is_present (const char* layerName);
+vkh_public
+void vkh_layers_check_init ();
+vkh_public
+void vkh_layers_check_release ();
 #ifdef __cplusplus
 }
 #endif
index b457d696a72ab6dcd5701ab9e05284a40c4c1c96..03d32ff810e16c732c9c4f8ab72c8eff77fad5c1 100644 (file)
@@ -287,3 +287,39 @@ void dumpLayerExts () {
        }
        free(vk_props);
 }
+
+static VkExtensionProperties* instExtProps;
+static uint32_t instExtCount;
+bool vkh_instance_extension_supported (const char* instanceName) {
+    for (uint32_t i=0; i<instExtCount; i++) {
+        if (!strcmp(instExtProps[i].extensionName, instanceName))
+            return true;
+    }
+    return false;
+}
+void vkh_instance_extensions_check_init () {
+    VK_CHECK_RESULT(vkEnumerateInstanceExtensionProperties(NULL, &instExtCount, NULL));
+    instExtProps =(VkExtensionProperties*)malloc(instExtCount * sizeof(VkExtensionProperties));
+    VK_CHECK_RESULT(vkEnumerateInstanceExtensionProperties(NULL, &instExtCount, instExtProps));
+}
+void vkh_instance_extensions_check_release () {
+    free (instExtProps);
+}
+
+static VkLayerProperties* instLayerProps;
+static uint32_t instance_layer_count;
+bool vkh_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 vkh_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 vkh_layers_check_release () {
+    free (instLayerProps);
+}