pan/bi: Use TEXC for indices >= 8
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 11 Jan 2021 18:52:53 +0000 (13:52 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 11 Jan 2021 22:28:57 +0000 (22:28 +0000)
Otherwise it can't fit, fixes

   dEQP-GLES3.functional.texture.units.all_units.only_2d.*
   dEQP-GLES3.functional.texture.units.all_units.only_cube.*
   dEQP-GLES3.functional.texture.units.all_units.mixed.*

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>

src/panfrost/bifrost/bifrost_compile.c

index 5f96b5a..f2306c5 100644 (file)
@@ -1625,7 +1625,8 @@ bi_emit_texc(bi_builder *b, nir_tex_instr *instr)
 }
 
 /* Simple textures ops correspond to NIR tex or txl with LOD = 0 on 2D (or cube
- * map, TODO) textures. Anything else needs a complete texture op. */
+ * map, TODO) textures with sufficiently small immediate indices. Anything else
+ * needs a complete texture op. */
 
 static bool
 bi_is_simple_tex(nir_tex_instr *instr)
@@ -1639,6 +1640,10 @@ bi_is_simple_tex(nir_tex_instr *instr)
                         return false;
         }
 
+        /* Indices need to fit in 3 bits */
+        if (MAX2(instr->sampler_index, instr->texture_index) >= (1 << 3))
+                return false;
+
         int lod_idx = nir_tex_instr_src_index(instr, nir_tex_src_lod);
         if (lod_idx < 0)
                 return true;