aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/buffers.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/buffers.c')
-rw-r--r--mesalib/src/mesa/main/buffers.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index 63f53e2b0..a75c9c2e7 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -462,6 +462,27 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
/**
+ * Update the current drawbuffer's _ColorDrawBufferIndex[] list, etc.
+ * from the context's Color.DrawBuffer[] state.
+ * Use when changing contexts.
+ */
+void
+_mesa_update_draw_buffers(struct gl_context *ctx)
+{
+ GLenum buffers[MAX_DRAW_BUFFERS];
+ GLuint i;
+
+ /* should be a window system FBO */
+ assert(ctx->DrawBuffer->Name == 0);
+
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++)
+ buffers[i] = ctx->Color.DrawBuffer[i];
+
+ _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, buffers, NULL);
+}
+
+
+/**
* Like \sa _mesa_drawbuffers(), this is a helper function for setting
* GL_READ_BUFFER state in the context and current FBO.
* \param ctx the rendering context