diff options
author | Jonathan Marek <[email protected]> | 2019-09-17 07:49:46 -0400 |
---|---|---|
committer | Jonathan Marek <[email protected]> | 2019-09-28 00:34:43 -0400 |
commit | d4e35e62d279be2c49985a9733ad1bf4c4237603 (patch) | |
tree | cc799e5fec94d819d69f6c54964de3d04a5b51f9 /src/gallium/drivers/etnaviv | |
parent | dc3656c9c48915cd86f460021438b3a9ef85ef67 (diff) |
etnaviv: disable earlyZ when shader writes fragment depth
Fixes the following piglit test: fragdepth_gles2
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_emit.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_internal.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_shader.c | 3 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c index a9ed1f615e9..338ea9ebca0 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c @@ -451,9 +451,10 @@ etna_emit_state(struct etna_context *ctx) : ctx->shader_state.PS_TEMP_REGISTER_CONTROL); /*01010*/ EMIT_STATE(PS_CONTROL, ctx->shader_state.PS_CONTROL); } - if (unlikely(dirty & (ETNA_DIRTY_ZSA | ETNA_DIRTY_FRAMEBUFFER))) { - uint32_t val = etna_zsa_state(ctx->zsa)->PE_DEPTH_CONFIG; - /*01400*/ EMIT_STATE(PE_DEPTH_CONFIG, val | ctx->framebuffer.PE_DEPTH_CONFIG); + if (unlikely(dirty & (ETNA_DIRTY_ZSA | ETNA_DIRTY_FRAMEBUFFER | ETNA_DIRTY_SHADER))) { + /*01400*/ EMIT_STATE(PE_DEPTH_CONFIG, (etna_zsa_state(ctx->zsa)->PE_DEPTH_CONFIG | + ctx->framebuffer.PE_DEPTH_CONFIG) & + ctx->shader_state.PE_DEPTH_CONFIG); } if (unlikely(dirty & (ETNA_DIRTY_VIEWPORT))) { /*01404*/ EMIT_STATE(PE_DEPTH_NEAR, ctx->viewport.PE_DEPTH_NEAR); diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h b/src/gallium/drivers/etnaviv/etnaviv_internal.h index 82315e03b58..e5a5b590efa 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_internal.h +++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h @@ -257,6 +257,7 @@ struct compiled_shader_state { uint32_t PS_TEMP_REGISTER_CONTROL_MSAA; /* Adds a temporary if needed to make space for extra input */ uint32_t PS_CONTROL; uint32_t PS_START_PC; + uint32_t PE_DEPTH_CONFIG; uint32_t GL_VARYING_TOTAL_COMPONENTS; uint32_t GL_VARYING_NUM_COMPONENTS; uint32_t GL_VARYING_COMPONENT_USE[2]; diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index a5310ddde29..98d4c2874a7 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -199,6 +199,9 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs, VIVS_GL_HALTI5_SH_SPECIALS_PS_PCOORD_IN((link.pcoord_varying_comp_ofs != -1) ? link.pcoord_varying_comp_ofs : 0x7f); + /* mask out early Z bit when frag depth is written */ + cs->PE_DEPTH_CONFIG = ~COND(fs->ps_depth_out_reg >= 0, VIVS_PE_DEPTH_CONFIG_EARLY_Z); + /* reference instruction memory */ cs->vs_inst_mem_size = vs->code_size; cs->VS_INST_MEM = vs->code; |