[Mesa-dev] [PATCH] anv: Implement VK_KHR_get_physical_device_properties2

Chad Versace chadversary at chromium.org
Mon Jan 23 22:28:33 UTC 2017


Implement each vkFoo2KHR() by trivially passing it through to the
original vkFoo().

---

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_GetPhysicalDeviceSparseImageFormatProperties(
    /* 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



More information about the mesa-dev mailing list