From dc6bc3b642dc2dc04f583dd92d97aa1da9b90332 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 12 Jan 2013 17:09:04 -0800 Subject: [PATCH] llvmpipe: trivial code and comment cleanup. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Paul Reviewed-by: José Fonseca --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 3eae162d6b6..83b902de959 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -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) { -- 2.30.2