From 8e05bbeee9f75e1902bd1592c27f5965124ee11b Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 8 Jul 2015 10:38:07 -0700 Subject: [PATCH] vk/vulkan.h: Update extension handling to rev 130 --- include/vulkan/vulkan.h | 33 ++++++++--------- src/vulkan/device.c | 80 +++++++++++++++++------------------------ 2 files changed, 48 insertions(+), 65 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index d073d5929df..a463349dc48 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -1088,14 +1088,6 @@ typedef enum { VK_ENUM_RANGE(PHYSICAL_DEVICE_INFO_TYPE, PROPERTIES, MEMORY_PROPERTIES) } VkPhysicalDeviceInfoType; -typedef enum { - // Info type for vkGetGlobalExtensionInfo() and vkGetPhysicalDeviceExtensionInfo() - VK_EXTENSION_INFO_TYPE_COUNT = 0x00000000, - VK_EXTENSION_INFO_TYPE_PROPERTIES = 0x00000001, - - VK_ENUM_RANGE(EXTENSION_INFO_TYPE, COUNT, PROPERTIES) -} VkExtensionInfoType; - typedef enum { // Info type for vkGetFormatInfo() VK_FORMAT_INFO_TYPE_PROPERTIES = 0x00000000, @@ -1895,8 +1887,10 @@ typedef PFN_vkVoidFunction (VKAPI *PFN_vkGetInstanceProcAddr)(VkInstance instanc typedef PFN_vkVoidFunction (VKAPI *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName); typedef VkResult (VKAPI *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice); typedef VkResult (VKAPI *PFN_vkDestroyDevice)(VkDevice device); -typedef VkResult (VKAPI *PFN_vkGetGlobalExtensionInfo)(VkExtensionInfoType infoType, uint32_t extensionIndex, size_t* pDataSize, void* pData); -typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceExtensionInfo)(VkPhysicalDevice physicalDevice, VkExtensionInfoType infoType, uint32_t extensionIndex, size_t* pDataSize, void* pData); +typedef VkResult (VKAPI *PFN_vkGetGlobalExtensionCount)(uint32_t* pCount); +typedef VkResult (VKAPI *PFN_vkGetGlobalExtensionProperties)(uint32_t extensionIndex, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceExtensionCount)(VkPhysicalDevice physicalDevice, uint32_t* pCount); +typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, uint32_t extensionIndex, VkExtensionProperties* pProperties); typedef VkResult (VKAPI *PFN_vkEnumerateLayers)(VkPhysicalDevice physicalDevice, size_t maxStringSize, size_t* pLayerCount, char* const* pOutLayers, void* pReserved); typedef VkResult (VKAPI *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, VkQueue* pQueue); typedef VkResult (VKAPI *PFN_vkQueueSubmit)(VkQueue queue, uint32_t cmdBufferCount, const VkCmdBuffer* pCmdBuffers, VkFence fence); @@ -2035,18 +2029,21 @@ VkResult VKAPI vkCreateDevice( VkResult VKAPI vkDestroyDevice( VkDevice device); -VkResult VKAPI vkGetGlobalExtensionInfo( - VkExtensionInfoType infoType, +VkResult VKAPI vkGetGlobalExtensionCount( + uint32_t* pCount); + +VkResult VKAPI vkGetGlobalExtensionProperties( uint32_t extensionIndex, - size_t* pDataSize, - void* pData); + VkExtensionProperties* pProperties); + +VkResult VKAPI vkGetPhysicalDeviceExtensionCount( + VkPhysicalDevice physicalDevice, + uint32_t* pCount); -VkResult VKAPI vkGetPhysicalDeviceExtensionInfo( +VkResult VKAPI vkGetPhysicalDeviceExtensionProperties( VkPhysicalDevice physicalDevice, - VkExtensionInfoType infoType, uint32_t extensionIndex, - size_t* pDataSize, - void* pData); + VkExtensionProperties* pProperties); VkResult VKAPI vkEnumerateLayers( VkPhysicalDevice physicalDevice, diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 8e4694b1beb..ebd04e205b5 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -472,64 +472,50 @@ VkResult anv_DestroyDevice( return VK_SUCCESS; } -VkResult anv_GetGlobalExtensionInfo( - VkExtensionInfoType infoType, - uint32_t extensionIndex, - size_t* pDataSize, - void* pData) +static const VkExtensionProperties global_extensions[] = { + { + .extName = "VK_WSI_LunarG", + .version = 3 + } +}; + +VkResult anv_GetGlobalExtensionCount( + uint32_t* pCount) { - static const VkExtensionProperties extensions[] = { - { - .extName = "VK_WSI_LunarG", - .version = 3 - } - }; - uint32_t count = ARRAY_SIZE(extensions); + *pCount = ARRAY_SIZE(global_extensions); - switch (infoType) { - case VK_EXTENSION_INFO_TYPE_COUNT: - memcpy(pData, &count, sizeof(count)); - *pDataSize = sizeof(count); - return VK_SUCCESS; + return VK_SUCCESS; +} - case VK_EXTENSION_INFO_TYPE_PROPERTIES: - if (extensionIndex >= count) - return vk_error(VK_ERROR_INVALID_EXTENSION); - memcpy(pData, &extensions[extensionIndex], sizeof(extensions[0])); - *pDataSize = sizeof(extensions[0]); - return VK_SUCCESS; +VkResult anv_GetGlobalExtensionProperties( + uint32_t extensionIndex, + VkExtensionProperties* pProperties) +{ + assert(extensionIndex < ARRAY_SIZE(global_extensions)); - default: - return VK_UNSUPPORTED; - } + *pProperties = global_extensions[extensionIndex]; + + return VK_SUCCESS; } -VkResult anv_GetPhysicalDeviceExtensionInfo( +VkResult anv_GetPhysicalDeviceExtensionCount( VkPhysicalDevice physicalDevice, - VkExtensionInfoType infoType, - uint32_t extensionIndex, - size_t* pDataSize, - void* pData) + uint32_t* pCount) { - uint32_t *count; + /* None supported at this time */ + *pCount = 0; - switch (infoType) { - case VK_EXTENSION_INFO_TYPE_COUNT: - *pDataSize = 4; - if (pData == NULL) - return VK_SUCCESS; + return VK_SUCCESS; +} - count = pData; - *count = 0; - return VK_SUCCESS; - - case VK_EXTENSION_INFO_TYPE_PROPERTIES: - return vk_error(VK_ERROR_INVALID_EXTENSION); - - default: - return VK_UNSUPPORTED; - } +VkResult anv_GetPhysicalDeviceExtensionProperties( + VkPhysicalDevice physicalDevice, + uint32_t extensionIndex, + VkExtensionProperties* pProperties) +{ + /* None supported at this time */ + return vk_error(VK_ERROR_INVALID_EXTENSION); } VkResult anv_EnumerateLayers( -- 2.30.2