summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-08-15 01:25:06 -0400
committerIlia Mirkin <[email protected]>2014-09-12 00:50:56 -0400
commit79959e5de518c59b327a9df4a6fa80a68213b873 (patch)
tree75986af6186e4de7c027dd2ac07d4b8bc3c6d041
parent8ab85bfcd5ddd44c50e5b384222731cb2a1a1496 (diff)
nouveau: only enable the depth test if there actually is a depth buffer
Signed-off-by: Ilia Mirkin <[email protected]> Cc: "10.2 10.3" <[email protected]>
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_fb.c1
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_raster.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_fb.c1
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_raster.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_fb.c1
5 files changed, 9 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
index 8b0857d281d..4c17190b8c4 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
@@ -93,6 +93,7 @@ nv04_emit_framebuffer(struct gl_context *ctx, int emit)
/* Recompute the scissor state. */
context_dirty(ctx, SCISSOR);
+ context_dirty(ctx, CONTROL);
}
void
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 41261195d81..26cf32f2a25 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -123,6 +123,7 @@ void
nv04_emit_control(struct gl_context *ctx, int emit)
{
struct nv04_context *nv04 = to_nv04_context(ctx);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
int cull = ctx->Polygon.CullFaceMode;
int front = ctx->Polygon.FrontFace;
@@ -146,9 +147,9 @@ nv04_emit_control(struct gl_context *ctx, int emit)
NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_CCW;
/* Depth test. */
- if (ctx->Depth.Test)
+ if (ctx->Depth.Test && fb->Visual.depthBits > 0)
nv04->ctrl[0] |= NV04_TEXTURED_TRIANGLE_CONTROL_Z_ENABLE;
- if (ctx->Depth.Mask)
+ if (ctx->Depth.Mask && fb->Visual.depthBits > 0)
nv04->ctrl[0] |= NV04_TEXTURED_TRIANGLE_CONTROL_Z_WRITE;
nv04->ctrl[0] |= get_comparison_op(ctx->Depth.Func) << 16;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index fb66b2d5494..75931849eb9 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -152,6 +152,7 @@ nv10_emit_framebuffer(struct gl_context *ctx, int emit)
context_dirty(ctx, VIEWPORT);
context_dirty(ctx, SCISSOR);
+ context_dirty(ctx, DEPTH);
}
void
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
index da414a0b06b..d34cf91dafd 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
@@ -97,11 +97,12 @@ void
nv10_emit_depth(struct gl_context *ctx, int emit)
{
struct nouveau_pushbuf *push = context_push(ctx);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
BEGIN_NV04(push, NV10_3D(DEPTH_TEST_ENABLE), 1);
- PUSH_DATAb(push, ctx->Depth.Test);
+ PUSH_DATAb(push, ctx->Depth.Test && fb->Visual.depthBits > 0);
BEGIN_NV04(push, NV10_3D(DEPTH_WRITE_ENABLE), 1);
- PUSH_DATAb(push, ctx->Depth.Mask);
+ PUSH_DATAb(push, ctx->Depth.Mask && fb->Visual.depthBits > 0);
BEGIN_NV04(push, NV10_3D(DEPTH_FUNC), 1);
PUSH_DATA (push, nvgl_comparison_op(ctx->Depth.Func));
}
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
index 6e3049e402e..cc6b6b06196 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
@@ -128,6 +128,7 @@ nv20_emit_framebuffer(struct gl_context *ctx, int emit)
/* Recompute the viewport/scissor state. */
context_dirty(ctx, VIEWPORT);
context_dirty(ctx, SCISSOR);
+ context_dirty(ctx, DEPTH);
}
void