broadcom/compiler: Set up passthrough Z when doing FS discards.

In order to keep early-Z from writing early in a discard shader, you need
to set the "modifies Z" bit in the shader state (which the new
prog_data.discards will indicate).  Then, in the shader we do a TLB write
to make Z passthrough happen (the QPU result is ignored, so we use a NULL
source).
This commit is contained in:
Eric Anholt
2017-09-28 10:37:02 -07:00
parent 4c4fbab345
commit 732a3a72cb
3 changed files with 15 additions and 2 deletions

View File

@@ -1038,6 +1038,17 @@ emit_frag_end(struct v3d_compile *c)
TLB_TYPE_DEPTH |
TLB_DEPTH_TYPE_PER_PIXEL |
0xffffff00);
} else if (c->s->info.fs.uses_discard) {
struct qinst *inst = vir_MOV_dest(c,
vir_reg(QFILE_TLBU, 0),
vir_reg(QFILE_NULL, 0));
vir_set_cond(inst, discard_cond);
inst->src[vir_get_implicit_uniform_src(inst)] =
vir_uniform_ui(c,
TLB_TYPE_DEPTH |
TLB_DEPTH_TYPE_INVARIANT |
0xffffff00);
}
/* XXX: Performance improvement: Merge Z write and color writes TLB