vc4: Skip storing the Z/S contents when it's invalidated.
authorEric Anholt <eric@anholt.net>
Sat, 3 Jan 2015 06:55:37 +0000 (22:55 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 6 Jan 2015 23:40:41 +0000 (15:40 -0800)
Improves framerate of 5 seconds of es2gears by 1.57473% +/- 0.669409%
(n=67).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/drivers/vc4/vc4_context.c

index 62f77b3da1bcfa64632071059d01525681eceade..4c84bd343df9cb6aa5b144c517215a2387727046 100644 (file)
@@ -466,6 +466,16 @@ vc4_cl_references_bo(struct pipe_context *pctx, struct vc4_bo *bo)
         return false;
 }
 
+static void
+vc4_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
+{
+        struct vc4_context *vc4 = vc4_context(pctx);
+        struct pipe_surface *zsurf = vc4->framebuffer.zsbuf;
+
+        if (zsurf && zsurf->texture == prsc)
+                vc4->resolve &= ~(PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL);
+}
+
 static void
 vc4_context_destroy(struct pipe_context *pctx)
 {
@@ -510,6 +520,7 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv)
         pctx->priv = priv;
         pctx->destroy = vc4_context_destroy;
         pctx->flush = vc4_pipe_flush;
+        pctx->invalidate_resource = vc4_invalidate_resource;
 
         vc4_draw_init(pctx);
         vc4_state_init(pctx);