From 84a563cf6f179b9d76cc12884ed63d99a0b001f3 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 24 Jun 2024 15:33:42 +0200 Subject: [PATCH] radeonsi: fix buffer_size in si_compute_shorten_ubyte_buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit buffer_size is not the full buffer size, but the part of the buffer that is accessed by the compute shader. This fixes the assert hit in si_set_shader_buffer. Fixes: 1a99f50c7f2 ("radeonsi: use a compute shader to convert unsupported indices format") Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_compute_blit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_compute_blit.c b/src/gallium/drivers/radeonsi/si_compute_blit.c index dd720feb77e..0497a5236f6 100644 --- a/src/gallium/drivers/radeonsi/si_compute_blit.c +++ b/src/gallium/drivers/radeonsi/si_compute_blit.c @@ -416,9 +416,9 @@ void si_copy_buffer(struct si_context *sctx, struct pipe_resource *dst, struct p } void si_compute_shorten_ubyte_buffer(struct si_context *sctx, struct pipe_resource *dst, struct pipe_resource *src, - uint64_t dst_offset, uint64_t src_offset, unsigned size, unsigned flags) + uint64_t dst_offset, uint64_t src_offset, unsigned count, unsigned flags) { - if (!size) + if (!count) return; if (!sctx->cs_ubyte_to_ushort) @@ -432,16 +432,16 @@ void si_compute_shorten_ubyte_buffer(struct si_context *sctx, struct pipe_resour si_improve_sync_flags(sctx, dst, src, &flags); struct pipe_grid_info info = {}; - set_work_size(&info, 64, 1, 1, size, 1, 1); + set_work_size(&info, 64, 1, 1, count, 1, 1); struct pipe_shader_buffer sb[2] = {}; sb[0].buffer = dst; sb[0].buffer_offset = dst_offset; - sb[0].buffer_size = dst->width0; + sb[0].buffer_size = count * 2; sb[1].buffer = src; sb[1].buffer_offset = src_offset; - sb[1].buffer_size = src->width0; + sb[1].buffer_size = count; si_launch_grid_internal_ssbos(sctx, &info, sctx->cs_ubyte_to_ushort, flags, coher, 2, sb, 0x1);