aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pixel.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-09-28 02:27:22 +0000
committerBrian Paul <[email protected]>2005-09-28 02:27:22 +0000
commitac3ec5096a760daabb1f2be7400bd9723e5058a5 (patch)
tree0295a677eea5a024953420d48915a5247b4b0d1d /src/mesa/main/pixel.c
parentdbd0fa920effdceacec34fa0d5ae9ab7a2f09614 (diff)
added _mesa_scale_and_bias_depth()
Diffstat (limited to 'src/mesa/main/pixel.c')
-rw-r--r--src/mesa/main/pixel.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index e8912c70029..1f7bfc8bb8a 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -1838,6 +1838,19 @@ _mesa_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] )
}
+void
+_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
+ GLfloat depthValues[])
+{
+ const GLfloat scale = ctx->Pixel.DepthScale;
+ const GLfloat bias = ctx->Pixel.DepthBias;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLfloat d = depthValues[i] * scale + bias;
+ depthValues[i] = CLAMP(d, 0.0F, 1.0F);
+ }
+}
+
/*
* This function converts an array of GLchan colors to GLfloat colors.