llvmpipe: trivial code and comment cleanup.
authorRoland Scheidegger <sroland@vmware.com>
Sun, 13 Jan 2013 01:09:04 +0000 (17:09 -0800)
committerRoland Scheidegger <sroland@vmware.com>
Fri, 18 Jan 2013 17:14:52 +0000 (09:14 -0800)
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/drivers/llvmpipe/lp_state_fs.c

index 3eae162d6b6c9bcaa6a73c3375113e00b35080ca..83b902de959f831c462a324201ee63565fb10856 100644 (file)
@@ -1010,7 +1010,7 @@ lp_blend_type_from_format_desc(const struct util_format_description *format_desc
 
 
 /**
- * Scale a normalised value from src_bits to dst_bits
+ * Scale a normalized value from src_bits to dst_bits
  */
 static INLINE LLVMValueRef
 scale_bits(struct gallivm_state *gallivm,
@@ -1047,7 +1047,7 @@ scale_bits(struct gallivm_state *gallivm,
 
          result = LLVMBuildOr(builder, result, lower, "");
       } else if (db > src_bits) {
-         /* Need to repeatedely copy src bits to fill remainder in dst */
+         /* Need to repeatedly copy src bits to fill remainder in dst */
          unsigned n;
 
          for (n = src_bits; n < dst_bits; n *= 2) {
@@ -1213,7 +1213,7 @@ convert_from_blend_type(struct gallivm_state *gallivm,
       }
    }
 
-   /* No bit arithmitic to do */
+   /* No bit arithmetic to do */
    if (!is_arith) {
       return;
    }
@@ -1578,6 +1578,7 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
             unsigned pixels = block_size / src_count;
             unsigned channels = pad_inline ? TGSI_NUM_CHANNELS : dst_channels;
             unsigned alpha_span = 1;
+            LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
 
             /* Check if we need 2 src_alphas for our shuffles */
             if (pixels > alpha_type.length) {
@@ -1585,8 +1586,15 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
             }
 
             /* Broadcast alpha across all channels, e.g. a1a2 to a1a1a1a1a2a2a2a2 */
+            for (j = 0; j < row_type.length; ++j) {
+               if (j < pixels * channels) {
+                  shuffles[j] = lp_build_const_int32(gallivm, j / channels);
+               } else {
+                  shuffles[j] = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
+               }
+            }
+
             for (i = 0; i < src_count; ++i) {
-               LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
                unsigned idx1 = i, idx2 = i;
 
                if (alpha_span > 1){
@@ -1594,14 +1602,6 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
                   idx2 = idx1 + 1;
                }
 
-               for (j = 0; j < row_type.length; ++j) {
-                  if (j < pixels * channels) {
-                     shuffles[j] = lp_build_const_int32(gallivm, j / channels);
-                  } else {
-                     shuffles[j] = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
-                  }
-               }
-
                src_alpha[i] = LLVMBuildShuffleVector(builder,
                                                      src_alpha[idx1],
                                                      src_alpha[idx2],
@@ -2685,8 +2685,6 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
 
 
 
-
-
 void
 llvmpipe_init_fs_funcs(struct llvmpipe_context *llvmpipe)
 {