aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrice Mandin <[email protected]>2007-02-16 20:26:57 +0100
committerPatrice Mandin <[email protected]>2007-02-16 20:26:57 +0100
commitf942dc5522682b70fb05df5b2d5d732bb65e6fe2 (patch)
tree99cf195b412a0ad54cbd743e409ec0d48d556eba /src
parent9131536f00cca586be7dfc1cfbc47188c78e4920 (diff)
nouveau: nv10: set clear value for 16 and 24 bits depth
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c
index 803dd962b59..cc0f5a7220b 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state.c
@@ -121,16 +121,27 @@ static void nv10ClearColor(GLcontext *ctx, const GLfloat color[4])
static void nv10ClearDepth(GLcontext *ctx, GLclampd d)
{
- /* FIXME: check if 16 or 24/32 bits depth buffer */
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
- nmesa->clear_value=((nmesa->clear_value&0x000000FF)|(((uint32_t)(d*0xFFFFFF))<<8));
+
+ switch (ctx->DrawBuffer->_DepthBuffer->DepthBits) {
+ case 16:
+ nmesa->clear_value = (uint32_t)(d*0x7FFF);
+ break;
+ case 24:
+ nmesa->clear_value = ((nmesa->clear_value&0x000000FF) |
+ (((uint32_t)(d*0xFFFFFF))<<8));
+ break;
+ }
}
static void nv10ClearStencil(GLcontext *ctx, GLint s)
{
- /* FIXME: not valid for 16 bits depth buffer (0 stencil bits) */
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
- nmesa->clear_value=((nmesa->clear_value&0xFFFFFF00)|(s&0x000000FF));
+
+ if (ctx->DrawBuffer->_DepthBuffer->DepthBits == 24) {
+ nmesa->clear_value = ((nmesa->clear_value&0xFFFFFF00)|
+ (s&0x000000FF));
+ }
}
static void nv10ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation)