[Mesa-dev] [PATCH] anv: Implement VK_KHR_get_physical_device_properties2
Jason Ekstrand
jason at jlekstrand.net
Mon Jan 23 22:36:42 UTC 2017
On Mon, Jan 23, 2017 at 2:28 PM, Chad Versace <chadversary at chromium.org>
wrote:
> Implement each vkFoo2KHR() by trivially passing it through to the
> original vkFoo().
>
As I mentioned to Lionel when he wrote basically this exact same patch, I
think that may be backwards. I can see two ways of doing this long-term:
1) Implement all of the queries (of a particular type) in a single function
and the legacy query calls the query2 variant and then copies the data over.
2) Implement each query as its own function and the queries2 function loops
over the data structures calling the appropriate function on each one.
TBH, I'm not sure which of those two I prefer but I would like to at least
think about the future so we don't have to come through and rewrite it. I
think I'm slightly leaning towards option 2 but I'm not sold. Thoughs?
--Jason
> ---
>
> I tested this patch with a little demo app, but I haven't ran any CTS tests
> with it. If CTS tests do exit (I'm searching for them now), I'll run
> them against this patch before pushing.
>
> src/intel/vulkan/anv_device.c | 36 ++++++++++++++++++++++++++++++++++++
> src/intel/vulkan/anv_formats.c | 39 ++++++++++++++++++++++++++++++
> +++++++++
> 2 files changed, 75 insertions(+)
>
> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> index f80a36a940..7a7ada3bfb 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[] = {
> @@ -493,6 +497,13 @@ void anv_GetPhysicalDeviceFeatures(
> pdevice->compiler->scalar_stage[MESA_SHADER_GEOMETRY];
> }
>
> +void anv_GetPhysicalDeviceFeatures2KHR(
> + VkPhysicalDevice physicalDevice,
> + VkPhysicalDeviceFeatures2KHR* pFeatures)
> +{
> + anv_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
> +}
> +
> void anv_GetPhysicalDeviceProperties(
> VkPhysicalDevice physicalDevice,
> VkPhysicalDeviceProperties* pProperties)
> @@ -636,6 +647,13 @@ void anv_GetPhysicalDeviceProperties(
> memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE);
> }
>
> +void anv_GetPhysicalDeviceProperties2KHR(
> + VkPhysicalDevice physicalDevice,
> + VkPhysicalDeviceProperties2KHR* pProperties)
> +{
> + anv_GetPhysicalDeviceProperties(physicalDevice,
> &pProperties->properties);
> +}
> +
> void anv_GetPhysicalDeviceQueueFamilyProperties(
> VkPhysicalDevice physicalDevice,
> uint32_t* pCount,
> @@ -667,6 +685,16 @@ void anv_GetPhysicalDeviceQueueFamilyProperties(
> *pCount = 1;
> }
>
> +void anv_GetPhysicalDeviceQueueFamilyProperties2KHR(
> + VkPhysicalDevice physicalDevice,
> + uint32_t* pQueueFamilyPropertyCount,
> + VkQueueFamilyProperties2KHR* pQueueFamilyProperties)
> +{
> + anv_GetPhysicalDeviceQueueFamilyProperties(physicalDevice,
> + pQueueFamilyPropertyCount,
> + &pQueueFamilyProperties->queueFamilyProperties);
> +}
> +
> void anv_GetPhysicalDeviceMemoryProperties(
> VkPhysicalDevice physicalDevice,
> VkPhysicalDeviceMemoryProperties* pMemoryProperties)
> @@ -719,6 +747,14 @@ void anv_GetPhysicalDeviceMemoryProperties(
> };
> }
>
> +void anv_GetPhysicalDeviceMemoryProperties2KHR(
> + VkPhysicalDevice physicalDevice,
> + VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties)
> +{
> + anv_GetPhysicalDeviceMemoryProperties(physicalDevice,
> + &pMemoryProperties->
> memoryProperties);
> +}
> +
> 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 a5d783e689..c4ee14cab4 100644
> --- a/src/intel/vulkan/anv_formats.c
> +++ b/src/intel/vulkan/anv_formats.c
> @@ -450,6 +450,15 @@ void anv_GetPhysicalDeviceFormatProperties(
> pFormatProperties);
> }
>
> +void anv_GetPhysicalDeviceFormatProperties2KHR(
> + VkPhysicalDevice physicalDevice,
> + VkFormat format,
> + VkFormatProperties2KHR* pFormatProperties)
> +{
> + anv_GetPhysicalDeviceFormatProperties(physicalDevice, format,
> + &pFormatProperties->
> formatProperties);
> +}
> +
> VkResult anv_GetPhysicalDeviceImageFormatProperties(
> VkPhysicalDevice physicalDevice,
> VkFormat format,
> @@ -604,6 +613,20 @@ unsupported:
> return VK_ERROR_FORMAT_NOT_SUPPORTED;
> }
>
> +VkResult vkGetPhysicalDeviceImageFormatProperties2KHR(
> + VkPhysicalDevice physicalDevice,
> + const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo,
> + VkImageFormatProperties2KHR* pImageFormatProperties)
> +{
> + return anv_GetPhysicalDeviceImageFormatProperties(physicalDevice,
> + pImageFormatInfo->format,
> + pImageFormatInfo->type,
> + pImageFormatInfo->tiling,
> + pImageFormatInfo->usage,
> + pImageFormatInfo->flags,
> + &pImageFormatProperties->imageFormatProperties);
> +}
> +
> void anv_GetPhysicalDeviceSparseImageFormatProperties(
> VkPhysicalDevice physicalDevice,
> VkFormat format,
> @@ -617,3 +640,19 @@ void anv_GetPhysicalDeviceSparseImageFo
> rmatProperties(
> /* Sparse images are not yet supported. */
> *pNumProperties = 0;
> }
> +
> +void vkGetPhysicalDeviceSparseImageFormatProperties2KHR(
> + VkPhysicalDevice physicalDevice,
> + const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo,
> + uint32_t* pPropertyCount,
> + VkSparseImageFormatProperties2KHR* pProperties)
> +{
> + anv_GetPhysicalDeviceSparseImageFormatProperties(physicalDevice,
> + pFormatInfo->format,
> + pFormatInfo->type,
> + pFormatInfo->samples,
> + pFormatInfo->usage,
> + pFormatInfo->tiling,
> + pPropertyCount,
> + &pProperties->properties);
> +}
> --
> 2.11.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170123/2304f652/attachment-0001.html>
More information about the mesa-dev
mailing list