summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-05-31 22:48:48 +0200
committerMarek Olšák <[email protected]>2013-06-13 03:54:14 +0200
commit3b525036b94f041ebae192b9737b93c8c264befa (patch)
tree9d761332bd3db3b7f800f86b4b58a6427ba91ca5 /src/gallium
parentb77316ad7594fa5873717992b6986cb4c0179d23 (diff)
st/dri: manually swap MSAA front and back buffers in SwapBuffers
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_drawable.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
index ff04d57a258..1c2bad42cbe 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -414,6 +414,7 @@ dri_flush(__DRIcontext *cPriv,
struct dri_context *ctx = dri_context(cPriv);
struct dri_drawable *drawable = dri_drawable(dPriv);
unsigned flush_flags;
+ boolean swap_msaa_buffers = FALSE;
if (!ctx) {
assert(0);
@@ -440,6 +441,12 @@ dri_flush(__DRIcontext *cPriv,
drawable->textures[ST_ATTACHMENT_BACK_LEFT],
drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]);
+ if (reason == __DRI2_THROTTLE_SWAPBUFFER &&
+ drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT] &&
+ drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]) {
+ swap_msaa_buffers = TRUE;
+ }
+
/* FRONT_LEFT is resolved in drawable->flush_frontbuffer. */
}
@@ -494,6 +501,24 @@ dri_flush(__DRIcontext *cPriv,
if (drawable) {
drawable->flushing = FALSE;
}
+
+ /* Swap the MSAA front and back buffers, so that reading
+ * from the front buffer after SwapBuffers returns what was
+ * in the back buffer.
+ */
+ if (swap_msaa_buffers) {
+ struct pipe_resource *tmp =
+ drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT];
+
+ drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT] =
+ drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT];
+ drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT] = tmp;
+
+ /* Now that we have swapped the buffers, this tells the state
+ * tracker to revalidate the framebuffer.
+ */
+ p_atomic_inc(&drawable->base.stamp);
+ }
}
/**