From 2f7bc066435ecde336397a9748c9d997b2f480f8 Mon Sep 17 00:00:00 2001 From: Ganesh Belgur Ramachandra Date: Tue, 10 Oct 2023 01:17:55 -0500 Subject: [PATCH] radeonsi: Fix clear-render-target shader for 1darrays in NIR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are no GL CTS tests for 1darrays, relying on OpenCL CTS instead. This patch should fix the `clEnqueueFillImage` tests in OpenCL CTS. Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_shaderlib_nir.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_shaderlib_nir.c b/src/gallium/drivers/radeonsi/si_shaderlib_nir.c index c075e6bfa71..82011df8f35 100644 --- a/src/gallium/drivers/radeonsi/si_shaderlib_nir.c +++ b/src/gallium/drivers/radeonsi/si_shaderlib_nir.c @@ -601,6 +601,14 @@ void *si_clear_render_target_shader(struct si_context *sctx, enum pipe_texture_t nir_def *zero = nir_imm_int(&b, 0); nir_def *ubo = nir_load_ubo(&b, 4, 32, zero, zero, .range_base = 0, .range = 16); + /* TODO: No GL CTS tests for 1D arrays, relying on OpenCL CTS for now. + * As a sanity check, "OpenCL-CTS/test_conformance/images/clFillImage" tests should pass + */ + if (type == PIPE_TEXTURE_1D_ARRAY) { + unsigned swizzle[4] = {0, 2, 0, 0}; + ubo = nir_swizzle(&b, ubo, swizzle, 4); + } + address = nir_iadd(&b, address, ubo); nir_def *coord = nir_pad_vector(&b, address, 4);