diff options
author | José Fonseca <[email protected]> | 2009-09-10 12:01:42 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-09-10 12:01:42 +0100 |
commit | c3c80c5c22f9ce7fabba90daa5d5142e5fb1c012 (patch) | |
tree | 83f896c8a951f3be3ed1e29202cf8d3a0bb7c30f /src/gallium/drivers/llvmpipe/lp_bld_flow.c | |
parent | 8e6b925d2a963a2d5a403e106d7d25e3dcca0775 (diff) |
llvmpipe: Skip blending when mask is zero.
This increases quake3 timedemo fps another 10%.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_flow.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_flow.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_flow.c b/src/gallium/drivers/llvmpipe/lp_bld_flow.c index 12525932260..69ed014ff3d 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_flow.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_flow.c @@ -386,6 +386,22 @@ lp_build_flow_skip_end(struct lp_build_flow_context *flow) } +static void +lp_build_mask_check(struct lp_build_mask_context *mask) +{ + LLVMBuilderRef builder = mask->flow->builder; + LLVMValueRef cond; + + cond = LLVMBuildICmp(builder, + LLVMIntEQ, + LLVMBuildBitCast(builder, mask->value, mask->reg_type, ""), + LLVMConstNull(mask->reg_type), + ""); + + lp_build_flow_skip_cond_break(mask->flow, cond); +} + + void lp_build_mask_begin(struct lp_build_mask_context *mask, struct lp_build_flow_context *flow, @@ -401,6 +417,8 @@ lp_build_mask_begin(struct lp_build_mask_context *mask, lp_build_flow_scope_begin(flow); lp_build_flow_scope_declare(flow, &mask->value); lp_build_flow_skip_begin(flow); + + lp_build_mask_check(mask); } @@ -408,18 +426,9 @@ void lp_build_mask_update(struct lp_build_mask_context *mask, LLVMValueRef value) { - LLVMBuilderRef builder = mask->flow->builder; - LLVMValueRef cond; - - mask->value = LLVMBuildAnd(builder, mask->value, value, ""); - - cond = LLVMBuildICmp(builder, - LLVMIntEQ, - LLVMBuildBitCast(builder, mask->value, mask->reg_type, ""), - LLVMConstNull(mask->reg_type), - ""); + mask->value = LLVMBuildAnd( mask->flow->builder, mask->value, value, ""); - lp_build_flow_skip_cond_break(mask->flow, cond); + lp_build_mask_check(mask); } |