diff options
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_context.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_shader_state.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_state.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_state_validate.c | 15 |
4 files changed, 20 insertions, 12 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_context.h b/src/gallium/drivers/nvc0/nvc0_context.h index 67c5a1287b..aac358e142 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.h +++ b/src/gallium/drivers/nvc0/nvc0_context.h @@ -79,6 +79,7 @@ struct nvc0_context { uint32_t instance_base; int32_t index_bias; boolean prim_restart; + boolean early_z; uint8_t num_vtxbufs; uint8_t num_vtxelts; uint8_t num_textures[5]; diff --git a/src/gallium/drivers/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nvc0/nvc0_shader_state.c index 79b5f3d81c..7294eaa222 100644 --- a/src/gallium/drivers/nvc0/nvc0_shader_state.c +++ b/src/gallium/drivers/nvc0/nvc0_shader_state.c @@ -111,8 +111,6 @@ nvc0_fragprog_validate(struct nvc0_context *nvc0) return; nvc0_program_update_context_state(nvc0, fp, 4); - BEGIN_RING(chan, RING_3D(EARLY_FRAGMENT_TESTS), 1); - OUT_RING (chan, fp->fp.early_z); BEGIN_RING(chan, RING_3D(SP_SELECT(5)), 2); OUT_RING (chan, 0x51); OUT_RING (chan, fp->code_base); diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index bbcac3938f..1815fe88a9 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]))); diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c index c37a070bc6..4daa968de5 100644 --- a/src/gallium/drivers/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c @@ -387,6 +387,20 @@ nvc0_constbufs_validate(struct nvc0_context *nvc0) } } +static void +nvc0_validate_derived_1(struct nvc0_context *nvc0) +{ + struct nouveau_channel *chan = nvc0->screen->base.channel; + boolean early_z; + + early_z = nvc0->fragprog->fp.early_z && !nvc0->zsa->pipe.alpha.enabled; + + if (early_z != nvc0->state.early_z) { + nvc0->state.early_z = early_z; + IMMED_RING(chan, RING_3D(EARLY_FRAGMENT_TESTS), early_z); + } +} + static struct state_validate { void (*func)(struct nvc0_context *); uint32_t states; @@ -406,6 +420,7 @@ static struct state_validate { { nvc0_tevlprog_validate, NVC0_NEW_TEVLPROG }, { nvc0_gmtyprog_validate, NVC0_NEW_GMTYPROG }, { nvc0_fragprog_validate, NVC0_NEW_FRAGPROG }, + { nvc0_validate_derived_1, NVC0_NEW_FRAGPROG | NVC0_NEW_ZSA }, { nvc0_constbufs_validate, NVC0_NEW_CONSTBUF }, { nvc0_validate_textures, NVC0_NEW_TEXTURES }, { nvc0_validate_samplers, NVC0_NEW_SAMPLERS }, |