summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Moore <dcm@acm.org>2007-08-30 14:43:30 -0700
committerEric Anholt <eric@anholt.net>2007-08-30 14:45:56 -0700
commit1dd94a63ace0c6133f80191ba3b3e5f56f86c8fe (patch)
tree6778c7c39f721b31ea273eacc4541be88555a2f6 /src
parent74e1d0996d109ce6426507f9ca64cf38d3b83acf (diff)
Bug #10571: Fix 965 line clipping when neither vertex needs clipping.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_line.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c
index 83182270ea..0103be4345 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_line.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_line.c
@@ -130,6 +130,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
struct brw_instruction *plane_loop;
struct brw_instruction *plane_active;
struct brw_instruction *is_negative;
+ struct brw_instruction *is_neg2;
struct brw_instruction *not_culled;
struct brw_reg v1_null_ud = retype(vec1(brw_null_reg()), BRW_REGISTER_TYPE_UD);
@@ -183,13 +184,20 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
/* Coming back in. We know that both cannot be negative
* because the line would have been culled in that case.
*/
- brw_ADD(p, c->reg.t, c->reg.dp0, negate(c->reg.dp1));
- brw_math_invert(p, c->reg.t, c->reg.t);
- 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 );
- brw_MOV(p, c->reg.t0, c->reg.t);
- brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ /* If both are positive, do nothing */
+ brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.dp0, brw_imm_f(0.0));
+ is_neg2 = brw_IF(p, BRW_EXECUTE_1);
+ {
+ brw_ADD(p, c->reg.t, c->reg.dp0, negate(c->reg.dp1));
+ brw_math_invert(p, c->reg.t, c->reg.t);
+ 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 );
+ brw_MOV(p, c->reg.t0, c->reg.t);
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ }
+ brw_ENDIF(p, is_neg2);
}
brw_ENDIF(p, is_negative);
}