Mesa (master): vc4: Don't worry about partial Z/ S clear if the other is already cleared.

Eric Anholt anholt at kemper.freedesktop.org
Fri Oct 7 01:30:47 UTC 2016


Module: Mesa
Branch: master
Commit: 20d91e5ce9b2da46c703b6af16c5e7ac0e13150f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=20d91e5ce9b2da46c703b6af16c5e7ac0e13150f

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Oct  6 14:50:04 2016 -0700

vc4: Don't worry about partial Z/S clear if the other is already cleared.

We have to be careful to not smash the value they're clearing to, but
other than that we're fine.  Avoids quad clears in Processing, which likes
to do glClear(Z|S); glClear(Z).

Improves performance of Processing's QuadRendering demo at 5000 quads by
5.46507% +/- 1.35576% (n=15 before, 32 after)

---

 src/gallium/drivers/vc4/vc4_draw.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index 87c8a5f..f44831f 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -514,7 +514,7 @@ vc4_clear(struct pipe_context *pctx, unsigned buffers,
                  */
                 if ((zsclear == PIPE_CLEAR_DEPTH ||
                      zsclear == PIPE_CLEAR_STENCIL) &&
-                    (rsc->initialized_buffers & ~zsclear) &&
+                    (rsc->initialized_buffers & ~(zsclear | job->cleared)) &&
                     util_format_is_depth_and_stencil(vc4->framebuffer.zsbuf->format)) {
                         perf_debug("Partial clear of Z+stencil buffer, "
                                    "drawing a quad instead of fast clearing\n");
@@ -533,8 +533,12 @@ vc4_clear(struct pipe_context *pctx, unsigned buffers,
                 /* Though the depth buffer is stored with Z in the high 24,
                  * for this field we just need to store it in the low 24.
                  */
-                job->clear_depth = util_pack_z(PIPE_FORMAT_Z24X8_UNORM, depth);
-                job->clear_stencil = stencil;
+                if (buffers & PIPE_CLEAR_DEPTH) {
+                        job->clear_depth = util_pack_z(PIPE_FORMAT_Z24X8_UNORM,
+                                                       depth);
+                }
+                if (buffers & PIPE_CLEAR_STENCIL)
+                        job->clear_stencil = stencil;
 
                 rsc->initialized_buffers |= zsclear;
         }




More information about the mesa-commit mailing list