v3d: Only look up the 3rd texture gather offset for non-arrays.
authorEric Anholt <eric@anholt.net>
Fri, 12 Apr 2019 16:38:03 +0000 (09:38 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 16 Apr 2019 19:07:59 +0000 (12:07 -0700)
Fixes assertion failures in the CTS since Karol's cleanup when NIR started
noticing that we were reading an invalid component.

Fixes: 5450f1c9fb09 ("v3d: prefer using nir_src_comp_as_int over nir_src_as_const_value")
src/broadcom/compiler/v3d40_tex.c

index 3bed32d839fb603d9abfeb4c87efcfe1b4de7bc0..679f1f15f81c54bedfda4021e93a08e5c39a2055 100644 (file)
@@ -142,7 +142,7 @@ v3d40_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
                                 if (instr->coord_components >= 2)
                                         p2_unpacked.offset_t =
                                                 nir_src_comp_as_int(instr->src[i].src, 1);
-                                if (instr->coord_components >= 3)
+                                if (non_array_components >= 3)
                                         p2_unpacked.offset_r =
                                                 nir_src_comp_as_int(instr->src[i].src, 2);
                         } else {