<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 25, 2017 at 12:12 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">---<br>
 src/intel/vulkan/anv_device.c  | 90 ++++++++++++++++++++++++++++++<wbr>++++++++++++<br>
 src/intel/vulkan/anv_formats.c | 53 +++++++++++++++++++++++++<br>
 src/intel/vulkan/anv_private.h | 18 +++++++++<br>
 3 files changed, 161 insertions(+)<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index 5c9652290f..5f86444ed9 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,21 @@ 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>
+   for (struct anv_common *c = pFeatures->pNext; c != NULL; c = c->pNext) {<br>
+      switch (c->sType) {<br>
+      default:<br>
+         anv_debug_ignored_stype(c-><wbr>sType);<br>
+         break;<br>
+      }<br>
+   }<br>
+}<br>
+<br>
 void anv_<wbr>GetPhysicalDeviceProperties(<br>
     VkPhysicalDevice                            physicalDevice,<br>
     VkPhysicalDeviceProperties*                 pProperties)<br>
@@ -636,6 +655,21 @@ 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>
+   for (struct anv_common *c = pProperties->pNext; c != NULL; c = c->pNext) {<br>
+      switch (c->sType) {<br>
+      default:<br>
+         anv_debug_ignored_stype(c-><wbr>sType);<br>
+         break;<br>
+      }<br>
+   }<br>
+}<br>
+<br>
 static void<br>
 anv_get_queue_family_<wbr>properties(struct anv_physical_device *phys_dev,<br>
                                 VkQueueFamilyProperties *props)<br>
@@ -675,6 +709,45 @@ void anv_<wbr>GetPhysicalDeviceQueueFamilyPr<wbr>operties(<br>
    anv_get_queue_family_<wbr>properties(phys_dev, pQueueFamilyProperties);<br>
 }<br>
<br>
+void anv_<wbr>GetPhysicalDeviceQueueFamilyPr<wbr>operties2KHR(<br>
+    VkPhysicalDevice                            physicalDevice,<br>
+    uint32_t*                                   pQueueFamilyPropertyCount,<br>
+    VkQueueFamilyProperties2KHR*                pQueueFamilyProperties)<br>
+{<br>
+<br>
+   ANV_FROM_HANDLE(anv_physical_<wbr>device, phys_dev, physicalDevice);<br>
+<br>
+   if (pQueueFamilyProperties == NULL) {<br>
+      *pQueueFamilyPropertyCount = 1;<br>
+      return;<br>
+   }<br>
+<br>
+   /* The spec implicitly allows the incoming count to be 0. From the Vulkan<br>
+    * 1.0.38 spec, Section 4.1 Physical Devices:<br>
+    *<br>
+    *     If the value referenced by pQueueFamilyPropertyCount is not 0 [then<br>
+    *     do stuff].<br>
+    */<br>
+   if (*pQueueFamilyPropertyCount == 0)<br>
+      return;<br>
+<br>
+   /* We support exactly one queue family. So need to traverse only the first<br>
+    * array element's pNext chain.<br>
+    */<br>
+   *pQueueFamilyPropertyCount = 1;<br>
+   anv_get_queue_family_<wbr>properties(phys_dev,<br>
+         &pQueueFamilyProperties-><wbr>queueFamilyProperties);<br>
+<br>
+   for (struct anv_common *c = pQueueFamilyProperties->pNext;<br>
+        c != NULL; c = c->pNext) {<br>
+      switch (c->sType) {<br>
+      default:<br>
+         anv_debug_ignored_stype(c-><wbr>sType);<br>
+         break;<br>
+      }<br>
+   }<br>
+}<br>
+<br>
 void anv_<wbr>GetPhysicalDeviceMemoryPropert<wbr>ies(<br>
     VkPhysicalDevice                            physicalDevice,<br>
     VkPhysicalDeviceMemoryProperti<wbr>es*           pMemoryProperties)<br>
