summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-11-05 09:59:34 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-11-05 09:59:34 -0700
commit74866737db739bef8b7593d5060e4f80d91ff33a (patch)
tree23c55c30616517fb5e0d3b8145a6fbffec485d88
parent9fc03fed01e3988f6cf07bb9c041328232b7bacf (diff)
added st_notify_swapbuffers()
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c17
-rw-r--r--src/mesa/state_tracker/st_public.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 326773c505..2e7687d9c9 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -132,3 +132,20 @@ st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex)
return strb->surface;
return NULL;
}
+
+
+/**
+ * This function is to be called prior to SwapBuffers on the given
+ * framebuffer. It checks if the current context is bound to the framebuffer
+ * and flushes rendering if needed.
+ */
+void
+st_notify_swapbuffers(struct st_framebuffer *stfb)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx && ctx->DrawBuffer == &stfb->Base) {
+ st_flush(ctx->st);
+ }
+}
+
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index acbf54d5ab..8162ceeffa 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -71,4 +71,6 @@ void st_invalidate_state(GLcontext * ctx, GLuint new_state);
void st_flush( struct st_context *st );
+void st_notify_swapbuffers(struct st_framebuffer *stfb);
+
#endif