Hi,

I didn't verify it, but both r600 and a3xx disable earlyZ when alpha test is enabled, so this is almost certainly right.

We don't need to worry about the shader writing Z, it is not part of OpenGL ES 2.0 and not implemented by the driver (although the hardware should allow it).

Why should we need to check if the shader does discards?

On 12/19/2018 01:05 PM, Eric Anholt wrote:
Jonathan Marek <jonat...@marek.ca> writes:

Enable earlyZ when alpha test is disabled.

Signed-off-by: Jonathan Marek <jonat...@marek.ca>
---
  src/gallium/drivers/freedreno/a2xx/fd2_zsa.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_zsa.c 
b/src/gallium/drivers/freedreno/a2xx/fd2_zsa.c
index 64b31b677b..d3c19b4450 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_zsa.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_zsa.c
@@ -49,7 +49,8 @@ fd2_zsa_state_create(struct pipe_context *pctx,
                A2XX_RB_DEPTHCONTROL_ZFUNC(cso->depth.func); /* maps 1:1 */
if (cso->depth.enabled)
-               so->rb_depthcontrol |= A2XX_RB_DEPTHCONTROL_Z_ENABLE;
+               so->rb_depthcontrol |= A2XX_RB_DEPTHCONTROL_Z_ENABLE |
+                       COND(!cso->alpha.enabled, 
A2XX_RB_DEPTHCONTROL_EARLY_Z_ENABLE);

Why when alpha test is disabled?  Should you also be checking if the
shader does discards?  How about if the shader writes Z, is anything
preventing early Z then?

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to