aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pixel.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-04-29 12:51:06 -0600
committerBrian Paul <[email protected]>2008-04-29 12:51:06 -0600
commit5fb774ab31b11f3a55d9dc47cee5eeaf5abc5981 (patch)
tree1d0837e4826da7b4813ca28a17805704d05ab0ea /src/mesa/main/pixel.c
parent1cff4992b389ad884a663c93bdd7b7c6be6c79d2 (diff)
mesa: added _mesa_scale_and_bias_depth_uint()
Diffstat (limited to 'src/mesa/main/pixel.c')
-rw-r--r--src/mesa/main/pixel.c15
1 files changed, 15 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 *****/