aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2020-06-03 15:01:11 -0700
committerMarge Bot <[email protected]>2020-06-04 02:34:54 +0000
commite9cda38031af98cf504fb9eb90dd4214e494ecb2 (patch)
tree5390516a8804d78b8b05242b32325cc450f92f66 /src/gallium/drivers/freedreno
parent1e3731e7119c36b759ec9492a7c9ebf90b222122 (diff)
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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5298>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_emit.c3
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_zsa.c1
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_zsa.h1
3 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
index 82bf24759a4..256860bdfcc 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
@@ -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;
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c
index d7c2000b424..dc7c1fbf087 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c
@@ -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;
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.h b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.h
index 73bfa4fba06..2d39797116b 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.h
@@ -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;