@@ -727,6 +800,23 @@ 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>
+   for (struct anv_common *c = pMemoryProperties->pNext;<br>
+        c != NULL; c = c->pNext) {<br>
+      switch (c->sType) {<br>
+      default:<br>
+         anv_debug_ignored_stype(c-><wbr>sType);<br>
+         break;<br>
+      }<br>
+   }<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 b4ff9c7698..e7a04f313c 100644<br>
--- a/src/intel/vulkan/anv_<wbr>formats.c<br>
+++ b/src/intel/vulkan/anv_<wbr>formats.c<br>
@@ -450,6 +450,24 @@ 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>
+   for (struct anv_common *c = pFormatProperties->pNext;<br>
+        c != NULL; c = c->pNext) {<br>
+      switch (c->sType) {<br>
+      default:<br>
+         anv_debug_ignored_stype(c-><wbr>sType);<br>
+         break;<br>
+      }<br>
+   }<br>
+}<br>
+<br>
 static VkResult<br>
 anv_get_image_format_<wbr>properties(<br>
    struct anv_physical_device *physical_device,<br>
@@ -625,6 +643,31 @@ VkResult anv_<wbr>GetPhysicalDeviceImageFormatPr<wbr>operties(<br>
                                           pImageFormatProperties);<br>
 }<br>
<br>
+VkResult vkGetPhysicalDeviceImageFormat<wbr>Properties2KHR(<br></blockquote><div><br></div><div>This needs to be anv_<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    VkPhysicalDevice                            physicalDevice,<br>
+    const VkPhysicalDeviceImageFormatInf<wbr>o2KHR*  pImageFormatInfo,<br>
+    VkImageFormatProperties2KHR*                pImageFormatProperties)<br>
+{<br>
+   ANV_FROM_HANDLE(anv_physical_<wbr>device, physical_device, physicalDevice);<br>
+   VkResult result;<br>
+<br>
+   result = anv_get_image_format_<wbr>properties(physical_device, pImageFormatInfo,<br>
+               &pImageFormatProperties-><wbr>imageFormatProperties);<br>
+   if (result != VK_SUCCESS)<br>
+      return result;<br>
+<br>
+   for (struct anv_common *c = pImageFormatProperties->pNext;<br>
+        c != NULL; c = c->pNext) {<br>
+      switch (c->sType) {<br>
+      default:<br>
+         anv_debug_ignored_stype(c-><wbr>sType);<br>
+         break;<br>
+      }<br>
+   }<br>
+<br>
+   return VK_SUCCESS;<br>
+}<br>
+<br>
 void anv_<wbr>GetPhysicalDeviceSparseImageFo<wbr>rmatProperties(<br>
     VkPhysicalDevice                            physicalDevice,<br>
     VkFormat                                    format,<br>
@@ -638,3 +681,13 @@ void anv_<wbr>GetPhysicalDeviceSparseImageFo<wbr>rmatProperties(<br>
    /* Sparse images are not yet supported. */<br>
    *pNumProperties = 0;<br>
 }<br>
+<br>
+void vkGetPhysicalDeviceSparseImage<wbr>FormatProperties2KHR(<br></blockquote><div><br></div><div>This too.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    VkPhysicalDevice                            physicalDevice,<br>
+    const VkPhysicalDeviceSparseImageFor<wbr>matInfo2KHR* pFormatInfo,<br>
+    uint32_t*                                   pPropertyCount,<br>
+    VkSparseImageFormatProperties2<wbr>KHR*          pProperties)<br>
+{<br>
+   /* Sparse images are not yet supported. */<br>
+   *pPropertyCount = 0;<br>
+}<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index 2a071693ca..8b1ada29f8 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -206,6 +206,24 @@ VkResult __vk_errorf(VkResult error, const char *file, int line, const char *for<br>
 #define anv_debug(format, ...)<br>
 #endif<br>
<br>
+/**<br>
+ * Warn on ignored extension structs.<br>
+ *<br>
+ * The Vulkan spec requires us to ignore unsupported or unknown structs in<br>
+ * a pNext chain.  In debug mode, emitting warnings for ignored structs may<br>
+ * help us discover structs that we should not have ignored.<br>
+ *<br>
+ *<br>
+ * From the Vulkan 1.0.38 spec:<br>
+ *<br>
+ *    Any component of the implementation (the loader, any enabled layers,<br>
+ *    and drivers) must skip over, without processing (other than reading the<br>
+ *    sType and pNext members) any chained structures with sType values not<br>
+ *    defined by extensions supported by that component.<br>
+ */<br>
+#define anv_debug_ignored_stype(sType) \<br>
+   anv_debug("debug: %s: ignored VkStructureType %u\n", __func__, (sType))<br>
+<br>
 void __anv_finishme(const char *file, int line, const char *format, ...)<br>
    anv_printflike(3, 4);<br>
 void anv_loge(const char *format, ...) anv_printflike(1, 2);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>