Mesa (master): swrast: fix float->uint conversion of gl_FragDepth
Brian Paul
brianp at kemper.freedesktop.org
Wed Oct 19 15:33:44 UTC 2011
Module: Mesa
Branch: master
Commit: d3561bd0bc4a88ee0500460f8e0830a818e456a9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3561bd0bc4a88ee0500460f8e0830a818e456a9
Author: Brian Paul <brianp at vmware.com>
Date: Wed Oct 19 09:29:38 2011 -0600
swrast: fix float->uint conversion of gl_FragDepth
Using IROUND() to convert a float depth value to a 32-bit uint Z value.
didn't work (it returns a signed value). Just use a cast instead
Fixes piglit fbo-depth-array failure with swrast.
Note: this is a candidate for the 7.11 branch.
---
src/mesa/swrast/s_fragprog.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 7f205a2..1caa0eb 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -237,7 +237,8 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end)
else if (depth >= 1.0)
span->array->z[i] = ctx->DrawBuffer->_DepthMax;
else
- span->array->z[i] = IROUND(depth * ctx->DrawBuffer->_DepthMaxF);
+ span->array->z[i] =
+ (GLuint) (depth * ctx->DrawBuffer->_DepthMaxF + 0.5F);
}
}
else {
More information about the mesa-commit
mailing list