summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorPatrice Mandin <pmandin@caramail.com>2007-02-16 19:54:55 +0100
committerPatrice Mandin <pmandin@caramail.com>2007-02-16 19:54:55 +0100
commit9131536f00cca586be7dfc1cfbc47188c78e4920 (patch)
tree9a217a73a73bffc0d42ec7ab62f3ba50076c9873 /src/mesa/drivers
parent252d1de05430cbed532b5a716cbd7da0ee7dd0d1 (diff)
nouveau: nv10: rescale depth near and far
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c
index e64fcb12f5..803dd962b5 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state.c
@@ -187,9 +187,15 @@ static void nv10DepthMask(GLcontext *ctx, GLboolean flag)
static void nv10DepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+
+ GLfloat depth_scale = 16777216.0;
+ if (ctx->DrawBuffer->_DepthBuffer->DepthBits == 16) {
+ depth_scale = 32768.0;
+ }
+
BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2);
- OUT_RING_CACHEf(nearval);
- OUT_RING_CACHEf(farval);
+ OUT_RING_CACHEf(nearval * depth_scale);
+ OUT_RING_CACHEf(farval * depth_scale);
nv10ViewportScale(nmesa);
}