diff options
author | Brian Paul <[email protected]> | 2008-04-29 12:51:06 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-04-29 12:51:06 -0600 |
commit | 5fb774ab31b11f3a55d9dc47cee5eeaf5abc5981 (patch) | |
tree | 1d0837e4826da7b4813ca28a17805704d05ab0ea | |
parent | 1cff4992b389ad884a663c93bdd7b7c6be6c79d2 (diff) |
mesa: added _mesa_scale_and_bias_depth_uint()
-rw-r--r-- | src/mesa/main/pixel.c | 15 | ||||
-rw-r--r-- | src/mesa/main/pixel.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index eb4fd6e7c94..0e9915dd38f 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1341,6 +1341,21 @@ _mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, } +void +_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, + GLuint depthValues[]) +{ + const GLdouble max = (double) 0xffffffff; + const GLdouble scale = ctx->Pixel.DepthScale; + const GLdouble bias = ctx->Pixel.DepthBias * max; + GLuint i; + for (i = 0; i < n; i++) { + GLdouble d = (GLdouble) depthValues[i] * scale + bias; + d = CLAMP(d, 0.0, max); + depthValues[i] = (GLuint) d; + } +} + /**********************************************************************/ /***** State Management *****/ diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index 09155cfd70d..3ba5b6689ab 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -116,6 +116,9 @@ extern void _mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, GLfloat depthValues[]); +extern void +_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, + GLuint depthValues[]); extern void _mesa_update_pixel( GLcontext *ctx, GLuint newstate ); |