summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2013-02-07 12:54:41 -0800
committerRoland Scheidegger <sroland@vmware.com>2013-02-08 16:32:30 -0800
commit67906f91c9b924306d6bfec5d718b6225390205d (patch)
treee7d090d95f33b70f7c5a640d92a899c36ae0ddea /src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
parent8e44f4117a9c73ea336063f7c2fbf4d6a592eeae (diff)
llvmpipe: first steps of adding dual source blend support
This adds support of the additional blending factors to the blend function itself, and also enables testing of it in lp_test_blend (which passes). Still need to add the glue code of linking fs shader outputs to blend inputs in llvmpipe, and probably need to add special handling if destination doesn't include alpha (which lp_test_blend doesn't test). Reviewed-by: Jose Fonseca <jfonseca@vmware.com> 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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
index ccdf8528994..8e9e7fe8719 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
@@ -69,6 +69,7 @@ struct lp_build_blend_aos_context
LLVMValueRef src;
LLVMValueRef src_alpha;
+ LLVMValueRef src1;
LLVMValueRef dst;
LLVMValueRef const_;
LLVMValueRef const_alpha;
@@ -123,9 +124,7 @@ lp_build_blend_factor_unswizzled(struct lp_build_blend_aos_context *bld,
return const_alpha;
case PIPE_BLENDFACTOR_SRC1_COLOR:
case PIPE_BLENDFACTOR_SRC1_ALPHA:
- /* TODO */
- assert(0);
- return bld->base.zero;
+ return bld->src1;
case PIPE_BLENDFACTOR_INV_SRC_COLOR:
if(!bld->inv_src)
bld->inv_src = lp_build_comp(&bld->base, bld->src);
@@ -149,9 +148,7 @@ lp_build_blend_factor_unswizzled(struct lp_build_blend_aos_context *bld,
return bld->inv_const_alpha;
case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
case PIPE_BLENDFACTOR_INV_SRC1_ALPHA:
- /* TODO */
- assert(0);
- return bld->base.zero;
+ return lp_build_comp(&bld->base, bld->src1);
default:
assert(0);
return bld->base.zero;
@@ -268,6 +265,7 @@ 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 src1 second blend src (for dual source blend)
* @param dst blend dst
* @param mask optional mask to apply to the blending result
* @param const_ const blend color
@@ -283,6 +281,7 @@ lp_build_blend_aos(struct gallivm_state *gallivm,
unsigned rt,
LLVMValueRef src,
LLVMValueRef src_alpha,
+ LLVMValueRef src1,
LLVMValueRef dst,
LLVMValueRef mask,
LLVMValueRef const_,
@@ -304,6 +303,7 @@ lp_build_blend_aos(struct gallivm_state *gallivm,
memset(&bld, 0, sizeof bld);
lp_build_context_init(&bld.base, gallivm, type);
bld.src = src;
+ bld.src1 = src1;
bld.dst = dst;
bld.const_ = const_;
bld.src_alpha = src_alpha;