mesa/st: Don't set alpha if ALPHA_TEST is lowered
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 31 Aug 2020 11:09:30 +0000 (07:09 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 2 Sep 2020 11:21:33 +0000 (07:21 -0400)
commitc601e730b298c5bdd34bc4335f203d46c5cdf9b3
treee0ba4ad808a6395aaed901bf7f9dd45468cb58b6
parent075e40ea983fddabbb45ee5d511e66536f3c9c11
mesa/st: Don't set alpha if ALPHA_TEST is lowered

When PIPE_CAP_ALPHA_TEST is zero, the driver does not support alpha
testing, so alpha shouldn't be set. In particular, alpha.enable should
be zero, since logically alpha testing is not used in the ZSA CSO when
it's lowered in the fragment shader key.

Fixes failing asserts in kicad, rvgl, etc with Panfrost since 6afd4ad.
(We could remove the assert in panfrost instead, but logically setting
alpha.enabled on top of lowering the shader seems wrong?)

As Erik pointed out, this should improve CSO cache behaviour.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reported-by: Icecream95 <ixn@keemail.me>
Tested-by: Urja Rannikko <urjaman@gmail.com>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: 6afd4addefa ("panfrost: Simplify depth/stencil/alpha")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6523>
src/mesa/state_tracker/st_atom_depth.c