gallium: Plumb the swap INVALIDATE_ANCILLARY flag through more layers.
authorEric Anholt <eric@anholt.net>
Sun, 21 Dec 2014 20:48:59 +0000 (12:48 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 6 Jan 2015 23:40:41 +0000 (15:40 -0800)
v2: Instead of telling the driver that the window system ancillaries have
    been invalidated (when the driver doesn't know which of its buffers
    are the window system's!), introduce a method for invalidating
    specific surfaces.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/include/pipe/p_context.h
src/gallium/state_trackers/dri/dri_drawable.c

index af5674ff7535976e6bc78cb345ef2cd716daf04a..a4cae8eaf63170c5fc6491b5dcb8a0adf9384d2d 100644 (file)
@@ -551,6 +551,17 @@ struct pipe_context {
     */
    void (*flush_resource)(struct pipe_context *ctx,
                           struct pipe_resource *resource);
+
+   /**
+    * Invalidate the contents of the resource.
+    *
+    * This is used to implement EGL's semantic of undefined depth/stencil
+    * contenst after a swapbuffers.  This allows a tiled renderer (for
+    * example) to not store the depth buffer.
+    */
+   void (*invalidate_resource)(struct pipe_context *ctx,
+                               struct pipe_resource *resource);
+
 };
 
 
index b7df053594cb5e3d9d9fd38eb1b6d303edb180e4..eda2d5232c5b32d482fc5d06a7ba936207c2b4b6 100644 (file)
@@ -484,6 +484,12 @@ dri_flush(__DRIcontext *cPriv,
       }
 
       pipe->flush_resource(pipe, drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
+
+      if (pipe->invalidate_resource &&
+          (flags & __DRI2_FLUSH_INVALIDATE_ANCILLARY)) {
+         pipe->invalidate_resource(pipe, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
+         pipe->invalidate_resource(pipe, drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL]);
+      }
    }
 
    flush_flags = 0;