Browse Source

need to resize the depth/stencil wrappers, if present, in _mesa_resize_framebuffer()

tags/texman_0_1_20060325
Brian Paul 20 years ago
parent
commit
d689cd0715
1 changed files with 26 additions and 4 deletions
  1. 26
    4
      src/mesa/main/framebuffer.c

+ 26
- 4
src/mesa/main/framebuffer.c View File

@@ -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);
}



Loading…
Cancel
Save