aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_bld_depth.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-07-27 13:09:12 +0100
committerJosé Fonseca <[email protected]>2010-07-27 13:09:47 +0100
commit4fbffb7d909f9746fb744e133563c80c66574adb (patch)
tree7f7f154d7c6f55f9ec0492027441cb49a8bac89c /src/gallium/drivers/llvmpipe/lp_bld_depth.c
parent2a45972fb2ba12a6561e5cba84d167f4c30566d4 (diff)
llvmpipe: Use lp_build_select_bitwise() where appropriate.
Fixes fdo 29269.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_depth.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_depth.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
index e05bbe5011a..99a768afd80 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
@@ -258,16 +258,16 @@ lp_build_stencil_op_single(struct lp_build_context *bld,
}
if (stencil->writemask != stencilMax) {
- /* compute res = (res & mask) | (stencilVals & ~mask) */
- LLVMValueRef mask = lp_build_const_int_vec(type, stencil->writemask);
- LLVMValueRef cmask = LLVMBuildNot(bld->builder, mask, "notWritemask");
- LLVMValueRef t1 = LLVMBuildAnd(bld->builder, res, mask, "t1");
- LLVMValueRef t2 = LLVMBuildAnd(bld->builder, stencilVals, cmask, "t2");
- res = LLVMBuildOr(bld->builder, t1, t2, "t1_or_t2");
+ /* mask &= stencil->writemask */
+ LLVMValueRef writemask = lp_build_const_int_vec(type, stencil->writemask);
+ mask = LLVMBuildAnd(bld->builder, mask, writemask, "");
+ /* res = (res & mask) | (stencilVals & ~mask) */
+ res = lp_build_select_bitwise(bld, writemask, res, stencilVals);
+ }
+ else {
+ /* res = mask ? res : stencilVals */
+ res = lp_build_select(bld, mask, res, stencilVals);
}
-
- /* only the update the vector elements enabled by 'mask' */
- res = lp_build_select(bld, mask, res, stencilVals);
return res;
}
@@ -662,9 +662,9 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
}
/* Mix the old and new Z buffer values.
- * z_dst[i] = zselectmask[i] ? z_src[i] : z_dst[i]
+ * z_dst[i] = (zselectmask[i] & z_src[i]) | (~zselectmask[i] & z_dst[i])
*/
- z_dst = lp_build_select(&bld, zselectmask, z_src, z_dst);
+ z_dst = lp_build_select_bitwise(&bld, zselectmask, z_src, z_dst);
}
if (stencil[0].enabled) {