On 05/01/15 00:05, Eric Anholt wrote:
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.
Thanks, much better.
We'll need means to invalidate a subset of the resource as explained in
http://lists.freedesktop.org/archives/mesa-dev/2014-December/073396.html
so I thought that pipe_surface would be better than pipe_resource.
On the other hand, it might be even better to pass
first_level/last_level/ first_layer/last_layer as structure pointer
parameter, instead of requiring actual views. Which can be done later,
so I suppose this is fine like this.
Reviewed-by: Jose Fonseca <jfons...@vmware.com>
Jose
---
src/gallium/include/pipe/p_context.h | 11 +++++++++++
src/gallium/state_trackers/dri/dri_drawable.c | 6 ++++++
2 files changed, 17 insertions(+)
diff --git a/src/gallium/include/pipe/p_context.h
b/src/gallium/include/pipe/p_context.h
index af5674f..a4cae8e 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -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);
+
};
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c
b/src/gallium/state_trackers/dri/dri_drawable.c
index b7df053..eda2d52 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -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;
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev