radv: fix copying VRS rates to HTILE if the depth/stencil is cleared

If the application binds a fragment shading rate attachment to a
subpass and also clears the depth stencil attachment, the VRS rates
would have been reinitialized to 1x1 with fast clears. It makes more
sense to clear and then copy instead of the opposite.

Found by inspection.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14518>
This commit is contained in:
Samuel Pitoiset 2022-01-07 08:59:53 +01:00 committed by Marge Bot
parent 7dd456b173
commit 86909babc9

View file

@ -2559,7 +2559,7 @@ radv_emit_framebuffer_state(struct radv_cmd_buffer *cmd_buffer)
*/
radv_load_ds_clear_metadata(cmd_buffer, iview);
}
} else if (subpass->vrs_attachment && cmd_buffer->device->vrs.image) {
} else if (subpass->vrs_attachment && radv_cmd_buffer_get_vrs_image(cmd_buffer)) {
/* When a subpass uses a VRS attachment without binding a depth/stencil attachment, we have to
* bind our internal depth buffer that contains the VRS data as part of HTILE.
*/
@ -5799,6 +5799,10 @@ radv_cmd_buffer_begin_subpass(struct radv_cmd_buffer *cmd_buffer, uint32_t subpa
radv_handle_subpass_image_transition(cmd_buffer, subpass->attachments[i], true);
}
radv_describe_barrier_end(cmd_buffer);
radv_cmd_buffer_clear_subpass(cmd_buffer);
if (subpass->vrs_attachment) {
int idx = subpass->vrs_attachment->attachment;
struct radv_image_view *vrs_iview = cmd_buffer->state.attachments[idx].iview;
@ -5849,10 +5853,6 @@ radv_cmd_buffer_begin_subpass(struct radv_cmd_buffer *cmd_buffer, uint32_t subpa
}
}
radv_describe_barrier_end(cmd_buffer);
radv_cmd_buffer_clear_subpass(cmd_buffer);
assert(cmd_buffer->cs->cdw <= cdw_max);
}