diff options
author | Ben Skeggs <[email protected]> | 2008-04-30 21:42:23 +1000 |
---|---|---|
committer | Ben Skeggs <[email protected]> | 2008-04-30 21:42:23 +1000 |
commit | 1e6191e0af2653aa69bd623e25d2e157662e560f (patch) | |
tree | d4a603e082aa08c05e27528d848e5f5a9b06ff82 /src/mesa/main | |
parent | 95295081a8557f0b63cd89f387205d5abe772788 (diff) | |
parent | 42fb48492e71016c5a2888cd3d2507a89dbd91f3 (diff) |
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/mesa/main')
-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 ); |