diff options
author | Jason Ekstrand <[email protected]> | 2018-07-20 14:24:17 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-07-22 23:24:10 -0700 |
commit | b99493c6288e060e2caded5124e7d347149704db (patch) | |
tree | edf6bef7052b3baff008c61f453551c7068c2afe /src | |
parent | 78f391d343609dca85fdaf1753a3403cf32a3842 (diff) |
anv: Properly handle GetImageSubresourceLayout on complex images
We support mipmapped and arrayed linear images so we need to support
vkGetImageSubresourceLayout on them. Fortunately, it's just a trivial
call into ISL.
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index c62bf7ae2b5..5d9becf5172 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -764,17 +764,26 @@ void anv_GetImageSubresourceLayout( assert(__builtin_popcount(subresource->aspectMask) == 1); - /* If we are on a non-zero mip level or array slice, we need to - * calculate a real offset. - */ - anv_assert(subresource->mipLevel == 0); - anv_assert(subresource->arrayLayer == 0); - layout->offset = surface->offset; layout->rowPitch = surface->isl.row_pitch; layout->depthPitch = isl_surf_get_array_pitch(&surface->isl); layout->arrayPitch = isl_surf_get_array_pitch(&surface->isl); - layout->size = surface->isl.size; + + if (subresource->mipLevel > 0 || subresource->arrayLayer > 0) { + assert(surface->isl.tiling == ISL_TILING_LINEAR); + + uint32_t offset_B; + isl_surf_get_image_offset_B_tile_sa(&surface->isl, + subresource->mipLevel, + subresource->arrayLayer, + 0 /* logical_z_offset_px */, + &offset_B, NULL, NULL); + layout->offset += offset_B; + layout->size = layout->rowPitch * anv_minify(image->extent.height, + subresource->mipLevel); + } else { + layout->size = surface->isl.size; + } } /** |