On Tue, Dec 6, 2016 at 3:05 AM, Lionel Landwerlin <llandwer...@gmail.com> wrote:
> With a 3d image of 2x2x3, vkGetImageSubresourceLayout currently reports : > VkSubresourceLayout = { offset = 0, > size = 160, > rowPitch = 16, > arrayPitch = 96, > depthPitch = 96 } > > depthPitch should be 32. > Use the newly introduce isl function to query the depth. > > Signed-off-by: Lionel Landwerlin <lionel.g.landwer...@intel.com> > --- > src/intel/vulkan/anv_image.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c > index e60373a151..af5e3c4974 100644 > --- a/src/intel/vulkan/anv_image.c > +++ b/src/intel/vulkan/anv_image.c > @@ -363,7 +363,8 @@ VkResult anv_BindImageMemory( > } > > static void > -anv_surface_get_subresource_layout(struct anv_image *image, > +anv_surface_get_subresource_layout(struct anv_device *device, > + struct anv_image *image, > struct anv_surface *surface, > const VkImageSubresource *subresource, > VkSubresourceLayout *layout) > @@ -376,32 +377,34 @@ anv_surface_get_subresource_layout(struct anv_image > *image, > > layout->offset = surface->offset; > layout->rowPitch = surface->isl.row_pitch; > - layout->depthPitch = isl_surf_get_array_pitch(&surface->isl); > + layout->depthPitch = isl_surf_get_depth_pitch(&device->isl_dev, > + &surface->isl); > 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. > layout->arrayPitch = isl_surf_get_array_pitch(&surface->isl); > I think we want this to be 0 for 3D > layout->size = surface->isl.size; > } > > void anv_GetImageSubresourceLayout( > - VkDevice device, > + VkDevice _device, > VkImage _image, > const VkImageSubresource* pSubresource, > VkSubresourceLayout* pLayout) > { > + ANV_FROM_HANDLE(anv_device, device, _device); > ANV_FROM_HANDLE(anv_image, image, _image); > > assert(__builtin_popcount(pSubresource->aspectMask) == 1); > > switch (pSubresource->aspectMask) { > case VK_IMAGE_ASPECT_COLOR_BIT: > - anv_surface_get_subresource_layout(image, &image->color_surface, > + anv_surface_get_subresource_layout(device, image, > &image->color_surface, > pSubresource, pLayout); > break; > case VK_IMAGE_ASPECT_DEPTH_BIT: > - anv_surface_get_subresource_layout(image, &image->depth_surface, > + anv_surface_get_subresource_layout(device, image, > &image->depth_surface, > pSubresource, pLayout); > break; > case VK_IMAGE_ASPECT_STENCIL_BIT: > - anv_surface_get_subresource_layout(image, &image->stencil_surface, > + anv_surface_get_subresource_layout(device, image, > &image->stencil_surface, > pSubresource, pLayout); > break; > default: > -- > 2.11.0 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev