From f478b6fe76452ee910fa9d13ea4b78637a04e747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 2 Aug 2009 13:48:16 +0100 Subject: llvmpipe: Avoid C99-isms. --- src/gallium/drivers/llvmpipe/lp_bld_pack.c | 17 ++++++++--------- src/gallium/drivers/llvmpipe/lp_bld_unpack.c | 27 +++++++++++++-------------- 2 files changed, 21 insertions(+), 23 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_pack.c b/src/gallium/drivers/llvmpipe/lp_bld_pack.c index 823d67e12d..f436f09737 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_pack.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_pack.c @@ -39,7 +39,12 @@ lp_build_pack_rgba(LLVMBuilderRef builder, const struct util_format_description *desc; LLVMTypeRef type; LLVMValueRef packed = NULL; - unsigned shift = 0; + LLVMValueRef swizzles[4]; + LLVMValueRef shifted, casted, scaled, unswizzled; + LLVMValueRef shifts[4]; + LLVMValueRef scales[4]; + bool normalized; + unsigned shift; unsigned i, j; desc = util_format_description(format); @@ -50,10 +55,6 @@ lp_build_pack_rgba(LLVMBuilderRef builder, type = LLVMIntType(desc->block.bits); - LLVMValueRef swizzles[4]; - LLVMValueRef shifted, casted, scaled, unswizzled; - - /* Unswizzle the color components into the source vector. */ for (i = 0; i < 4; ++i) { for (j = 0; j < 4; ++j) { @@ -70,10 +71,8 @@ lp_build_pack_rgba(LLVMBuilderRef builder, LLVMGetUndef(LLVMVectorType(LLVMFloatType(), 4)), LLVMConstVector(swizzles, 4), ""); - LLVMValueRef shifts[4]; - LLVMValueRef scales[4]; - bool normalized = FALSE; - + normalized = FALSE; + shift = 0; for (i = 0; i < 4; ++i) { unsigned bits = desc->channel[i].size; diff --git a/src/gallium/drivers/llvmpipe/lp_bld_unpack.c b/src/gallium/drivers/llvmpipe/lp_bld_unpack.c index f1ffe3ecd8..3545bdf225 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_unpack.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_unpack.c @@ -38,7 +38,15 @@ lp_build_unpack_rgba(LLVMBuilderRef builder, { const struct util_format_description *desc; LLVMTypeRef type; - unsigned shift = 0; + LLVMValueRef shifted, casted, scaled, masked; + LLVMValueRef shifts[4]; + LLVMValueRef masks[4]; + LLVMValueRef scales[4]; + LLVMValueRef swizzles[4]; + LLVMValueRef aux[4]; + bool normalized; + int empty_channel; + unsigned shift; unsigned i; desc = util_format_description(format); @@ -68,14 +76,10 @@ lp_build_unpack_rgba(LLVMBuilderRef builder, LLVMConstNull(LLVMVectorType(LLVMInt32Type(), 4)), ""); - LLVMValueRef shifted, casted, scaled, masked, swizzled; - LLVMValueRef shifts[4]; - LLVMValueRef masks[4]; - LLVMValueRef scales[4]; - bool normalized = FALSE; - int empty_channel = -1; - /* Initialize vector constants */ + normalized = FALSE; + empty_channel = -1; + shift = 0; for (i = 0; i < 4; ++i) { unsigned bits = desc->channel[i].size; @@ -115,9 +119,6 @@ lp_build_unpack_rgba(LLVMBuilderRef builder, else scaled = casted; - LLVMValueRef swizzles[4]; - LLVMValueRef aux[4]; - for (i = 0; i < 4; ++i) aux[i] = LLVMGetUndef(LLVMFloatType()); @@ -146,8 +147,6 @@ lp_build_unpack_rgba(LLVMBuilderRef builder, } } - swizzled = LLVMBuildShuffleVector(builder, scaled, LLVMConstVector(aux, 4), LLVMConstVector(swizzles, 4), ""); - - return swizzled; + return LLVMBuildShuffleVector(builder, scaled, LLVMConstVector(aux, 4), LLVMConstVector(swizzles, 4), ""); } -- cgit v1.2.3