summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-04-29 12:51:06 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-04-29 12:51:06 -0600
commit5fb774ab31b11f3a55d9dc47cee5eeaf5abc5981 (patch)
tree1d0837e4826da7b4813ca28a17805704d05ab0ea /src
parent1cff4992b389ad884a663c93bdd7b7c6be6c79d2 (diff)
mesa: added _mesa_scale_and_bias_depth_uint()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/pixel.c15
-rw-r--r--src/mesa/main/pixel.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index eb4fd6e7c9..0e9915dd38 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 09155cfd70..3ba5b6689a 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 );