summaryrefslogtreecommitdiff
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.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 4d6871bb7d0..d0dbbbad02b 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -328,7 +328,8 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
fb->Height = height;
/* to update scissor / window bounds */
- _mesa_update_draw_buffer_bounds(ctx);
+ if (ctx)
+ _mesa_update_draw_buffer_bounds(ctx);
}
@@ -381,6 +382,9 @@ _mesa_update_draw_buffer_bounds(GLcontext *ctx)
{
struct gl_framebuffer *buffer = ctx->DrawBuffer;
+ if (!buffer)
+ return;
+
if (buffer->Name) {
/* user-created framebuffer size depends on the renderbuffers */
update_framebuffer_size(buffer);
@@ -423,7 +427,8 @@ _mesa_update_draw_buffer_bounds(GLcontext *ctx)
* etc. are satisfied by the fields of ctx->DrawBuffer->Visual. These can
* change depending on the renderbuffer bindings. This function updates
* the given framebuffer's Visual from the current renderbuffer bindings.
- * This is only intended for user-created framebuffers.
+ *
+ * This may apply to user-created framebuffers or window system framebuffers.
*
* Also note: ctx->DrawBuffer->Visual.depthBits might not equal
* ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer.DepthBits.
@@ -479,6 +484,18 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
= fb->Attachment[BUFFER_STENCIL].Renderbuffer->StencilBits;
}
+ if (fb->Attachment[BUFFER_ACCUM].Renderbuffer) {
+ fb->Visual.haveAccumBuffer = GL_TRUE;
+ fb->Visual.accumRedBits
+ = fb->Attachment[BUFFER_DEPTH].Renderbuffer->RedBits;
+ fb->Visual.accumGreenBits
+ = fb->Attachment[BUFFER_DEPTH].Renderbuffer->GreenBits;
+ fb->Visual.accumBlueBits
+ = fb->Attachment[BUFFER_DEPTH].Renderbuffer->BlueBits;
+ fb->Visual.accumAlphaBits
+ = fb->Attachment[BUFFER_DEPTH].Renderbuffer->AlphaBits;
+ }
+
compute_depth_max(fb);
}