mesa: added _mesa_scale_and_bias_depth_uint()

This commit is contained in:
Brian Paul 2008-04-29 12:51:06 -06:00
parent 1cff4992b3
commit 5fb774ab31
2 changed files with 18 additions and 0 deletions

View File

@ -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 *****/

View File

@ -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 );