aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-08-17 07:50:45 +0100
committerJosé Fonseca <[email protected]>2009-08-29 09:21:33 +0100
commit81e7ec485d5288bbce8b8e40af57fe4c0392c69f (patch)
tree587f17330a552c9c8f5f045f979a1012970f0877 /src/gallium/drivers
parent4d7a8194c5763f70ba559f32f58dfda36237b666 (diff)
llvmpipe: Handle floating point selection.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_swizzle.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c
index 7fd25e9dd69..185df4a3429 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c
@@ -137,9 +137,18 @@ lp_build_select(struct lp_build_context *bld,
LLVMValueRef a,
LLVMValueRef b)
{
+ union lp_type type = bld->type;
+ LLVMValueRef res;
+
if(a == b)
return a;
+ if(type.floating) {
+ LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+ a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
+ b = LLVMBuildBitCast(bld->builder, b, int_vec_type, "");
+ }
+
/* TODO: On SSE4 we could do this with a single instruction -- PBLENDVB */
a = LLVMBuildAnd(bld->builder, a, mask, "");
@@ -151,7 +160,14 @@ lp_build_select(struct lp_build_context *bld,
*/
b = LLVMBuildAnd(bld->builder, b, LLVMBuildNot(bld->builder, mask, ""), "");
- return LLVMBuildOr(bld->builder, a, b, "");
+ res = LLVMBuildOr(bld->builder, a, b, "");
+
+ if(type.floating) {
+ LLVMTypeRef vec_type = lp_build_vec_type(type);
+ res = LLVMBuildBitCast(bld->builder, res, vec_type, "");
+ }
+
+ return res;
}