From f0ee7d8bb46ac7694693f3fb8cd0f15c422f1bef Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 13 Mar 2011 13:05:14 +0100 Subject: nvc0: don't enable early-z if alpha test is enabled Depth values are also written before the shader is executed, so if early tests are enabled, fragments that failed the alpha test were modifying the depth buffer, but they shouldn't. --- src/gallium/drivers/nvc0/nvc0_state.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/gallium/drivers/nvc0/nvc0_state.c') diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index bbcac3938f5..1815fe88a9b 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -276,14 +276,11 @@ nvc0_zsa_state_create(struct pipe_context *pipe, so->pipe = *cso; - SB_IMMED_3D(so, DEPTH_WRITE_ENABLE, cso->depth.writemask); - SB_BEGIN_3D(so, DEPTH_TEST_ENABLE, 1); + SB_IMMED_3D(so, DEPTH_TEST_ENABLE, cso->depth.enabled); if (cso->depth.enabled) { - SB_DATA (so, 1); + SB_IMMED_3D(so, DEPTH_WRITE_ENABLE, cso->depth.writemask); SB_BEGIN_3D(so, DEPTH_TEST_FUNC, 1); SB_DATA (so, nvgl_comparison_op(cso->depth.func)); - } else { - SB_DATA (so, 0); } if (cso->stencil[0].enabled) { @@ -315,15 +312,12 @@ nvc0_zsa_state_create(struct pipe_context *pipe, if (cso->stencil[0].enabled) { SB_IMMED_3D(so, STENCIL_TWO_SIDE_ENABLE, 0); } - - SB_BEGIN_3D(so, ALPHA_TEST_ENABLE, 1); + + SB_IMMED_3D(so, ALPHA_TEST_ENABLE, cso->alpha.enabled); if (cso->alpha.enabled) { - SB_DATA (so, 1); SB_BEGIN_3D(so, ALPHA_TEST_REF, 2); SB_DATA (so, fui(cso->alpha.ref_value)); SB_DATA (so, nvgl_comparison_op(cso->alpha.func)); - } else { - SB_DATA (so, 0); } assert(so->size < (sizeof(so->state) / sizeof(so->state[0]))); -- cgit v1.2.3