From 5c63d7a916d2396eca25c0796431ba631ad3a2e8 Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Sat, 12 Oct 2024 14:27:53 +0200 Subject: [PATCH] r600: fix sfn_nir_legalize_image_load_store cubearray behavior This change fixes the calculation of the number of cubemap images which requires a 6x multiplier. This commit is inspired from nir_lower_robust_access and fixes at least the following tests on cayman: spec/arb_shader_image_load_store/layer/imagecubearray/layered binding test: fail pass spec/arb_shader_image_load_store/max-size/imagecubearray max size test/8x8x2046x1: fail pass Fixes: 27f515777741 ("r600/sfn: Add lowering pass to legalize image access") Signed-off-by: Patrick Lerda Reviewed-by: Gert Wollny Part-of: --- .../drivers/r600/sfn/sfn_nir_legalize_image_load_store.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_legalize_image_load_store.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_legalize_image_load_store.cpp index 36ef022e388..de24174d0ed 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_legalize_image_load_store.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_legalize_image_load_store.cpp @@ -83,6 +83,13 @@ r600_legalize_image_load_store_impl(nir_builder *b, unsigned num_src1_comp = MIN2(ir->src[1].ssa->num_components, num_components); unsigned src1_mask = (1 << num_src1_comp) - 1; + if (num_components == 3 && dim == GLSL_SAMPLER_DIM_CUBE) { + img_size = nir_vec3(b, + nir_channel(b, img_size, 0), + nir_channel(b, img_size, 1), + nir_imul_imm(b, nir_channel(b, img_size, 2), 6)); + } + auto in_range = nir_ult(b, nir_channels(b, ir->src[1].ssa, src1_mask), nir_channels(b, img_size, mask));