[Mesa-dev] [PATCH v2 2/2] anv: image: report correct depthPicth for 3d images
Lionel Landwerlin
llandwerlin at gmail.com
Thu Dec 8 16:48:36 UTC 2016
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.
v2: pass mipLevel
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
src/intel/vulkan/anv_image.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index e60373a151..c64c444290 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,35 @@ 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,
+ subresource->mipLevel);
layout->arrayPitch = isl_surf_get_array_pitch(&surface->isl);
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
More information about the mesa-dev
mailing list