nv30: reset the stencil mask when fast-clearing
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 22 May 2016 18:34:28 +0000 (14:34 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 22 May 2016 18:48:56 +0000 (14:48 -0400)
Apparently the stencil mask applies to clears on nv30/nv40. Reset it to
0xff before doing a stencil clear. This fixes gl-1.0-readpixsanity and
a number of other piglit tests.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/nv30/nv30_clear.c

index 118cac77277fbafeb3b55321c8645766340f60e7..c8fa38e20c74e9dce3edfd443a5d41c7b05f9698 100644 (file)
@@ -73,8 +73,13 @@ nv30_clear(struct pipe_context *pipe, unsigned buffers,
       zeta = pack_zeta(fb->zsbuf->format, depth, stencil);
       if (buffers & PIPE_CLEAR_DEPTH)
          mode |= NV30_3D_CLEAR_BUFFERS_DEPTH;
-      if (buffers & PIPE_CLEAR_STENCIL)
+      if (buffers & PIPE_CLEAR_STENCIL) {
          mode |= NV30_3D_CLEAR_BUFFERS_STENCIL;
+         BEGIN_NV04(push, NV30_3D(STENCIL_ENABLE(0)), 2);
+         PUSH_DATA (push, 0);
+         PUSH_DATA (push, 0x000000ff);
+         nv30->dirty |= NV30_NEW_ZSA;
+      }
    }
 
    /*XXX: wtf? fixes clears sometimes not clearing on nv3x... */