[Mesa-dev] [PATCH 1/3] i965/vs: Simplify emit_scratch_write() prototype.

Eric Anholt eric at anholt.net
Tue Oct 16 13:56:49 PDT 2012


Both callers used (effectively) inst->dst as the argument, so just reference
it.
---
 src/mesa/drivers/dri/i965/brw_vec4.h                |    1 -
 src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp |    2 +-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp      |   11 +++++------
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index de0df55..d6d6c8a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -428,7 +428,6 @@ public:
 			  int base_offset);
    void emit_scratch_write(vec4_instruction *inst,
 			   src_reg temp,
-			   dst_reg orig_dst,
 			   int base_offset);
    void emit_pull_constant_load(vec4_instruction *inst,
 				dst_reg dst,
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
index bad2728..a2381bc 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
@@ -355,7 +355,7 @@ vec4_visitor::spill_reg(int spill_reg_nr)
           */
          src_reg temp = src_reg(inst->dst);
          temp.swizzle = BRW_SWIZZLE_XYZW;
-         emit_scratch_write(inst, temp, spill_reg, spill_offset);
+         emit_scratch_write(inst, temp, spill_offset);
       }
    }
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 59428a1..60295ad 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2465,14 +2465,13 @@ vec4_visitor::emit_scratch_read(vec4_instruction *inst,
  */
 void
 vec4_visitor::emit_scratch_write(vec4_instruction *inst,
-				 src_reg temp, dst_reg orig_dst,
-				 int base_offset)
+				 src_reg temp, int base_offset)
 {
-   int reg_offset = base_offset + orig_dst.reg_offset;
-   src_reg index = get_scratch_offset(inst, orig_dst.reladdr, reg_offset);
+   int reg_offset = base_offset + inst->dst.reg_offset;
+   src_reg index = get_scratch_offset(inst, inst->dst.reladdr, reg_offset);
 
    dst_reg dst = dst_reg(brw_writemask(brw_vec8_grf(0, 0),
-				       orig_dst.writemask));
+				       inst->dst.writemask));
    vec4_instruction *write = SCRATCH_WRITE(dst, temp, index);
    write->predicate = inst->predicate;
    write->ir = inst->ir;
@@ -2534,7 +2533,7 @@ vec4_visitor::move_grf_array_access_to_scratch()
       if (inst->dst.file == GRF && scratch_loc[inst->dst.reg] != -1) {
 	 src_reg temp = src_reg(this, glsl_type::vec4_type);
 
-	 emit_scratch_write(inst, temp, inst->dst, scratch_loc[inst->dst.reg]);
+	 emit_scratch_write(inst, temp, scratch_loc[inst->dst.reg]);
 
 	 inst->dst.file = temp.file;
 	 inst->dst.reg = temp.reg;
-- 
1.7.10.4



More information about the mesa-dev mailing list