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: 27f5157777 ("r600/sfn: Add lowering pass to legalize image access")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31626>
This commit is contained in:
Patrick Lerda 2024-10-12 14:27:53 +02:00 committed by Marge Bot
parent 4a931ec9eb
commit 5c63d7a916

View file

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