summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_framebuffer.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-05-01 16:44:04 -0600
committerBrian Paul <[email protected]>2009-05-01 16:44:04 -0600
commit602833b107cdf3d70117dbd0970c7d574fb55f3b (patch)
tree05452b4845ac756558b3819e77a474359f1d4ee2 /src/mesa/state_tracker/st_framebuffer.c
parentb57b6c2d2c83aee96f945ce3385a1ab8337335cb (diff)
st: if st_swapbuffers() is called for single-buffered visual don't crash
Furthermore, return pointer(s) to the front color buffer(s).
Diffstat (limited to 'src/mesa/state_tracker/st_framebuffer.c')
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 639373fff7e..ef800291ccd 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -297,7 +297,10 @@ st_notify_swapbuffers(struct st_framebuffer *stfb)
* Swap the front/back color buffers. Exchange the front/back pointers
* and update some derived state.
* No need to call st_notify_swapbuffers() first.
- * This is effectively a no-op for single-buffered framebuffers.
+ *
+ * For a single-buffered framebuffer, no swap occurs, but we still return
+ * the pointer(s) to the front color buffer(s).
+ *
* \param front_left returns pointer to front-left renderbuffer after swap
* \param front_right returns pointer to front-right renderbuffer after swap
*/
@@ -318,6 +321,21 @@ st_swapbuffers(struct st_framebuffer *stfb,
NULL );
}
+ if (!fb->Visual.doubleBufferMode) {
+ /* single buffer mode - return pointers to front surfaces */
+ if (front_left) {
+ struct st_renderbuffer *strb =
+ st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
+ *front_left = strb->surface;
+ }
+ if (front_right) {
+ struct st_renderbuffer *strb =
+ st_renderbuffer(fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer);
+ *front_right = strb ? strb->surface : NULL;
+ }
+ return;
+ }
+
/* swap left buffers */
if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer &&
fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer) {