diff options
-rw-r--r-- | src/intel/vulkan/anv_device.c | 90 | ||||
-rw-r--r-- | src/intel/vulkan/anv_formats.c | 53 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 18 |
3 files changed, 161 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 84338dce812..f40e9b25ce9 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -253,6 +253,10 @@ static const VkExtensionProperties global_extensions[] = { .specVersion = 5, }, #endif + { + .extensionName = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, + .specVersion = 1, + }, }; static const VkExtensionProperties device_extensions[] = { @@ -497,6 +501,21 @@ void anv_GetPhysicalDeviceFeatures( pdevice->compiler->scalar_stage[MESA_SHADER_GEOMETRY]; } +void anv_GetPhysicalDeviceFeatures2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2KHR* pFeatures) +{ + anv_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features); + + for (struct anv_common *c = pFeatures->pNext; c != NULL; c = c->pNext) { + switch (c->sType) { + default: + anv_debug_ignored_stype(c->sType); + break; + } + } +} + void anv_GetPhysicalDeviceProperties( VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties) @@ -640,6 +659,21 @@ void anv_GetPhysicalDeviceProperties( memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE); } +void anv_GetPhysicalDeviceProperties2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties2KHR* pProperties) +{ + anv_GetPhysicalDeviceProperties(physicalDevice, &pProperties->properties); + + for (struct anv_common *c = pProperties->pNext; c != NULL; c = c->pNext) { + switch (c->sType) { + default: + anv_debug_ignored_stype(c->sType); + break; + } + } +} + static void anv_get_queue_family_properties(struct anv_physical_device *phys_dev, VkQueueFamilyProperties *props) @@ -679,6 +713,45 @@ void anv_GetPhysicalDeviceQueueFamilyProperties( anv_get_queue_family_properties(phys_dev, pQueueFamilyProperties); } +void anv_GetPhysicalDeviceQueueFamilyProperties2KHR( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties2KHR* pQueueFamilyProperties) +{ + + ANV_FROM_HANDLE(anv_physical_device, phys_dev, physicalDevice); + + if (pQueueFamilyProperties == NULL) { + *pQueueFamilyPropertyCount = 1; + return; + } + + /* The spec implicitly allows the incoming count to be 0. From the Vulkan + * 1.0.38 spec, Section 4.1 Physical Devices: + * + * If the value referenced by pQueueFamilyPropertyCount is not 0 [then + * do stuff]. + */ + if (*pQueueFamilyPropertyCount == 0) + return; + + /* We support exactly one queue family. So need to traverse only the first + * array element's pNext chain. + */ + *pQueueFamilyPropertyCount = 1; + anv_get_queue_family_properties(phys_dev, + &pQueueFamilyProperties->queueFamilyProperties); + + for (struct anv_common *c = pQueueFamilyProperties->pNext; + c != NULL; c = c->pNext) { + switch (c->sType) { + default: + anv_debug_ignored_stype(c->sType); + break; + } + } +} + void anv_GetPhysicalDeviceMemoryProperties( VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties) @@ -731,6 +804,23 @@ void anv_GetPhysicalDeviceMemoryProperties( }; } +void anv_GetPhysicalDeviceMemoryProperties2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties) +{ + anv_GetPhysicalDeviceMemoryProperties(physicalDevice, + &pMemoryProperties->memoryProperties); + + for (struct anv_common *c = pMemoryProperties->pNext; + c != NULL; c = c->pNext) { + switch (c->sType) { + default: + anv_debug_ignored_stype(c->sType); + break; + } + } +} + PFN_vkVoidFunction anv_GetInstanceProcAddr( VkInstance instance, const char* pName) diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 47f939b47ee..0e84960085a 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -462,6 +462,24 @@ void anv_GetPhysicalDeviceFormatProperties( pFormatProperties); } +void anv_GetPhysicalDeviceFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties2KHR* pFormatProperties) +{ + anv_GetPhysicalDeviceFormatProperties(physicalDevice, format, + &pFormatProperties->formatProperties); + + for (struct anv_common *c = pFormatProperties->pNext; + c != NULL; c = c->pNext) { + switch (c->sType) { + default: + anv_debug_ignored_stype(c->sType); + break; + } + } +} + static VkResult anv_get_image_format_properties( struct anv_physical_device *physical_device, @@ -637,6 +655,31 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( pImageFormatProperties); } +VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, + VkImageFormatProperties2KHR* pImageFormatProperties) +{ + ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice); + VkResult result; + + result = anv_get_image_format_properties(physical_device, pImageFormatInfo, + &pImageFormatProperties->imageFormatProperties); + if (result != VK_SUCCESS) + return result; + + for (struct anv_common *c = pImageFormatProperties->pNext; + c != NULL; c = c->pNext) { + switch (c->sType) { + default: + anv_debug_ignored_stype(c->sType); + break; + } + } + + return VK_SUCCESS; +} + void anv_GetPhysicalDeviceSparseImageFormatProperties( VkPhysicalDevice physicalDevice, VkFormat format, @@ -650,3 +693,13 @@ void anv_GetPhysicalDeviceSparseImageFormatProperties( /* Sparse images are not yet supported. */ *pNumProperties = 0; } + +void anv_GetPhysicalDeviceSparseImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, + uint32_t* pPropertyCount, + VkSparseImageFormatProperties2KHR* pProperties) +{ + /* Sparse images are not yet supported. */ + *pPropertyCount = 0; +} diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 12ee79d3d89..0cc6550a402 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -206,6 +206,24 @@ VkResult __vk_errorf(VkResult error, const char *file, int line, const char *for #define anv_debug(format, ...) #endif +/** + * Warn on ignored extension structs. + * + * The Vulkan spec requires us to ignore unsupported or unknown structs in + * a pNext chain. In debug mode, emitting warnings for ignored structs may + * help us discover structs that we should not have ignored. + * + * + * From the Vulkan 1.0.38 spec: + * + * Any component of the implementation (the loader, any enabled layers, + * and drivers) must skip over, without processing (other than reading the + * sType and pNext members) any chained structures with sType values not + * defined by extensions supported by that component. + */ +#define anv_debug_ignored_stype(sType) \ + anv_debug("debug: %s: ignored VkStructureType %u\n", __func__, (sType)) + void __anv_finishme(const char *file, int line, const char *format, ...) anv_printflike(3, 4); void anv_loge(const char *format, ...) anv_printflike(1, 2); |