[Mesa-dev] [PATCH 6/6] i965/vs: Avoid the emit(), remove(), insert_before() for array instructions.
Eric Anholt
eric at anholt.net
Sun Aug 28 21:45:20 PDT 2011
---
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 26 +++++++++--------------
1 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index c15db83..2f899db 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1995,16 +1995,13 @@ vec4_visitor::get_scratch_offset(vec4_instruction *inst,
if (reladdr) {
src_reg index = src_reg(this, glsl_type::int_type);
- vec4_instruction *add = emit(ADD(dst_reg(index),
- *reladdr,
- src_reg(reg_offset)));
- /* Move our new instruction from the tail to its correct place. */
- add->remove();
+ vec4_instruction *add = ADD(dst_reg(index),
+ *reladdr,
+ src_reg(reg_offset));
inst->insert_before(add);
- vec4_instruction *mul = emit(MUL(dst_reg(index),
- index, src_reg(message_header_scale)));
- mul->remove();
+ vec4_instruction *mul = MUL(dst_reg(index),
+ index, src_reg(message_header_scale));
inst->insert_before(mul);
return index;
@@ -2025,13 +2022,11 @@ vec4_visitor::emit_scratch_read(vec4_instruction *inst,
int reg_offset = base_offset + orig_src.reg_offset;
src_reg index = get_scratch_offset(inst, orig_src.reladdr, reg_offset);
- vec4_instruction *scratch_read_inst = emit(VS_OPCODE_SCRATCH_READ,
- temp, index);
+ vec4_instruction *scratch_read_inst =
+ new(mem_ctx) vec4_instruction(this, VS_OPCODE_SCRATCH_READ, temp, index);
scratch_read_inst->base_mrf = 14;
scratch_read_inst->mlen = 1;
- /* Move our instruction from the tail to its correct place. */
- scratch_read_inst->remove();
inst->insert_before(scratch_read_inst);
}
@@ -2049,13 +2044,12 @@ vec4_visitor::emit_scratch_write(vec4_instruction *inst,
dst_reg dst = dst_reg(brw_writemask(brw_vec8_grf(0, 0),
orig_dst.writemask));
- vec4_instruction *scratch_write_inst = emit(VS_OPCODE_SCRATCH_WRITE,
- dst, temp, index);
+ vec4_instruction *scratch_write_inst =
+ new(mem_ctx) vec4_instruction(this, VS_OPCODE_SCRATCH_WRITE,
+ dst, temp, index);
scratch_write_inst->base_mrf = 13;
scratch_write_inst->mlen = 2;
scratch_write_inst->predicate = inst->predicate;
- /* Move our instruction from the tail to its correct place. */
- scratch_write_inst->remove();
inst->insert_after(scratch_write_inst);
}
--
1.7.5.4
More information about the mesa-dev
mailing list