<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 13, 2017 at 2:23 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">No intended change in behavior. Just a refactor.<br>
---<br>
 src/intel/vulkan/anv_device.c | 32 ++++++------------------------<wbr>--<br>
 1 file changed, 6 insertions(+), 26 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index f04e177771e..35c5a4645ff 100644<br>
--- a/src/intel/vulkan/anv_device.<wbr>c<br>
+++ b/src/intel/vulkan/anv_device.<wbr>c<br>
@@ -390,6 +390,7 @@ VkResult anv_EnumeratePhysicalDevices(<br>
     VkPhysicalDevice*                           pPhysicalDevices)<br>
 {<br>
    ANV_FROM_HANDLE(anv_instance, instance, _instance);<br>
+   VK_OUTARRAY_MAKE(out, pPhysicalDevices, pPhysicalDeviceCount);<br>
    VkResult result;<br>
<br>
    if (instance->physicalDeviceCount < 0) {<br>
@@ -411,34 +412,13 @@ VkResult anv_EnumeratePhysicalDevices(<br>
       }<br>
    }<br>
<br>
-   /* pPhysicalDeviceCount is an out parameter if pPhysicalDevices is NULL;<br>
-    * otherwise it's an inout parameter.<br>
-    *<br>
-    * The Vulkan spec (git aaed022) says:<br>
-    *<br>
-    *    pPhysicalDeviceCount is a pointer to an unsigned integer variable<br>
-    *    that is initialized with the number of devices the application is<br>
-    *    prepared to receive handles to. pname:pPhysicalDevices is pointer to<br>
-    *    an array of at least this many VkPhysicalDevice handles [...].<br>
-    *<br>
-    *    Upon success, if pPhysicalDevices is NULL, vkEnumeratePhysicalDevices<br>
-    *    overwrites the contents of the variable pointed to by<br>
-    *    pPhysicalDeviceCount with the number of physical devices in in the<br>
-    *    instance; otherwise, vkEnumeratePhysicalDevices overwrites<br>
-    *    pPhysicalDeviceCount with the number of physical handles written to<br>
-    *    pPhysicalDevices.<br>
-    */<br>
-   if (!pPhysicalDevices) {<br>
-      *pPhysicalDeviceCount = instance->physicalDeviceCount;<br>
-   } else if (*pPhysicalDeviceCount >= 1) {<br>
-      pPhysicalDevices[0] = anv_physical_device_to_handle(<wbr>&instance->physicalDevice);<br>
-      *pPhysicalDeviceCount = 1;<br>
-   } else if (*pPhysicalDeviceCount < instance->physicalDeviceCount) {<br>
-      return VK_INCOMPLETE;<br>
-   } else {<br>
-      *pPhysicalDeviceCount = 0;<br>
+   vk_outarray_append(&out, i) {<br>
+      *i = anv_physical_device_to_handle(<wbr>&instance->physicalDevice);<br>
    }<br>
<br>
+   if (vk_outarray_is_incomple(&out)<wbr>)<br>
+      return VK_INCOMPLETE;<br></blockquote><div><br></div><div>I still think I'd prefer a vk_outarray_status() helper and this would be "return vk_outarray_status(&out)".  But meh...<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
    return VK_SUCCESS;<br>
 }<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.12.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>