summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-11-08 14:40:29 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-11-08 14:40:29 -0700
commitc0b27149458c1c70b8664cdedb2be842229f4359 (patch)
treec76c24b6719691c7a3930ac50ea59445dc74668e /src/mesa/state_tracker
parentcee1d1328aadc501935f60f32cc2c8f8199ff57c (diff)
simplify depth_value(), return proper value for Z16 format
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index cb7e43fb8e..3e591170da 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -77,30 +77,24 @@ color_value(GLuint pipeFormat, const GLfloat color[4])
}
-static GLuint
+static uint
depth_value(GLuint pipeFormat, GLfloat value)
{
- GLuint val;
switch (pipeFormat) {
case PIPE_FORMAT_U_Z16:
- val = (GLuint) (value * 0xffffff);
- break;
+ return (uint) (value * 0xffff);
case PIPE_FORMAT_U_Z32:
/* special-case to avoid overflow */
if (value == 1.0)
- val = 0xffffffff;
+ return 0xffffffff;
else
- val = (GLuint) (value * 0xffffffff);
- break;
+ return (uint) (value * 0xffffffff);
case PIPE_FORMAT_S8_Z24:
- /*case PIPE_FORMAT_Z24_S8:*/
- val = (GLuint) (value * 0xffffff);
- break;
+ return (uint) (value * 0xffffff);
default:
- val = 0;
assert(0);
+ return 0;
}
- return val;
}
@@ -480,7 +474,7 @@ clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
}
else {
/* simple clear of whole buffer */
- GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
+ uint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
}
}