diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-06-15 08:33:51 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-06-15 08:33:51 +0200 |
| commit | 403f694bf90455f13b115ea7cf58495f58bde6cc (patch) | |
| tree | d85fcc80a5c7ecc62c3fbbcec9fad4511de9ffc0 /src | |
| parent | 4e265c6e268201e09bb8471633d9bafff2700351 (diff) | |
phyinfo extension check
Diffstat (limited to 'src')
| -rw-r--r-- | src/vkh_phyinfo.c | 19 | ||||
| -rw-r--r-- | src/vkh_phyinfo.h | 3 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/vkh_phyinfo.c b/src/vkh_phyinfo.c index 9140e3b..d3dceb5 100644 --- a/src/vkh_phyinfo.c +++ b/src/vkh_phyinfo.c @@ -89,7 +89,8 @@ VkhPhyInfo vkh_phyinfo_create (VkPhysicalDevice phy, VkSurfaceKHR surface) { } void vkh_phyinfo_destroy (VkhPhyInfo phy) { - + if (phy->pExtensionProperties != NULL) + free(phy->pExtensionProperties); free(phy->queues); free(phy); } @@ -184,3 +185,19 @@ bool vkh_phy_info_create_graphic_queues (VkhPhyInfo phy, uint32_t queueCount, co } return false; } +bool vkh_phyinfo_try_get_extension_properties (VkhPhyInfo phy, const char* name, const VkExtensionProperties* properties) { + if (phy->pExtensionProperties == NULL) { + VK_CHECK_RESULT(vkEnumerateDeviceExtensionProperties(phy->phy, NULL, &phy->extensionCount, NULL)); + phy->pExtensionProperties = (VkExtensionProperties*)malloc(phy->extensionCount * sizeof(VkExtensionProperties)); + VK_CHECK_RESULT(vkEnumerateDeviceExtensionProperties(phy->phy, NULL, &phy->extensionCount, phy->pExtensionProperties)); + } + for (uint32_t i=0; i<phy->extensionCount; i++) { + if (strcmp(name, phy->pExtensionProperties[i].extensionName)==0) { + if (properties != NULL) + properties = &phy->pExtensionProperties[i]; + return true; + } + } + properties = NULL; + return false; +} diff --git a/src/vkh_phyinfo.h b/src/vkh_phyinfo.h index c3e1076..3a7261f 100644 --- a/src/vkh_phyinfo.h +++ b/src/vkh_phyinfo.h @@ -41,6 +41,9 @@ typedef struct _vkh_phy_t{ uint32_t qCreateInfosCount; VkDeviceQueueCreateInfo* qCreateInfos; + + VkExtensionProperties* pExtensionProperties; + uint32_t extensionCount; }vkh_phy_t; #ifdef __cplusplus } |