diff options
author | Roland Scheidegger <sroland@vmware.com> | 2013-02-12 03:41:48 +0100 |
---|---|---|
committer | Roland Scheidegger <sroland@vmware.com> | 2013-02-12 03:41:48 +0100 |
commit | 8b8bca06dff5b30da1ac97d18cc0e91acb13d516 (patch) | |
tree | 131d4b6fbee5ba87e5464c867d40af7050b821a1 /src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c | |
parent | a73181be6d169c597b60398cbc7e291a26903a68 (diff) |
llvmpipe: implement dual source blending
link up the fs outputs and blend inputs, and make sure the second blend source
is correctly loaded and converted (which is quite complex).
There's a slight refactoring of the monster generate_unswizzled_blend()
function where it makes sense to factor out alpha conversion (which needs
to run twice for dual source blend).
This passes piglit arb_blend_func_extended tests.
v2: remove new but ultimately not used function...
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c index 8e9e7fe8719..c4d04a26873 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c @@ -70,6 +70,7 @@ struct lp_build_blend_aos_context LLVMValueRef src; LLVMValueRef src_alpha; LLVMValueRef src1; + LLVMValueRef src1_alpha; LLVMValueRef dst; LLVMValueRef const_; LLVMValueRef const_alpha; @@ -94,6 +95,7 @@ lp_build_blend_factor_unswizzled(struct lp_build_blend_aos_context *bld, boolean alpha) { LLVMValueRef src_alpha = bld->src_alpha ? bld->src_alpha : bld->src; + LLVMValueRef src1_alpha = bld->src1_alpha ? bld->src1_alpha : bld->src1; LLVMValueRef const_alpha = bld->const_alpha ? bld->const_alpha : bld->const_; switch (factor) { @@ -123,8 +125,9 @@ lp_build_blend_factor_unswizzled(struct lp_build_blend_aos_context *bld, case PIPE_BLENDFACTOR_CONST_ALPHA: return const_alpha; case PIPE_BLENDFACTOR_SRC1_COLOR: - case PIPE_BLENDFACTOR_SRC1_ALPHA: return bld->src1; + case PIPE_BLENDFACTOR_SRC1_ALPHA: + return src1_alpha; case PIPE_BLENDFACTOR_INV_SRC_COLOR: if(!bld->inv_src) bld->inv_src = lp_build_comp(&bld->base, bld->src); @@ -147,8 +150,9 @@ lp_build_blend_factor_unswizzled(struct lp_build_blend_aos_context *bld, bld->inv_const_alpha = lp_build_comp(&bld->base, const_alpha); return bld->inv_const_alpha; case PIPE_BLENDFACTOR_INV_SRC1_COLOR: - case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: return lp_build_comp(&bld->base, bld->src1); + case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: + return lp_build_comp(&bld->base, src1_alpha); default: assert(0); return bld->base.zero; @@ -265,10 +269,13 @@ lp_build_blend_factor(struct lp_build_blend_aos_context *bld, * @param type data type of the pixel vector * @param rt render target index * @param src blend src + * @param src_alpha blend src alpha (if not included in src) * @param src1 second blend src (for dual source blend) + * @param src1_alpha second blend src alpha (if not included in src1) * @param dst blend dst * @param mask optional mask to apply to the blending result * @param const_ const blend color + * @param const_alpha const blend color alpha (if not included in const_) * @param swizzle swizzle values for RGBA * * @return the result of blending src and dst @@ -282,6 +289,7 @@ lp_build_blend_aos(struct gallivm_state *gallivm, LLVMValueRef src, LLVMValueRef src_alpha, LLVMValueRef src1, + LLVMValueRef src1_alpha, LLVMValueRef dst, LLVMValueRef mask, LLVMValueRef const_, @@ -307,6 +315,7 @@ lp_build_blend_aos(struct gallivm_state *gallivm, bld.dst = dst; bld.const_ = const_; bld.src_alpha = src_alpha; + bld.src1_alpha = src1_alpha; bld.const_alpha = const_alpha; /* Find the alpha channel if not provided seperately */ |