<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 23, 2017 at 2:28 PM, Chad Versace <span dir="ltr"><<a href="mailto:chadversary@chromium.org" target="_blank">chadversary@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Implement each vkFoo2KHR() by trivially passing it through to the<br>
original vkFoo().<br></blockquote><div><br></div><div>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:<br><br></div><div>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.<br></div><div>2) Implement each query as its own function and the queries2 function loops over the data structures calling the appropriate function on each one.<br><br></div><div>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?<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
<br>
I tested this patch with a little demo app, but I haven't ran any CTS tests<br>
with it. If CTS tests do exit (I'm searching for them now), I'll run<br>
them against this patch before pushing.<br>
<br>
 src/intel/vulkan/anv_device.c  | 36 ++++++++++++++++++++++++++++++<wbr>++++++<br>
 src/intel/vulkan/anv_formats.c | 39 ++++++++++++++++++++++++++++++<wbr>+++++++++<br>
 2 files changed, 75 insertions(+)<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index f80a36a940..7a7ada3bfb 100644<br>
--- a/src/intel/vulkan/anv_device.<wbr>c<br>
+++ b/src/intel/vulkan/anv_device.<wbr>c<br>
@@ -253,6 +253,10 @@ static const VkExtensionProperties global_extensions[] = {<br>
       .specVersion = 5,<br>
    },<br>
 #endif<br>
+   {<br>
+      .extensionName = VK_KHR_GET_PHYSICAL_DEVICE_<wbr>PROPERTIES_2_EXTENSION_NAME,<br>
+      .specVersion = 1,<br>
+   },<br>
 };<br>
<br>
 static const VkExtensionProperties device_extensions[] = {<br>
@@ -493,6 +497,13 @@ void anv_GetPhysicalDeviceFeatures(<br>
       pdevice->compiler->scalar_<wbr>stage[MESA_SHADER_GEOMETRY];<br>
 }<br>
<br>
+void anv_<wbr>GetPhysicalDeviceFeatures2KHR(<br>
+    VkPhysicalDevice                            physicalDevice,<br>
+    VkPhysicalDeviceFeatures2KHR*               pFeatures)<br>
+{<br>
+   anv_GetPhysicalDeviceFeatures(<wbr>physicalDevice, &pFeatures->features);<br>
+}<br>
+<br>
 void anv_<wbr>GetPhysicalDeviceProperties(<br>
     VkPhysicalDevice                            physicalDevice,<br>
     VkPhysicalDeviceProperties*                 pProperties)<br>
@@ -636,6 +647,13 @@ void anv_<wbr>GetPhysicalDeviceProperties(<br>
    memcpy(pProperties-><wbr>pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE);<br>
 }<br>
<br>
+void anv_<wbr>GetPhysicalDeviceProperties2KH<wbr>R(<br>
+    VkPhysicalDevice                            physicalDevice,<br>
+    VkPhysicalDeviceProperties2KHR<wbr>*             pProperties)<br>
+{<br>
+   anv_<wbr>GetPhysicalDeviceProperties(<wbr>physicalDevice, &pProperties->properties);<br>
+}<br>
+<br>
 void anv_<wbr>GetPhysicalDeviceQueueFamilyPr<wbr>operties(<br>
     VkPhysicalDevice                            physicalDevice,<br>
     uint32_t*                                   pCount,<br>
@@ -667,6 +685,16 @@ void anv_<wbr>GetPhysicalDeviceQueueFamilyPr<wbr>operties(<br>
    *pCount = 1;<br>
 }<br>
<br>
+void anv_<wbr>GetPhysicalDeviceQueueFamilyPr<wbr>operties2KHR(<br>
+    VkPhysicalDevice                            physicalDevice,<br>
+    uint32_t*                                   pQueueFamilyPropertyCount,<br>
+    VkQueueFamilyProperties2KHR*                pQueueFamilyProperties)<br>
+{<br>
+   anv_<wbr>GetPhysicalDeviceQueueFamilyPr<wbr>operties(physicalDevice,<br>
+         pQueueFamilyPropertyCount,<br>
+         &pQueueFamilyProperties-><wbr>queueFamilyProperties);<br>
+}<br>
+<br>
 void anv_<wbr>GetPhysicalDeviceMemoryPropert<wbr>ies(<br>
     VkPhysicalDevice                            physicalDevice,<br>
     VkPhysicalDeviceMemoryProperti<wbr>es*           pMemoryProperties)<br>
@@ -719,6 +747,14 @@ void anv_<wbr>GetPhysicalDeviceMemoryPropert<wbr>ies(<br>
    };<br>
 }<br>
<br>
+void anv_<wbr>GetPhysicalDeviceMemoryPropert<wbr>ies2KHR(<br>
+    VkPhysicalDevice                            physicalDevice,<br>
+    VkPhysicalDeviceMemoryProperti<wbr>es2KHR*       pMemoryProperties)<br>
+{<br>
+   anv_<wbr>GetPhysicalDeviceMemoryPropert<wbr>ies(physicalDevice,<br>
+                                         &pMemoryProperties-><wbr>memoryProperties);<br>
+}<br>
+<br>
 PFN_vkVoidFunction anv_GetInstanceProcAddr(<br>
     VkInstance                                  instance,<br>
     const char*                                 pName)<br>
diff --git a/src/intel/vulkan/anv_<wbr>formats.c b/src/intel/vulkan/anv_<wbr>formats.c<br>
index a5d783e689..c4ee14cab4 100644<br>
--- a/src/intel/vulkan/anv_<wbr>formats.c<br>
+++ b/src/intel/vulkan/anv_<wbr>formats.c<br>
@@ -450,6 +450,15 @@ void anv_<wbr>GetPhysicalDeviceFormatPropert<wbr>ies(<br>
                pFormatProperties);<br>
 }<br>
