[Mesa-dev] [PATCH 3/3] nouveau: only enable stencil func if the visual has stencil bits

Ilia Mirkin imirkin at alum.mit.edu
Sat Aug 16 09:59:17 PDT 2014


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/mesa/drivers/dri/nouveau/nouveau_state.c     | 1 +
 src/mesa/drivers/dri/nouveau/nv10_state_raster.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index f58caa3..2a77424 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -118,6 +118,7 @@ nouveau_draw_buffers(struct gl_context *ctx, GLsizei n, const GLenum *buffers)
 	nouveau_validate_framebuffer(ctx);
 	context_dirty(ctx, FRAMEBUFFER);
 	context_dirty(ctx, DEPTH);
+	context_dirty(ctx, STENCIL_FUNC);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
index d34cf91..23e2700 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
@@ -143,9 +143,10 @@ void
 nv10_emit_stencil_func(struct gl_context *ctx, int emit)
 {
 	struct nouveau_pushbuf *push = context_push(ctx);
+	struct gl_framebuffer *fb = ctx->DrawBuffer;
 
 	BEGIN_NV04(push, NV10_3D(STENCIL_ENABLE), 1);
-	PUSH_DATAb(push, ctx->Stencil.Enabled);
+	PUSH_DATAb(push, ctx->Stencil.Enabled && fb->Visual.stencilBits > 0);
 
 	BEGIN_NV04(push, NV10_3D(STENCIL_FUNC_FUNC), 3);
 	PUSH_DATA (push, nvgl_comparison_op(ctx->Stencil.Function[0]));
-- 
1.8.5.5



More information about the mesa-dev mailing list