<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Dec 6, 2016 at 3:05 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:llandwerlin@gmail.com" target="_blank">llandwerlin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">With a 3d image of 2x2x3, vkGetImageSubresourceLayout currently reports :<br>
VkSubresourceLayout = { offset = 0,<br>
                        size = 160,<br>
                        rowPitch = 16,<br>
                        arrayPitch = 96,<br>
                        depthPitch = 96 }<br>
<br>
depthPitch should be 32.<br>
</span>Use the newly introduce isl function to query the depth.<br>
<span class=""><br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
</span> src/intel/vulkan/anv_image.c | 15 +++++++++------<br>
 1 file changed, 9 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
index e60373a151..af5e3c4974 100644<br>
--- a/src/intel/vulkan/anv_image.c<br>
+++ b/src/intel/vulkan/anv_image.c<br>
@@ -363,7 +363,8 @@ VkResult anv_BindImageMemory(<br>
 }<br>
<br>
 static void<br>
-anv_surface_get_subresource_<wbr>layout(struct anv_image *image,<br>
+anv_surface_get_subresource_<wbr>layout(struct anv_device *device,<br>
+                                   struct anv_image *image,<br>
                                    struct anv_surface *surface,<br>
                                    const VkImageSubresource *subresource,<br>
                                    VkSubresourceLayout *layout)<br>
@@ -376,32 +377,34 @@ anv_surface_get_subresource_<wbr>layout(struct anv_image *image,<br>
<span class=""><br>
    layout->offset = surface->offset;<br>
    layout->rowPitch = surface->isl.row_pitch;<br>
-   layout->depthPitch = isl_surf_get_array_pitch(&<wbr>surface->isl);<br>
</span>+   layout->depthPitch = isl_surf_get_depth_pitch(&<wbr>device->isl_dev,<br>
+                                                 &surface->isl);<br></blockquote><div><br></div><div>We want this to be 0 for lod > 0 on Broadwell and older.  Let's not lie with a number that looks like it could be valid.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="">    layout->arrayPitch = isl_surf_get_array_pitch(&<wbr>surface->isl);<br></span></blockquote><div><br></div><div>I think we want this to be 0 for 3D<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
    layout->size = surface->isl.size;<br>
 }<br>
<br>
</span> void anv_GetImageSubresourceLayout(<br>
-    VkDevice                                    device,<br>
+    VkDevice                                    _device,<br>
     VkImage                                     _image,<br>
     const VkImageSubresource*                   pSubresource,<br>
     VkSubresourceLayout*                        pLayout)<br>
 {<br>
+   ANV_FROM_HANDLE(anv_device, device, _device);<br>
    ANV_FROM_HANDLE(anv_image, image, _image);<br>
<br>
    assert(__builtin_popcount(<wbr>pSubresource->aspectMask) == 1);<br>
<br>
    switch (pSubresource->aspectMask) {<br>
    case VK_IMAGE_ASPECT_COLOR_BIT:<br>
-      anv_surface_get_subresource_<wbr>layout(image, &image->color_surface,<br>
+      anv_surface_get_subresource_<wbr>layout(device, image, &image->color_surface,<br>
                                          pSubresource, pLayout);<br>
       break;<br>
    case VK_IMAGE_ASPECT_DEPTH_BIT:<br>
-      anv_surface_get_subresource_<wbr>layout(image, &image->depth_surface,<br>
+      anv_surface_get_subresource_<wbr>layout(device, image, &image->depth_surface,<br>
                                          pSubresource, pLayout);<br>
       break;<br>
    case VK_IMAGE_ASPECT_STENCIL_BIT:<br>
-      anv_surface_get_subresource_<wbr>layout(image, &image->stencil_surface,<br>
+      anv_surface_get_subresource_<wbr>layout(device, image, &image->stencil_surface,<br>
                                          pSubresource, pLayout);<br>
       break;<br>
    default:<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
</font></span><div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br></div></div>