summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvc0/nvc0_state_validate.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-03-13 13:05:14 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-03-13 13:23:54 +0100
commitf0ee7d8bb46ac7694693f3fb8cd0f15c422f1bef (patch)
tree2542af2077e4ee01a3638605e98bb3e027ef2e45 /src/gallium/drivers/nvc0/nvc0_state_validate.c
parentd9f1310e519ac8182329fcd3e6c357d44d110955 (diff)
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.
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_state_validate.c')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_state_validate.c15
1 files changed, 15 insertions, 0 deletions
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 },