From 95db3e87fee377c5fa8fb779bc151e8d7f4e790a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 3 Aug 2023 15:24:53 -0700 Subject: [PATCH] intel/compiler: Fix sparse cube map array coordinate lowering Brown paper bag fix for my untested review feedback comments. Cube array images use a coordinate of the form , while cube array textures use a style coordinate. This code tried to convert one to the other, but instead of writing Z / 6 and Z % 6, we tried to reuse our original division result. What we wanted was Z - (Z/6) * 6, but instead we botched it and wrote Z-Z*6 which produced...totally invalid cube faces. Fixes: fe81d40bff26 ("intel/nir: add lower for sparse images & textures") Reviewed-by: Paulo Zanoni Tested-by: Paulo Zanoni Part-of: --- src/intel/compiler/brw_nir_lower_sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_nir_lower_sparse.c b/src/intel/compiler/brw_nir_lower_sparse.c index 8976762..9b74b51 100644 --- a/src/intel/compiler/brw_nir_lower_sparse.c +++ b/src/intel/compiler/brw_nir_lower_sparse.c @@ -138,7 +138,7 @@ lower_sparse_image_load(nir_builder *b, nir_intrinsic_instr *intrin) nir_ssa_def *img_layer = nir_channel(b, intrin->src[1].ssa, 2); nir_ssa_def *tex_slice = nir_idiv(b, img_layer, nir_imm_int(b, 6)); nir_ssa_def *tex_face = - nir_iadd(b, img_layer, nir_ineg(b, nir_imul_imm(b, img_layer, 6))); + nir_iadd(b, img_layer, nir_ineg(b, nir_imul_imm(b, tex_slice, 6))); nir_ssa_def *comps[4] = { nir_channel(b, intrin->src[1].ssa, 0), nir_channel(b, intrin->src[1].ssa, 1), -- 2.7.4