Module: Mesa
Branch: master
Commit: 8039a2a6b377f5d2a047fda82f6eaaa0a6a79a94
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8039a2a6b377f5d2a047fda82f6eaaa0a6a79a94

Author: Rob Clark <robcl...@freedesktop.org>
Date:   Thu Nov  5 15:38:32 2015 -0500

freedreno/ir3: handle tex instrs w/ const offset

Something we start to see with glsl_to_nir.

Signed-off-by: Rob Clark <robcl...@freedesktop.org>

---

 src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c 
b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 11ec014..2ab46d2 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -1361,6 +1361,7 @@ emit_tex(struct ir3_compile *ctx, nir_tex_instr *tex)
        struct ir3_block *b = ctx->block;
        struct ir3_instruction **dst, *sam, *src0[12], *src1[4];
        struct ir3_instruction **coord, *lod, *compare, *proj, **off, **ddx, 
**ddy;
+       struct ir3_instruction *const_off[4];
        bool has_bias = false, has_lod = false, has_proj = false, has_off = 
false;
        unsigned i, coords, flags;
        unsigned nsrc0 = 0, nsrc1 = 0;
@@ -1429,6 +1430,21 @@ emit_tex(struct ir3_compile *ctx, nir_tex_instr *tex)
 
        tex_info(tex, &flags, &coords);
 
+       if (!has_off) {
+               /* could still have a constant offset: */
+               if (tex->const_offset[0] || tex->const_offset[1] ||
+                               tex->const_offset[2] || tex->const_offset[3]) {
+                       off = const_off;
+
+                       off[0] = create_immed(b, tex->const_offset[0]);
+                       off[1] = create_immed(b, tex->const_offset[1]);
+                       off[2] = create_immed(b, tex->const_offset[2]);
+                       off[3] = create_immed(b, tex->const_offset[3]);
+
+                       has_off = true;
+               }
+       }
+
        /* scale up integer coords for TXF based on the LOD */
        if (ctx->unminify_coords && (opc == OPC_ISAML)) {
                assert(has_lod);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to