[Mesa-dev] [PATCH 1/2] i965/fs: Fix handling of sampler messages with header but zero offset

Chris Forbes chrisf at ijw.co.nz
Sun Oct 13 03:24:32 CEST 2013


Gather unconditionally uses a header, but in some cases the
texture_offset value will be zero.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 4b668f1..6a1e8f7 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -537,9 +537,17 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
                  brw_imm_ud(inst->texture_offset));
       brw_pop_insn_state(p);
    } else if (inst->header_present) {
-      assert(brw->gen < 7);
-      /* Set up an implied move from g0 to the MRF. */
-      src = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);
+      if (brw->gen >= 7) {
+         /* Explicitly set up the message header by copying g0 to the MRF. */
+         brw_push_insn_state(p);
+         brw_set_mask_control(p, BRW_MASK_DISABLE);
+         brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+         brw_MOV(p, src, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD));
+         brw_pop_insn_state(p);
+      } else {
+         /* Set up an implied move from g0 to the MRF. */
+         src = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);
+      }
    }
 
    uint32_t surface_index = inst->opcode == SHADER_OPCODE_TG4
-- 
1.8.4



More information about the mesa-dev mailing list