From d689cd0715b3d4e05a76597ad066c27248fca565 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Mar 2006 22:05:26 +0000 Subject: [PATCH] need to resize the depth/stencil wrappers, if present, in _mesa_resize_framebuffer() --- src/mesa/main/framebuffer.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 3da71fccf0e..e64adac275d 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -253,6 +253,10 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, { GLuint i; + /* XXX I think we could check if the size is not changing + * and return early. + */ + /* For window system framebuffers, Name is zero */ assert(fb->Name == 0); @@ -264,22 +268,40 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, if (rb->Width != width || rb->Height != height) { /* could just as well pass rb->_ActualFormat here */ if (rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height)) { - rb->Width = width; - rb->Height = height; + ASSERT(rb->Width == width); + ASSERT(rb->Height == height); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Resizing framebuffer"); + /* no return */ } } } } + if (fb->_DepthBuffer) { + struct gl_renderbuffer *rb = fb->_DepthBuffer; + if (rb->Width != width || rb->Height != height) { + if (!rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height)) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "Resizing framebuffer"); + } + } + } + + if (fb->_StencilBuffer) { + struct gl_renderbuffer *rb = fb->_StencilBuffer; + if (rb->Width != width || rb->Height != height) { + if (!rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height)) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "Resizing framebuffer"); + } + } + } + fb->Width = width; fb->Height = height; /* to update scissor / window bounds */ - if (ctx) - ctx->NewState |= _NEW_BUFFERS; + _mesa_update_draw_buffer_bounds(ctx); }