From 64611e086dbefa2003773ab541c0381b5713e18d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 3 Aug 2009 22:31:08 +0100 Subject: llvmpipe: Separate constant building. --- src/gallium/drivers/llvmpipe/lp_bld_arit.h | 39 +++++++++--------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/lp_bld_arit.h') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.h b/src/gallium/drivers/llvmpipe/lp_bld_arit.h index c437d2bcd0..cec54a257f 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.h @@ -43,43 +43,28 @@ union lp_type type; -/* - * Constants - */ - - -LLVMValueRef -lp_build_undef(union lp_type type); - - -LLVMValueRef -lp_build_zero(union lp_type type); - - -LLVMValueRef -lp_build_one(union lp_type type); - - -LLVMValueRef -lp_build_const_aos(union lp_type type, - double r, double g, double b, double a, - const unsigned char *swizzle); - -/* - * Basic arithmetic - */ - - /** + * We need most of the information here in order to correctly and efficiently + * translate an arithmetic operation into LLVM IR. Putting it here avoids the + * trouble of passing it as parameters. */ struct lp_build_context { LLVMBuilderRef builder; + /** + * This not only describes the input/output LLVM types, but also whether + * to normalize/clamp the results. + */ union lp_type type; + /** Same as lp_build_undef(type) */ LLVMValueRef undef; + + /** Same as lp_build_zero(type) */ LLVMValueRef zero; + + /** Same as lp_build_one(type) */ LLVMValueRef one; }; -- cgit v1.2.3