vl: ...
[mesa.git] / src / gallium / drivers / llvmpipe / lp_bld_interp.c
index cb1d7b2f82a12906866ff41ac840a7988de46be3..838691e14b0fe6105b56186be2c3f2a8193b633d 100644 (file)
@@ -100,8 +100,8 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
    unsigned chan;
 
    for(attrib = 0; attrib < bld->num_attribs; ++attrib) {
-      unsigned mask = bld->mask[attrib];
-      unsigned mode = bld->mode[attrib];
+      const unsigned mask = bld->mask[attrib];
+      const unsigned interp = bld->interp[attrib];
       for(chan = 0; chan < NUM_CHANNELS; ++chan) {
          if(mask & (1 << chan)) {
             LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), attrib*NUM_CHANNELS + chan, 0);
@@ -109,7 +109,7 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
             LLVMValueRef dadx = NULL;
             LLVMValueRef dady = NULL;
 
-            switch( mode ) {
+            switch( interp ) {
             case TGSI_INTERPOLATE_PERSPECTIVE:
                /* fall-through */
 
@@ -159,8 +159,8 @@ attribs_init(struct lp_build_interp_soa_context *bld)
    unsigned chan;
 
    for(attrib = 0; attrib < bld->num_attribs; ++attrib) {
-      unsigned mask = bld->mask[attrib];
-      unsigned mode = bld->mode[attrib];
+      const unsigned mask = bld->mask[attrib];
+      const unsigned interp = bld->interp[attrib];
       for(chan = 0; chan < NUM_CHANNELS; ++chan) {
          if(mask & (1 << chan)) {
             LLVMValueRef a0   = bld->a0  [attrib][chan];
@@ -170,17 +170,19 @@ attribs_init(struct lp_build_interp_soa_context *bld)
 
             res = a0;
 
-            if (mode != TGSI_INTERPOLATE_CONSTANT) {
+            if (interp != TGSI_INTERPOLATE_CONSTANT) {
                /* res = res + x * dadx */
                res = lp_build_add(&bld->base, res, lp_build_mul(&bld->base, x, dadx));
                /* res = res + y * dady */
                res = lp_build_add(&bld->base, res, lp_build_mul(&bld->base, y, dady));
             }
 
-            /* Keep the value of the attribue before perspective divide for faster updates */
+            /* Keep the value of the attribute before perspective divide
+             * for faster updates.
+             */
             bld->attribs_pre[attrib][chan] = res;
 
-            if (mode == TGSI_INTERPOLATE_PERSPECTIVE) {
+            if (interp == TGSI_INTERPOLATE_PERSPECTIVE) {
                LLVMValueRef w = bld->pos[3];
                assert(attrib != 0);
                if(!oow)
@@ -211,10 +213,10 @@ attribs_update(struct lp_build_interp_soa_context *bld, int quad_index)
    assert(quad_index < 4);
 
    for(attrib = 0; attrib < bld->num_attribs; ++attrib) {
-      unsigned mask = bld->mask[attrib];
-      unsigned mode = bld->mode[attrib];
+      const unsigned mask = bld->mask[attrib];
+      const unsigned interp = bld->interp[attrib];
 
-      if (mode != TGSI_INTERPOLATE_CONSTANT) {
+      if (interp != TGSI_INTERPOLATE_CONSTANT) {
          for(chan = 0; chan < NUM_CHANNELS; ++chan) {
             if(mask & (1 << chan)) {
                LLVMValueRef dadx = bld->dadx[attrib][chan];
@@ -237,9 +239,7 @@ attribs_update(struct lp_build_interp_soa_context *bld, int quad_index)
                   res = lp_build_add(&bld->base, res, dady);
                }
 
-               //XXX bld->attribs_pre[attrib][chan] = res;
-
-               if (mode == TGSI_INTERPOLATE_PERSPECTIVE) {
+               if (interp == TGSI_INTERPOLATE_PERSPECTIVE) {
                   LLVMValueRef w = bld->pos[3];
                   assert(attrib != 0);
                   if(!oow)
@@ -339,7 +339,7 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
    /* Position */
    bld->num_attribs = 1;
    bld->mask[0] = TGSI_WRITEMASK_ZW;
-   bld->mode[0] = TGSI_INTERPOLATE_LINEAR;
+   bld->interp[0] = TGSI_INTERPOLATE_LINEAR;
 
    /* Inputs */
    tgsi_parse_init( &parse, tokens );
@@ -365,9 +365,9 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
                 */
                if (decl->Semantic.Name == TGSI_SEMANTIC_COLOR &&
                    flatshade)
-                  bld->mode[1 + attrib] = TGSI_INTERPOLATE_CONSTANT;
+                  bld->interp[1 + attrib] = TGSI_INTERPOLATE_CONSTANT;
                else
-                  bld->mode[1 + attrib] = decl->Declaration.Interpolate;
+                  bld->interp[1 + attrib] = decl->Declaration.Interpolate;
             }
 
             bld->num_attribs = MAX2(bld->num_attribs, 1 + last + 1);