summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@tungstengraphics.com>2007-07-17 19:22:23 +0200
committerRoland Scheidegger <sroland@tungstengraphics.com>2007-07-17 19:22:23 +0200
commita8bf93e00e28031d7e2444f79df2686f262b4420 (patch)
tree8c2ef215cfaee351f22b9bf698a9babc49d36a42
parentd9499a151df85fef6bb6f31b58657e44cadba50a (diff)
fix up mesa's probably bogus framebuffer updates with different read/write fbs
-rw-r--r--src/mesa/main/framebuffer.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index a95e44c513..f8716f30d3 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -652,6 +652,27 @@ 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? */
+ _mesa_test_framebuffer_completeness(ctx, fb);
+ _mesa_update_framebuffer_visual(fb);
+ }
+
+ /* update_color_draw/read_buffers not needed for
+ read/draw only fb, but shouldn't hurt ??? */
+ update_color_draw_buffers(ctx, fb);
+ update_color_read_buffer(ctx, fb);
+ _mesa_update_depth_buffer(ctx, fb, BUFFER_DEPTH);
+ _mesa_update_stencil_buffer(ctx, fb, BUFFER_STENCIL);
+
+ compute_depth_max(fb);
+}
+
/**
* Update state related to the current draw/read framebuffers.
* Specifically, update these framebuffer fields:
@@ -668,22 +689,13 @@ update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
void
_mesa_update_framebuffer(GLcontext *ctx)
{
- /* XXX might not be quite correct for different draw/read buffers ? */
struct gl_framebuffer *fb = ctx->DrawBuffer;
-// struct gl_framebuffer *fbread = ctx->ReadBuffer;
-
- /* Completeness only matters for user-created framebuffers */
- if (fb->Name != 0) {
- _mesa_test_framebuffer_completeness(ctx, fb);
- _mesa_update_framebuffer_visual(fb);
- }
+ struct gl_framebuffer *fbread = ctx->ReadBuffer;
- update_color_draw_buffers(ctx, fb);
- update_color_read_buffer(ctx, fb);
- _mesa_update_depth_buffer(ctx, fb, BUFFER_DEPTH);
- _mesa_update_stencil_buffer(ctx, fb, BUFFER_STENCIL);
-
- compute_depth_max(fb);
+ update_framebuffer(ctx, fb);
+ if (fbread != fb && fbread != NULL /* can happen at make_current -
+ core/driver circular dependencies, should be fixed up */)
+ update_framebuffer(ctx, fbread);
}