vk: Add four unit tests for our lock-free data-structures
[mesa.git] / src / mesa / drivers / dri / i965 / brw_clip_line.c
index 7e218f5c2930116bbde9b5d0b61863c17cb806c7..8e34f7c987bcf0e34e11545bc748254c539a6326 100644 (file)
@@ -45,7 +45,7 @@
 
 static void brw_clip_line_alloc_regs( struct brw_clip_compile *c )
 {
-   struct brw_context *brw = c->func.brw;
+   const struct brw_device_info *devinfo = c->func.devinfo;
    GLuint i = 0,j;
 
    /* Register usage is static, precompute here:
@@ -89,7 +89,7 @@ static void brw_clip_line_alloc_regs( struct brw_clip_compile *c )
    c->reg.clipdistance_offset = retype(brw_vec1_grf(i, 1), BRW_REGISTER_TYPE_W);
    i++;
 
-   if (brw->gen == 5) {
+   if (devinfo->gen == 5) {
       c->reg.ff_sync = retype(brw_vec1_grf(i, 0), BRW_REGISTER_TYPE_UD);
       i++;
    }
@@ -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 {
@@ -128,8 +128,7 @@ static void brw_clip_line_alloc_regs( struct brw_clip_compile *c )
  */
 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_codegen *p = &c->func;
    struct brw_indirect vtx0     = brw_indirect(0, 0);
    struct brw_indirect vtx1      = brw_indirect(1, 0);
    struct brw_indirect newvtx0   = brw_indirect(2, 0);
@@ -155,12 +154,12 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
    brw_clip_init_clipmask(c);
 
    /* -ve rhw workaround */
-   if (brw->has_negative_rhw_bug) {
+   if (p->devinfo->has_negative_rhw_bug) {
       brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
               brw_imm_ud(1<<20));
-      brw_last_inst->header.destreg__conditionalmod = BRW_CONDITIONAL_NZ;
+      brw_inst_set_cond_modifier(p->devinfo, 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(p->devinfo, brw_last_inst, BRW_PREDICATE_NORMAL);
    }
 
    /* Set the initial vertex source mask: The first 6 planes are the bounds
@@ -177,12 +176,12 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
       /* if (planemask & 1)
        */
       brw_AND(p, v1_null_ud, c->reg.planemask, brw_imm_ud(1));
-      brw_last_inst->header.destreg__conditionalmod = BRW_CONDITIONAL_NZ;
+      brw_inst_set_cond_modifier(p->devinfo, brw_last_inst, BRW_CONDITIONAL_NZ);
 
       brw_IF(p, BRW_EXECUTE_1);
       {
          brw_AND(p, v1_null_ud, c->reg.vertex_src_mask, brw_imm_ud(1));
-         brw_last_inst->header.destreg__conditionalmod = BRW_CONDITIONAL_NZ;
+         brw_inst_set_cond_modifier(p->devinfo, brw_last_inst, BRW_CONDITIONAL_NZ);
          brw_IF(p, BRW_EXECUTE_1);
          {
             /* user clip distance: just fetch the correct float from each vertex */
@@ -213,7 +212,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
               * Both can be negative on GM965/G965 due to RHW workaround
               * if so, this object should be rejected.
               */
-             if (brw->has_negative_rhw_bug) {
+             if (p->devinfo->has_negative_rhw_bug) {
                  brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_LE, c->reg.dp0, brw_imm_f(0.0));
                  brw_IF(p, BRW_EXECUTE_1);
                  {
@@ -228,7 +227,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.t1 );
              brw_MOV(p, c->reg.t1, c->reg.t);
-             brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+             brw_inst_set_pred_control(p->devinfo, brw_last_inst,
+                                       BRW_PREDICATE_NORMAL);
         }
         brw_ELSE(p);
         {
@@ -238,7 +238,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
 
              /* If both are positive, do nothing */
              /* Only on GM965/G965 */
-             if (brw->has_negative_rhw_bug) {
+             if (p->devinfo->has_negative_rhw_bug) {
                  brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.dp0, brw_imm_f(0.0));
                  brw_IF(p, BRW_EXECUTE_1);
              }
@@ -250,10 +250,11 @@ 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(p->devinfo, brw_last_inst,
+                                           BRW_PREDICATE_NORMAL);
              }
 
-             if (brw->has_negative_rhw_bug) {
+             if (p->devinfo->has_negative_rhw_bug) {
                  brw_ENDIF(p);
              }
          }
@@ -268,14 +269,14 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
       /* while (planemask>>=1) != 0
        */
       brw_SHR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(1));
-      brw_last_inst->header.destreg__conditionalmod = BRW_CONDITIONAL_NZ;
+      brw_inst_set_cond_modifier(p->devinfo, 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(p->devinfo, 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(p->devinfo, brw_last_inst, BRW_PREDICATE_NORMAL);
    }
    brw_WHILE(p);
-   brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;
+   brw_inst_set_pred_control(p->devinfo, 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));