<br>
+void anv_<wbr>GetPhysicalDeviceFormatPropert<wbr>ies2KHR(<br>
+    VkPhysicalDevice                            physicalDevice,<br>
+    VkFormat                                    format,<br>
+    VkFormatProperties2KHR*                     pFormatProperties)<br>
+{<br>
+   anv_<wbr>GetPhysicalDeviceFormatPropert<wbr>ies(physicalDevice, format,<br>
+                                         &pFormatProperties-><wbr>formatProperties);<br>
+}<br>
+<br>
 VkResult anv_<wbr>GetPhysicalDeviceImageFormatPr<wbr>operties(<br>
     VkPhysicalDevice                            physicalDevice,<br>
     VkFormat                                    format,<br>
@@ -604,6 +613,20 @@ unsupported:<br>
    return VK_ERROR_FORMAT_NOT_SUPPORTED;<br>
 }<br>
<br>
+VkResult vkGetPhysicalDeviceImageFormat<wbr>Properties2KHR(<br>
+    VkPhysicalDevice                            physicalDevice,<br>
+    const VkPhysicalDeviceImageFormatInf<wbr>o2KHR*  pImageFormatInfo,<br>
+    VkImageFormatProperties2KHR*                pImageFormatProperties)<br>
+{<br>
+   return anv_<wbr>GetPhysicalDeviceImageFormatPr<wbr>operties(physicalDevice,<br>
+            pImageFormatInfo->format,<br>
+            pImageFormatInfo->type,<br>
+            pImageFormatInfo->tiling,<br>
+            pImageFormatInfo->usage,<br>
+            pImageFormatInfo->flags,<br>
+            &pImageFormatProperties-><wbr>imageFormatProperties);<br>
+}<br>
+<br>
 void anv_<wbr>GetPhysicalDeviceSparseImageFo<wbr>rmatProperties(<br>
     VkPhysicalDevice                            physicalDevice,<br>
     VkFormat                                    format,<br>
@@ -617,3 +640,19 @@ void anv_<wbr>GetPhysicalDeviceSparseImageFo<wbr>rmatProperties(<br>
    /* Sparse images are not yet supported. */<br>
    *pNumProperties = 0;<br>
 }<br>
+<br>
+void vkGetPhysicalDeviceSparseImage<wbr>FormatProperties2KHR(<br>
+    VkPhysicalDevice                            physicalDevice,<br>
+    const VkPhysicalDeviceSparseImageFor<wbr>matInfo2KHR* pFormatInfo,<br>
+    uint32_t*                                   pPropertyCount,<br>
+    VkSparseImageFormatProperties2<wbr>KHR*          pProperties)<br>
+{<br>
+   anv_<wbr>GetPhysicalDeviceSparseImageFo<wbr>rmatProperties(physicalDevice,<br>
+         pFormatInfo->format,<br>
+         pFormatInfo->type,<br>
+         pFormatInfo->samples,<br>
+         pFormatInfo->usage,<br>
+         pFormatInfo->tiling,<br>
+         pPropertyCount,<br>
+         &pProperties->properties);<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
</font></span></blockquote></div><br></div></div>