From 447cddd455da2be70b93522d66891c0ccb90a9d5 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 12 Jan 2022 17:19:26 +0100 Subject: radv: fix copying VRS rates if the ds attachment uses mips While the VRS image can't have mips (and no layers because still not supported by RADV), applications might still want to bind a depth/stencil attachment where the base level isn't 0. Found by inspection. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/amd/vulkan') diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index cad9a5204e6..d1aaa2e6e14 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -5814,15 +5814,17 @@ radv_cmd_buffer_begin_subpass(struct radv_cmd_buffer *cmd_buffer, uint32_t subpa int ds_idx = subpass->depth_stencil_attachment->attachment; struct radv_image_view *ds_iview = cmd_buffer->state.attachments[ds_idx].iview; struct radv_image *ds_image = ds_iview->image; + uint32_t level = ds_iview->base_mip; VkExtent2D extent = { - .width = ds_image->info.width, - .height = ds_image->info.height, + .width = radv_minify(ds_image->info.width, level), + .height = radv_minify(ds_image->info.height, level), }; /* HTILE buffer */ - uint64_t htile_offset = ds_image->offset + ds_image->planes[0].surface.meta_offset; - uint64_t htile_size = ds_image->planes[0].surface.meta_slice_size; + uint64_t htile_offset = ds_image->offset + ds_image->planes[0].surface.meta_offset + + ds_image->planes[0].surface.u.gfx9.meta_levels[level].offset; + uint64_t htile_size = ds_image->planes[0].surface.u.gfx9.meta_levels[level].size; struct radv_buffer htile_buffer; radv_buffer_init(&htile_buffer, cmd_buffer->device, ds_image->bo, htile_size, htile_offset); -- cgit v1.2.3