pan/bi: Always emit a LOD/CUBE word for FETCH instructions
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 17 Nov 2020 10:25:41 +0000 (11:25 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Wed, 25 Nov 2020 15:22:16 +0000 (16:22 +0100)
There's no flag/mode to reflect when a LOD is zero on FETCH instructions,
we have to emit the LOD/CUBE word unconditionally.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7653>

src/panfrost/bifrost/bifrost_compile.c

index d8aeb72..7dc5b2c 100644 (file)
@@ -1608,7 +1608,7 @@ bi_emit_lod_cube(bi_context *ctx, unsigned lod)
                 .type = BI_SELECT,
                 .dest = bi_make_temp(ctx),
                 .dest_type = nir_type_int16,
-                .src = { lod, BIR_INDEX_ZERO },
+                .src = { lod ? : BIR_INDEX_ZERO, BIR_INDEX_ZERO },
                 .src_types = { nir_type_int16, nir_type_int16 },
         };
 
@@ -2058,6 +2058,9 @@ emit_texc(bi_context *ctx, nir_tex_instr *instr)
                 }
         }
 
+        if (desc.op == BIFROST_TEX_OP_FETCH && !dregs[BIFROST_TEX_DREG_LOD])
+                dregs[BIFROST_TEX_DREG_LOD] = bi_emit_lod_cube(ctx, 0);
+
         /* Allocate data registers contiguously. Index must not be marked SSA
          * due to a quirk of RA for tied operands, could be fixed eventually */
         bi_instruction combine = {