summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-10-10 01:39:13 +0200
committerFrancisco Jerez <currojerez@riseup.net>2010-10-10 04:14:34 +0200
commite2acc7be2683fd3c295480724b02f5a497309cfd (patch)
tree7707be4e255377633aa7bb79db6dec77a9658f04 /src/mesa/drivers/dri/nouveau/nv10_state_fb.c
parent35a1893fd1993932a428f5f83051383d51c8135e (diff)
dri/nv10: Fake fast Z clears for pre-nv17 cards.
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nv10_state_fb.c')
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_fb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index 98eb0e8ece..f9f3ebaa8d 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -172,12 +172,15 @@ nv10_emit_viewport(GLcontext *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
+ struct gl_viewport_attrib *vp = &ctx->Viewport;
struct gl_framebuffer *fb = ctx->DrawBuffer;
float a[4] = {};
get_viewport_translate(ctx, a);
a[0] -= 2048;
a[1] -= 2048;
+ if (nv10_use_viewport_zclear(ctx))
+ a[2] = nv10_transform_depth(ctx, (vp->Far + vp->Near) / 2);
BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_TRANSLATE_X, 4);
OUT_RINGp(chan, a, 4);
@@ -204,5 +207,10 @@ nv10_emit_zclear(GLcontext *ctx, int emit)
OUT_RING(chan, nctx->hierz.clear_blocked ? 0 : 1);
OUT_RING(chan, nfb->hierz.clear_value |
(nctx->hierz.clear_seq & 0xff));
+ } else {
+ BEGIN_RING(chan, celsius, NV10TCL_DEPTH_RANGE_NEAR, 2);
+ OUT_RINGf(chan, nv10_transform_depth(ctx, 0));
+ OUT_RINGf(chan, nv10_transform_depth(ctx, 1));
+ context_dirty(ctx, VIEWPORT);
}
}