summaryrefslogtreecommitdiff
path: root/src/mesa/main/framebuffer.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-08-16 18:52:48 +0100
committerBrian <brian.paul@tungstengraphics.com>2007-08-16 18:52:48 +0100
commit32d86eb28aedd01a03ceab746214a8db2a4cbbab (patch)
tree2a6beb7c18ca16070f1e7ed01a89b590c623a92a /src/mesa/main/framebuffer.c
parentc033ccc36d08c669dcdfbfc1cf89e472e8211c5f (diff)
Rework the GL_READ_BUFFER, GL_DRAW_BUFFER state repairs that Roland previously did.
Basically, in update_framebuffer() (which should be called after an FBO is bound with MakeCurrent or BindFramebuffer) we check if the FBO is a window-system FBO. If it is, update the FBO's GL_READ/DRAW_BUFFER state according to the context state. Old code still in place but disabled with #if 0 / #endif.
Diffstat (limited to 'src/mesa/main/framebuffer.c')
-rw-r--r--src/mesa/main/framebuffer.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 72d85f6f89..3e36197d88 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -32,6 +32,7 @@
#include "glheader.h"
#include "imports.h"
+#include "buffers.h"
#include "context.h"
#include "depthstencil.h"
#include "mtypes.h"
@@ -583,7 +584,7 @@ _mesa_update_stencil_buffer(GLcontext *ctx,
/**
- * Update the list of color drawing renderbuffer pointers.
+ * Update the (derived) list of color drawing renderbuffer pointers.
* Later, when we're rendering we'll loop from 0 to _NumColorDrawBuffers
* writing colors.
*/
@@ -627,7 +628,7 @@ update_color_draw_buffers(GLcontext *ctx, struct gl_framebuffer *fb)
/**
- * Update the color read renderbuffer pointer.
+ * Update the (derived) color read renderbuffer pointer.
* Unlike the DrawBuffer, we can only read from one (or zero) color buffers.
*/
static void
@@ -668,10 +669,23 @@ update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
static void
update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
{
- /* Completeness only matters for user-created framebuffers */
- if (fb->Name != 0) {
- /* XXX: EXT_framebuffer_blit:
- framebuffer must still be complete wrt read/draw? */
+ if (fb->Name == 0) {
+ /* This is a window-system framebuffer */
+ /* Need to update the FB's GL_DRAW_BUFFER state to match the
+ * context state (GL_READ_BUFFER too).
+ */
+ if (fb->ColorDrawBuffer[0] != ctx->Color.DrawBuffer[0]) {
+ _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers,
+ ctx->Color.DrawBuffer, NULL);
+ }
+ if (fb->ColorReadBuffer != ctx->Pixel.ReadBuffer) {
+
+ }
+ }
+ else {
+ /* This is a user-created framebuffer.
+ * Completeness only matters for user-created framebuffers.
+ */
_mesa_test_framebuffer_completeness(ctx, fb);
_mesa_update_framebuffer_visual(fb);
}