summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_state.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-08-01 13:32:49 -0700
committerEric Anholt <[email protected]>2014-08-11 14:45:31 -0700
commit4160ac5ee41630a5c9fc4e1f3520f0fabf42cb14 (patch)
treeb9fa27c50da704655560e2d2a9f5b2e94288049f /src/gallium/drivers/vc4/vc4_state.c
parent2259cc5aebcb16636b1399dd438beed9d9867e67 (diff)
vc4: Add support for depth clears and tests within a tile.
This doesn't load/store the Z contents across submits yet. It also disables early Z, since it's going to require tracking of Z functions across multiple state updates to track the early Z direction and whether it can be used. v2: Move the key setup to before the search for the key.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_state.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_state.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c
index ab1e8be6ee3..69fd2187720 100644
--- a/src/gallium/drivers/vc4/vc4_state.c
+++ b/src/gallium/drivers/vc4/vc4_state.c
@@ -107,8 +107,6 @@ vc4_create_rasterizer_state(struct pipe_context *pctx,
if (cso->offset_tri)
so->config_bits[0] |= VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET;
- so->config_bits[2] |= VC4_CONFIG_BITS_EARLY_Z_UPDATE;
-
return so;
}
@@ -124,7 +122,26 @@ static void *
vc4_create_depth_stencil_alpha_state(struct pipe_context *pctx,
const struct pipe_depth_stencil_alpha_state *cso)
{
- return vc4_generic_cso_state_create(cso, sizeof(*cso));
+ struct vc4_depth_stencil_alpha_state *so;
+
+ so = CALLOC_STRUCT(vc4_depth_stencil_alpha_state);
+ if (!so)
+ return NULL;
+
+ so->base = *cso;
+
+ if (cso->depth.enabled) {
+ if (cso->depth.writemask) {
+ so->config_bits[1] |= VC4_CONFIG_BITS_Z_UPDATE;
+ }
+ so->config_bits[1] |= (cso->depth.func <<
+ VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT);
+ } else {
+ so->config_bits[1] |= (PIPE_FUNC_ALWAYS <<
+ VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT);
+ }
+
+ return so;
}
static void