diff options
author | José Fonseca <[email protected]> | 2009-08-11 13:30:23 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-08-29 09:21:30 +0100 |
commit | 1929057eac0c3351e0810612bdae56331a235736 (patch) | |
tree | b43095ebe80a14bcd5cc90081c45f9d93e841256 /src/gallium/drivers | |
parent | 0b6a9b2dbe7bedbc6c34370cd07dcaa93b4c5fda (diff) |
llvmpipe: Reuse coord/texel store.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index d5acafe840c..01aa3b8f20a 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -76,6 +76,9 @@ struct lp_build_tgsi_soa_context LLVMValueRef immediates[LP_MAX_IMMEDIATES][4]; LLVMValueRef temps[LP_MAX_TEMPS][4]; + + /** Coords/texels store */ + LLVMValueRef store_ptr; }; @@ -296,7 +299,6 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; LLVMValueRef lodbias; LLVMValueRef oow; - LLVMValueRef store_ptr; LLVMValueRef args[3]; unsigned count; unsigned i; @@ -326,10 +328,11 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, else lodbias = bld->base.zero; - store_ptr = LLVMBuildArrayAlloca(bld->base.builder, - vec_type, - LLVMConstInt(LLVMInt32Type(), 4, 0), - "store"); + if(!bld->store_ptr) + bld->store_ptr = LLVMBuildArrayAlloca(bld->base.builder, + vec_type, + LLVMConstInt(LLVMInt32Type(), 4, 0), + "store"); if (projected) { oow = FETCH( bld, *inst, 0, 3 ); @@ -338,7 +341,7 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, for (i = 0; i < count; i++) { LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0); - LLVMValueRef coord_ptr = LLVMBuildGEP(bld->base.builder, store_ptr, &index, 1, ""); + LLVMValueRef coord_ptr = LLVMBuildGEP(bld->base.builder, bld->store_ptr, &index, 1, ""); LLVMValueRef coord; coord = FETCH( bld, *inst, 0, i ); @@ -351,13 +354,13 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, args[0] = bld->samplers_ptr; args[1] = LLVMConstInt(LLVMInt32Type(), unit, 0); - args[2] = store_ptr; + args[2] = bld->store_ptr; lp_build_intrinsic(bld->base.builder, "fetch_texel", LLVMVoidType(), args, 3); FOR_EACH_DST0_ENABLED_CHANNEL( *inst, i ) { LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0); - LLVMValueRef res_ptr = LLVMBuildGEP(bld->base.builder, store_ptr, &index, 1, ""); + LLVMValueRef res_ptr = LLVMBuildGEP(bld->base.builder, bld->store_ptr, &index, 1, ""); LLVMValueRef res = LLVMBuildLoad(bld->base.builder, res_ptr, ""); STORE( bld, *inst, 0, i, res ); } |