From b24628f4b7baeb1ea228502b500bd13412d0dcdf Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Mon, 19 Jan 2026 13:11:28 +0100 Subject: [PATCH] r600: fix rv770 clamp to max_texel_buffer_elements This change fixes the clamp to max_texel_buffer_elements issue related to rv770 and older gpus. Here are the tests fixed on rv770: spec/arb_texture_buffer_object/texture-buffer-size-clamp/r8ui_texture_buffer_size_via_sampler: fail pass spec/arb_texture_buffer_object/texture-buffer-size-clamp/rg8ui_texture_buffer_size_via_sampler: fail pass spec/arb_texture_buffer_object/texture-buffer-size-clamp/rgba8ui_texture_buffer_size_via_sampler: fail pass Fixes: 1a441ad5cb58 ("r600: clamp to max_texel_buffer_elements") Signed-off-by: Patrick Lerda (cherry picked from commit afcead9158f1e56fef500a910f3f4bc83dbc0b37) Part-of: --- .pick_status.json | 2 +- src/gallium/drivers/r600/r600_state_common.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f0eb30041f8..92f4f78c406 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1554,7 +1554,7 @@ "description": "r600: fix rv770 clamp to max_texel_buffer_elements", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "1a441ad5cb58e8169a0d83dd63a7c38462cdb18b", "notes": null diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 93d1160e5e4..7e905e619af 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1466,8 +1466,11 @@ static void r600_setup_buffer_constants(struct r600_context *rctx, int shader_ty } else constants[offset + 4] = 0; - constants[offset + 5] = samplers->views.views[i]->base.u.buf.size / - util_format_get_blocksize(samplers->views.views[i]->base.format); + constants[offset + 5] = MIN2(util_format_get_blocksize(samplers->views.views[i]->base.format) * + rctx->screen->b.b.caps.max_texel_buffer_elements, + samplers->views.views[i]->base.u.buf.size) / + util_format_get_blocksize(samplers->views.views[i]->base.format); + constants[offset + 6] = samplers->views.views[i]->base.texture->array_size / 6; } }