Module: Mesa
Branch: main
Commit: 2f7bc066435ecde336397a9748c9d997b2f480f8
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f7bc066435ecde336397a9748c9d997b2f480f8

Author: Ganesh Belgur Ramachandra <[email protected]>
Date:   Tue Oct 10 01:17:55 2023 -0500

radeonsi: Fix clear-render-target shader for 1darrays in NIR

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25630>

---

 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);
 

Reply via email to