freedreno/ir3: fix GETLOD for negative LODs
authorJonathan Marek <jonathan@marek.ca>
Mon, 7 Oct 2019 20:21:09 +0000 (16:21 -0400)
committerJonathan Marek <jonathan@marek.ca>
Mon, 14 Oct 2019 21:48:22 +0000 (17:48 -0400)
Note: for output type U32, negative LOD is not sign extended from 16 bits

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Rob Clark <robclark@gmail.com>
src/freedreno/ir3/ir3_compiler_nir.c

index 7061964be2095d3a1e674f14af196544698f20b0..38dad5c7e49d5b3849500055d5cdaa72773971f2 100644 (file)
@@ -1918,7 +1918,7 @@ emit_tex(struct ir3_context *ctx, nir_tex_instr *tex)
        }
 
        if (opc == OPC_GETLOD)
-               type = TYPE_U32;
+               type = TYPE_S32;
 
        struct ir3_instruction *samp_tex;
 
@@ -1970,7 +1970,7 @@ emit_tex(struct ir3_context *ctx, nir_tex_instr *tex)
 
                compile_assert(ctx, tex->dest_type == nir_type_float);
                for (i = 0; i < 2; i++) {
-                       dst[i] = ir3_MUL_F(b, ir3_COV(b, dst[i], TYPE_U32, TYPE_F32), 0,
+                       dst[i] = ir3_MUL_F(b, ir3_COV(b, dst[i], TYPE_S32, TYPE_F32), 0,
                                                           factor, 0);
                }
        }