From ac3ec5096a760daabb1f2be7400bd9723e5058a5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Sep 2005 02:27:22 +0000 Subject: added _mesa_scale_and_bias_depth() --- src/mesa/main/pixel.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/mesa/main/pixel.c') diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index e8912c7002..1f7bfc8bb8 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. -- cgit v1.2.3