summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/framebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/framebuffer.c')
-rw-r--r--src/mesa/main/framebuffer.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 1fd31a53211..c9b30d32528 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -65,7 +65,9 @@ compute_depth_max(struct gl_framebuffer *fb)
fb->_DepthMax = 0xffffffff;
}
fb->_DepthMaxF = (GLfloat) fb->_DepthMax;
- fb->_MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */
+
+ /* Minimum resolvable depth value, for polygon offset */
+ fb->_MRD = 1.0 / fb->_DepthMaxF;
}
@@ -652,6 +654,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:
@@ -669,19 +692,11 @@ void
_mesa_update_framebuffer(GLcontext *ctx)
{
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);
- }
-
- 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)
+ update_framebuffer(ctx, fbread);
}