i965/vec4: Simplify opt_reduce_swizzle() using the swizzle utils.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_clip_line.c
index cc5fc38329c062a97738c09dd732a84850429b15..3b8af58ec7631d58636006f33aff69db1a0d9652 100644 (file)
@@ -109,7 +109,7 @@ static void brw_clip_line_alloc_regs( struct brw_clip_compile *c )
  *        GLfloat dp0 = DOTPROD( vtx0, plane[p] );
  *        GLfloat dp1 = DOTPROD( vtx1, plane[p] );
  *
- *        if (IS_NEGATIVE(dp1)) {
+ *        if (dp1 < 0.0f) {
  *           GLfloat t = dp1 / (dp1 - dp0);
  *           if (t > t1) t1 = t;
  *        } else {
@@ -156,11 +156,11 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
 
    /* -ve rhw workaround */
    if (brw->has_negative_rhw_bug) {
-      brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
       brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
               brw_imm_ud(1<<20));
+      brw_inst_set_cond_modifier(brw, brw_last_inst, BRW_CONDITIONAL_NZ);
       brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(0x3f));
-      brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+      brw_inst_set_pred_control(brw, brw_last_inst, BRW_PREDICATE_NORMAL);
    }
 
    /* Set the initial vertex source mask: The first 6 planes are the bounds
@@ -176,13 +176,13 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
    {
       /* if (planemask & 1)
        */
-      brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
       brw_AND(p, v1_null_ud, c->reg.planemask, brw_imm_ud(1));
+      brw_inst_set_cond_modifier(brw, brw_last_inst, BRW_CONDITIONAL_NZ);
 
       brw_IF(p, BRW_EXECUTE_1);
       {
-         brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
          brw_AND(p, v1_null_ud, c->reg.vertex_src_mask, brw_imm_ud(1));
+         brw_inst_set_cond_modifier(brw, brw_last_inst, BRW_CONDITIONAL_NZ);
          brw_IF(p, BRW_EXECUTE_1);
          {
             /* user clip distance: just fetch the correct float from each vertex */
@@ -228,7 +228,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
 
              brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t1 );
              brw_MOV(p, c->reg.t1, c->reg.t);
-             brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+             brw_inst_set_pred_control(brw, brw_last_inst, BRW_PREDICATE_NORMAL);
         }
         brw_ELSE(p);
         {
@@ -250,7 +250,8 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
 
                  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_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+                 brw_inst_set_pred_control(brw, brw_last_inst,
+                                           BRW_PREDICATE_NORMAL);
              }
 
              if (brw->has_negative_rhw_bug) {
@@ -267,15 +268,15 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
 
       /* while (planemask>>=1) != 0
        */
-      brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
       brw_SHR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(1));
+      brw_inst_set_cond_modifier(brw, brw_last_inst, BRW_CONDITIONAL_NZ);
       brw_SHR(p, c->reg.vertex_src_mask, c->reg.vertex_src_mask, brw_imm_ud(1));
-      brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+      brw_inst_set_pred_control(brw, brw_last_inst, BRW_PREDICATE_NORMAL);
       brw_ADD(p, c->reg.clipdistance_offset, c->reg.clipdistance_offset, brw_imm_w(sizeof(float)));
-      brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+      brw_inst_set_pred_control(brw, brw_last_inst, BRW_PREDICATE_NORMAL);
    }
    brw_WHILE(p);
-   brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+   brw_inst_set_pred_control(brw, brw_last_inst, BRW_PREDICATE_NORMAL);
 
    brw_ADD(p, c->reg.t, c->reg.t0, c->reg.t1);
    brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.t, brw_imm_f(1.0));