aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-05-27 23:50:23 -0700
committerKenneth Graunke <[email protected]>2014-06-02 15:09:25 -0700
commit0bfac24caf89a163d8149e69b9eaa7ae5c71d550 (patch)
tree6e2dae75724c475eab317d3d1c4624ceb25f91b9 /src/mesa/drivers
parent42c292006c94b0b84645448af958fdb6235acbfb (diff)
i965/clip: Use the new brw_last_inst macro instead of temporaries.
It wasn't too bad before, but the macro is going to be nicer once I start modifying a lot more instructions in this pattern. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_line.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_tri.c34
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_unfilled.c7
3 files changed, 23 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c
index a8c2cac5238..42289e7cbd6 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_line.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_line.c
@@ -130,7 +130,6 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
{
struct brw_compile *p = &c->func;
struct brw_context *brw = p->brw;
- struct brw_instruction *inst;
struct brw_indirect vtx0 = brw_indirect(0, 0);
struct brw_indirect vtx1 = brw_indirect(1, 0);
struct brw_indirect newvtx0 = brw_indirect(2, 0);
@@ -229,8 +228,8 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp1);
brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t1 );
- inst = brw_MOV(p, c->reg.t1, c->reg.t);
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_MOV(p, c->reg.t1, c->reg.t);
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
}
brw_ELSE(p);
{
@@ -251,8 +250,8 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp0);
brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t0 );
- inst = brw_MOV(p, c->reg.t0, c->reg.t);
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_MOV(p, c->reg.t0, c->reg.t);
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
}
if (brw->has_negative_rhw_bug) {
diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c
index 5894b807d75..9edfa2e176c 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_tri.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c
@@ -262,7 +262,6 @@ load_clip_distance(struct brw_clip_compile *c, struct brw_indirect vtx,
void brw_clip_tri( struct brw_clip_compile *c )
{
struct brw_compile *p = &c->func;
- struct brw_instruction *inst;
struct brw_indirect vtx = brw_indirect(0, 0);
struct brw_indirect vtxPrev = brw_indirect(1, 0);
struct brw_indirect vtxOut = brw_indirect(2, 0);
@@ -338,8 +337,8 @@ void brw_clip_tri( struct brw_clip_compile *c )
/* If (vtxOut == 0) vtxOut = vtxPrev
*/
brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_EQ, get_addr_reg(vtxOut), brw_imm_uw(0) );
- inst = brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtxPrev));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtxPrev));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
brw_clip_interp_vertex(c, vtxOut, vtxPrev, vtx, c->reg.t, false);
@@ -379,8 +378,8 @@ void brw_clip_tri( struct brw_clip_compile *c )
/* If (vtxOut == 0) vtxOut = vtx
*/
brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_EQ, get_addr_reg(vtxOut), brw_imm_uw(0) );
- inst = brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtx));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtx));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
brw_clip_interp_vertex(c, vtxOut, vtx, vtxPrev, c->reg.t, true);
@@ -517,7 +516,6 @@ static void maybe_do_clip_tri( struct brw_clip_compile *c )
static void brw_clip_test( struct brw_clip_compile *c )
{
- struct brw_instruction *inst;
struct brw_reg t = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
struct brw_reg t1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
struct brw_reg t2 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
@@ -572,16 +570,16 @@ static void brw_clip_test( struct brw_clip_compile *c )
brw_AND(p, t, t, brw_imm_ud(0x1));
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
get_element(t, 0), brw_imm_ud(0));
- inst = brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<5)));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<5)));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
get_element(t, 1), brw_imm_ud(0));
- inst = brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<3)));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<3)));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
get_element(t, 2), brw_imm_ud(0));
- inst = brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<1)));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<1)));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
/* test farz, xmax, ymax plane */
/* clip.xyz > clip.w */
@@ -610,16 +608,16 @@ static void brw_clip_test( struct brw_clip_compile *c )
brw_AND(p, t, t, brw_imm_ud(0x1));
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
get_element(t, 0), brw_imm_ud(0));
- inst = brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<4)));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<4)));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
get_element(t, 1), brw_imm_ud(0));
- inst = brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<2)));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<2)));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
get_element(t, 2), brw_imm_ud(0));
- inst = brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<0)));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<0)));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
release_tmps(c);
}
diff --git a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
index d7022c279d8..164a96560ac 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
@@ -195,7 +195,6 @@ static void compute_offset( struct brw_clip_compile *c )
struct brw_compile *p = &c->func;
struct brw_reg off = c->reg.offset;
struct brw_reg dir = c->reg.dir;
- struct brw_instruction *inst;
brw_math_invert(p, get_element(off, 2), get_element(dir, 2));
brw_MUL(p, vec2(off), dir, get_element(off, 2));
@@ -206,9 +205,9 @@ static void compute_offset( struct brw_clip_compile *c )
brw_abs(get_element(off, 0)),
brw_abs(get_element(off, 1)));
- inst = brw_SEL(p, vec1(off),
- brw_abs(get_element(off, 0)), brw_abs(get_element(off, 1)));
- inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+ brw_SEL(p, vec1(off),
+ brw_abs(get_element(off, 0)), brw_abs(get_element(off, 1)));
+ brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
brw_MUL(p, vec1(off), off, brw_imm_f(c->key.offset_factor));
brw_ADD(p, vec1(off), off, brw_imm_f(c->key.offset_units));