freedreno/a6xx: also consider alpha-test for ztest-mode

Looks like we don't have CI coverage for this (since deqp==GLES) but
alpha test is conceptually the same as frag shaders with discard, and
should be handled as such.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5298>
This commit is contained in:
Rob Clark 2020-06-03 15:01:11 -07:00 committed by Marge Bot
parent 1e3731e711
commit e9cda38031
3 changed files with 4 additions and 1 deletions

View file

@ -588,11 +588,12 @@ build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp)
static enum a6xx_ztest_mode
compute_ztest_mode(struct fd6_emit *emit, bool lrz_valid)
{
struct fd6_zsa_stateobj *zsa = fd6_zsa_stateobj(emit->ctx->zsa);
const struct ir3_shader_variant *fs = emit->fs;
if (fs->no_earlyz || fs->writes_pos) {
return A6XX_LATE_Z;
} else if (fs->has_kill) {
} else if (fs->has_kill || zsa->alpha_test) {
return lrz_valid ? A6XX_EARLY_LRZ_LATE_Z : A6XX_LATE_Z;
} else {
return A6XX_EARLY_Z;

View file

@ -190,6 +190,7 @@ fd6_zsa_state_create(struct pipe_context *pctx,
*/
if (cso->alpha.func != PIPE_FUNC_ALWAYS) {
so->lrz.write = false;
so->alpha_test = true;
}
uint32_t ref = cso->alpha.ref_value * 255.0;

View file

@ -47,6 +47,7 @@ struct fd6_zsa_stateobj {
struct fd6_lrz_state lrz;
bool invalidate_lrz;
bool alpha_test;
struct fd_ringbuffer *stateobj;
struct fd_ringbuffer *stateobj_no_alpha;