diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2022-01-24 21:47:39 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2022-01-24 21:47:39 +0100 |
| commit | d4c367287ea50e854205e27cf814abbb23615b8a (patch) | |
| tree | 9e86584a09938c489fab767f187949a91d15c338 | |
| parent | 9bbc6569e4a3cf9bc2454d1af1f6161012ad0afb (diff) | |
add layer and instance ext check methods
| -rw-r--r-- | include/vkh.h | 12 | ||||
| -rw-r--r-- | src/vkhelpers.c | 36 |
2 files changed, 48 insertions, 0 deletions
diff --git a/include/vkh.h b/include/vkh.h index 0a6eada..94a912a 100644 --- a/include/vkh.h +++ b/include/vkh.h @@ -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 diff --git a/src/vkhelpers.c b/src/vkhelpers.c index b457d69..03d32ff 100644 --- a/src/vkhelpers.c +++ b/src/vkhelpers.c @@ -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); +} |