diff options
author | Brian Paul <[email protected]> | 2010-04-16 13:34:28 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-04-16 13:34:28 -0600 |
commit | a57e762c90b65f05a6e179b90c1d6fe5c80e977c (patch) | |
tree | 21f8d4e45e7d034ed0425bd245c98470ca5504b0 /src/gallium/drivers/llvmpipe | |
parent | 1a44ec5e36c75e7cb75e3d777977658c39b4c182 (diff) |
llvmpipe: work-around an LLVM bug
The blend combinations ZERO,DST_ALPHA and ZERO,INV_DST_ALPHA seem to
generate bad code which leads to a segfault.
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c index 39ea9eddd81..b7523eb9c13 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c @@ -262,6 +262,23 @@ lp_build_blend_soa(LLVMBuilderRef builder, bld.term[k][i] = bld.term[k][j]; else bld.term[k][i] = lp_build_mul(&bld.base, bld.factor[k][0][i], bld.factor[k][1][i]); + + if (src_factor == PIPE_BLENDFACTOR_ZERO && + (dst_factor == PIPE_BLENDFACTOR_DST_ALPHA || + dst_factor == PIPE_BLENDFACTOR_INV_DST_ALPHA)) { + /* XXX special case these combos to work around an apparent + * bug in LLVM. + * This hack disables the check for multiplication by zero + * in lp_bld_mul(). When we optimize away the multiplication, + * something goes wrong during code generation and we segfault + * at runtime. + */ + LLVMValueRef zeroSave = bld.base.zero; + bld.base.zero = NULL; + bld.term[k][i] = lp_build_mul(&bld.base, bld.factor[k][0][i], + bld.factor[k][1][i]); + bld.base.zero = zeroSave; + } } /* |