summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/common
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-09-01 20:11:32 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-09-01 20:11:32 +0000
commit238de2db120bb090a7f28a25093874b32a90c546 (patch)
tree0fc957a6d128fdf49fd064f68d84201d01fca93d /src/mesa/drivers/dri/common
parentda84f0b642a65614c2618121869d5cd45ad986f5 (diff)
added driFlipRenderbuffers()
Diffstat (limited to 'src/mesa/drivers/dri/common')
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.c32
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.h4
2 files changed, 35 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
index 201ce44950..45c81e293c 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -100,3 +100,35 @@ driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch)
}
return drb;
}
+
+
+/**
+ * Update the front and back renderbuffers' flippedPitch/Offset fields.
+ * This is used when we do double buffering via page flipping.
+ */
+void
+driFlipRenderbuffers(struct gl_framebuffer *fb, GLenum flipped)
+{
+ driRenderbuffer *front_drb
+ = (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
+ driRenderbuffer *back_drb
+ = (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
+
+ /* If this fails, it means we're trying to do page flipping for a
+ * single-buffered window!
+ */
+ assert(back_drb);
+
+ if (flipped) {
+ front_drb->flippedOffset = back_drb->offset;
+ front_drb->flippedPitch = back_drb->pitch;
+ back_drb->flippedOffset = front_drb->offset;
+ back_drb->flippedPitch = front_drb->pitch;
+ }
+ else {
+ front_drb->flippedOffset = front_drb->offset;
+ front_drb->flippedPitch = front_drb->pitch;
+ back_drb->flippedOffset = back_drb->offset;
+ back_drb->flippedPitch = back_drb->pitch;
+ }
+}
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h
index b2b6fea12c..67affa06e1 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.h
@@ -46,8 +46,10 @@ typedef struct {
} driRenderbuffer;
-driRenderbuffer *
+extern driRenderbuffer *
driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch);
+extern void
+driFlipRenderbuffers(struct gl_framebuffer *fb, GLenum flipped);
#endif /* DRIRENDERBUFFER_H */