radeonsi: Make si_compute_clear_image work with 422 subsampled formats

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29598>
This commit is contained in:
David Rosca 2024-06-10 09:26:31 +02:00 committed by Marge Bot
parent 4a18809a56
commit 39fdd2aec0

View file

@ -733,6 +733,8 @@ bool si_compute_clear_image(struct si_context *sctx, struct pipe_resource *tex,
const union pipe_color_union *color, bool render_condition_enable,
bool fail_if_slow)
{
unsigned access = 0;
struct pipe_blit_info info;
memset(&info, 0, sizeof(info));
info.dst.resource = tex;
@ -742,7 +744,13 @@ bool si_compute_clear_image(struct si_context *sctx, struct pipe_resource *tex,
info.mask = util_format_is_depth_or_stencil(format) ? PIPE_MASK_ZS : PIPE_MASK_RGBA;
info.render_condition_enable = render_condition_enable;
return si_compute_blit(sctx, &info, color, 0, 0,
if (util_format_is_subsampled_422(tex->format)) {
access |= SI_IMAGE_ACCESS_BLOCK_FORMAT_AS_UINT;
info.dst.format = PIPE_FORMAT_R32_UINT;
info.dst.box.x = util_format_get_nblocksx(tex->format, info.dst.box.x);
}
return si_compute_blit(sctx, &info, color, access, 0,
SI_OP_SYNC_BEFORE_AFTER | (fail_if_slow ? SI_OP_FAIL_IF_SLOW : 0));
}