Mesa (mesa_7_7_branch): llvmpipe: Use the generic conversion routine for depths.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Thu Jan 28 20:23:03 UTC 2010
Module: Mesa
Branch: mesa_7_7_branch
Commit: 1acf7a09e762e6d8a26c8f0d919f5efa6df6e71f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1acf7a09e762e6d8a26c8f0d919f5efa6df6e71f
Author: José Fonseca <jfonseca at vmware.com>
Date: Tue Nov 10 17:52:53 2009 -0800
llvmpipe: Use the generic conversion routine for depths.
This allows for z32f depth format to work correctly.
---
src/gallium/drivers/llvmpipe/lp_state_fs.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 696657e..48ec5e1 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -147,6 +147,20 @@ generate_depth(LLVMBuilderRef builder,
format_desc = util_format_description(key->zsbuf_format);
assert(format_desc);
+ /*
+ * Depths are expected to be between 0 and 1, even if they are stored in
+ * floats. Setting these bits here will ensure that the lp_build_conv() call
+ * below won't try to unnecessarily clamp the incoming values.
+ */
+ if(src_type.floating) {
+ src_type.sign = FALSE;
+ src_type.norm = TRUE;
+ }
+ else {
+ assert(!src_type.sign);
+ assert(src_type.norm);
+ }
+
/* Pick the depth type. */
dst_type = lp_depth_type(format_desc, src_type.width*src_type.length);
@@ -154,14 +168,11 @@ generate_depth(LLVMBuilderRef builder,
assert(dst_type.width == src_type.width);
assert(dst_type.length == src_type.length);
-#if 1
- src = lp_build_clamped_float_to_unsigned_norm(builder,
- src_type,
- dst_type.width,
- src);
-#else
lp_build_conv(builder, src_type, dst_type, &src, 1, &src, 1);
-#endif
+
+ dst_ptr = LLVMBuildBitCast(builder,
+ dst_ptr,
+ LLVMPointerType(lp_build_vec_type(dst_type), 0), "");
lp_build_depth_test(builder,
&key->depth,
More information about the mesa-commit
mailing list