<div dir="ltr"><div>These too are<br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 12, 2014 at 11:28 AM, Matt Turner <span dir="ltr"><<a href="mailto:mattst88@gmail.com" target="_blank">mattst88@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">texture_offset was only used by some texturing operations, and offset<br>
was only used by spill/unspill and some URB operations. These fields are<br>
never used at the same time.<br>
---<br>
 src/mesa/drivers/dri/i965/brw_fs_cse.cpp         | 2 +-<br>
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 6 +++---<br>
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp     | 4 ++--<br>
 src/mesa/drivers/dri/i965/brw_shader.h           | 3 +--<br>
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 6 +++---<br>
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp   | 7 +++----<br>
 6 files changed, 13 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp<br>
index 5fdbf46..b1c433e 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp<br>
@@ -157,7 +157,7 @@ instructions_match(fs_inst *a, fs_inst *b)<br>
           a->conditional_mod == b->conditional_mod &&<br>
           a->dst.type == b->dst.type &&<br>
           a->sources == b->sources &&<br>
-          (a->is_tex() ? (a->texture_offset == b->texture_offset &&<br>
+          (a->is_tex() ? (a->offset == b->offset &&<br>
                           a->mlen == b->mlen &&<br>
                           a->regs_written == b->regs_written &&<br>
                           a->base_mrf == b->base_mrf &&<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp<br>
index c95beb6..dc9e803 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp<br>
@@ -556,7 +556,7 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src<br>
     * Otherwise, we can use an implied move from g0 to the first message reg.<br>
     */<br>
    if (inst->header_present) {<br>
-      if (brw->gen < 6 && !inst->texture_offset) {<br>
+      if (brw->gen < 6 && !inst->offset) {<br>
          /* Set up an implied move from g0 to the MRF. */<br>
          src = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);<br>
       } else {<br>
@@ -575,10 +575,10 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src<br>
          /* Explicitly set up the message header by copying g0 to the MRF. */<br>
          brw_MOV(p, header_reg, brw_vec8_grf(0, 0));<br>
<br>
-         if (inst->texture_offset) {<br>
+         if (inst->offset) {<br>
             /* Set the offset bits in DWord 2. */<br>
             brw_MOV(p, get_element_ud(header_reg, 2),<br>
-                       brw_imm_ud(inst->texture_offset));<br>
+                       brw_imm_ud(inst->offset));<br>
          }<br>
<br>
          brw_adjust_sampler_state_pointer(p, header_reg, sampler_index, dst);<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
index 4e1badd..21334a2 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
@@ -1918,10 +1918,10 @@ fs_visitor::emit_texture(ir_texture_opcode op,<br>
       inst->shadow_compare = true;<br>
<br>
    if (offset_value.file == IMM)<br>
-      inst->texture_offset = offset_value.fixed_hw_reg.dw1.ud;<br>
+      inst->offset = offset_value.fixed_hw_reg.dw1.ud;<br>
<br>
    if (op == ir_tg4) {<br>
-      inst->texture_offset |=<br>
+      inst->offset |=<br>
          gather_channel(gather_component, sampler) << 16; /* M0.2:16-17 */<br>
<br>
       if (brw->gen == 6)<br>
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h<br>
index 94db987..32460e2 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_shader.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_shader.h<br>
@@ -112,8 +112,7 @@ struct backend_instruction {<br>
    const char *annotation;<br>
    /** @} */<br>
<br>
-   uint32_t texture_offset; /**< Texture offset bitfield */<br>
-   uint32_t offset; /**< spill/unspill offset */<br>
+   uint32_t offset; /**< spill/unspill offset or texture offset bitfield */<br>
    uint8_t mlen; /**< SEND message length */<br>
    int8_t base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */<br>
    uint8_t target; /**< MRT target. */<br>
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp<br>
index e522567..0776a91 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp<br>
@@ -319,7 +319,7 @@ vec4_generator::generate_tex(vec4_instruction *inst,<br>
     * use an implied move from g0 to the first message register.<br>
     */<br>
    if (inst->header_present) {<br>
-      if (brw->gen < 6 && !inst->texture_offset) {<br>
+      if (brw->gen < 6 && !inst->offset) {<br>
          /* Set up an implied move from g0 to the MRF. */<br>
          src = brw_vec8_grf(0, 0);<br>
       } else {<br>
@@ -333,10 +333,10 @@ vec4_generator::generate_tex(vec4_instruction *inst,<br>
<br>
          brw_set_default_access_mode(p, BRW_ALIGN_1);<br>
<br>
-         if (inst->texture_offset) {<br>
+         if (inst->offset) {<br>
             /* Set the texel offset bits in DWord 2. */<br>
             brw_MOV(p, get_element_ud(header, 2),<br>
-                    brw_imm_ud(inst->texture_offset));<br>
+                    brw_imm_ud(inst->offset));<br>
          }<br>
<br>
          brw_adjust_sampler_state_pointer(p, header, sampler_index, dst);<br>
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
index b46879b..f08b9a9 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
@@ -46,7 +46,6 @@ vec4_instruction::vec4_instruction(vec4_visitor *v,<br>
    this->no_dd_check = false;<br>
    this->writes_accumulator = false;<br>
    this->conditional_mod = BRW_CONDITIONAL_NONE;<br>
-   this->texture_offset = 0;<br>
    this->target = 0;<br>
    this->shadow_compare = false;<br>
    this->ir = v->base_ir;<br>
@@ -2550,14 +2549,14 @@ vec4_visitor::visit(ir_texture *ir)<br>
    vec4_instruction *inst = new(mem_ctx) vec4_instruction(this, opcode);<br>
<br>
    if (ir->offset != NULL && !has_nonconstant_offset) {<br>
-      inst->texture_offset =<br>
+      inst->offset =<br>
          brw_texture_offset(ctx, ir->offset->as_constant()->value.i,<br>
                             ir->offset->type->vector_elements);<br>
    }<br>
<br>
    /* Stuff the channel select bits in the top of the texture offset */<br>
    if (ir->op == ir_tg4)<br>
-      inst->texture_offset |= gather_channel(ir, sampler) << 16;<br>
+      inst->offset |= gather_channel(ir, sampler) << 16;<br>
<br>
    /* The message header is necessary for:<br>
     * - Gen4 (always)<br>
@@ -2566,7 +2565,7 @@ vec4_visitor::visit(ir_texture *ir)<br>
     * - Sampler indices too large to fit in a 4-bit value.<br>
     */<br>
    inst->header_present =<br>
-      brw->gen < 5 || inst->texture_offset != 0 || ir->op == ir_tg4 ||<br>
+      brw->gen < 5 || inst->offset != 0 || ir->op == ir_tg4 ||<br>
       is_high_sampler(brw, sampler_reg);<br>
    inst->base_mrf = 2;<br>
    inst->mlen = inst->header_present + 1; /* always at least one */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.0.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>