Lots of changes related to framebuffer/window buffer resizing. Basically,

instead of passing a GLcontext* to ResizeBuffers(), pass a GLframebuffer*.
The idea is that a window can be resized without it being bound to a rendering
context.  This makes for a nice clean-up in the XFree86 server-side GLX code.
Renamed ctx->Driver.ResizeBuffersMESA() to ctx->Driver.ResizeBuffers().
This commit is contained in:
Brian Paul
2002-03-16 00:53:15 +00:00
parent 8d687e7e58
commit 18a285a5e2
21 changed files with 301 additions and 260 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: buffers.c,v 1.32 2002/02/15 16:25:16 brianp Exp $ */
/* $Id: buffers.c,v 1.33 2002/03/16 00:53:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -350,33 +350,59 @@ _mesa_ReadBuffer( GLenum mode )
/*
* GL_MESA_resize_buffers extension
* When this function is called, we'll ask the window system how large
* the current window is. If it's not what we expect, we'll have to
* resize/reallocate the software accum/stencil/depth/alpha buffers.
*/
void
_mesa_ResizeBuffersMESA( void )
{
GLcontext *ctx = _mesa_get_current_context();
GLuint buf_width, buf_height;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glResizeBuffersMESA\n");
/* ask device driver for size of output buffer */
(*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );
if (ctx) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
/* see if size of device driver's color buffer (window) has changed */
if (ctx->DrawBuffer->Width == (GLint) buf_width &&
ctx->DrawBuffer->Height == (GLint) buf_height)
return;
if (ctx->DrawBuffer) {
GLuint buf_width, buf_height;
GLframebuffer *buffer = ctx->DrawBuffer;
ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
/* ask device driver for size of output buffer */
(*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
/* save buffer size */
ctx->DrawBuffer->Width = buf_width;
ctx->DrawBuffer->Height = buf_height;
/* see if size of device driver's color buffer (window) has changed */
if (buffer->Width == (GLint) buf_width &&
buffer->Height == (GLint) buf_height)
return; /* size is as expected */
ctx->Driver.ResizeBuffersMESA( ctx );
buffer->Width = buf_width;
buffer->Height = buf_height;
ctx->Driver.ResizeBuffers( buffer );
}
if (ctx->ReadBuffer && ctx->ReadBuffer != ctx->DrawBuffer) {
GLuint buf_width, buf_height;
GLframebuffer *buffer = ctx->DrawBuffer;
/* ask device driver for size of output buffer */
(*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
/* see if size of device driver's color buffer (window) has changed */
if (buffer->Width == (GLint) buf_width &&
buffer->Height == (GLint) buf_height)
return; /* size is as expected */
buffer->Width = buf_width;
buffer->Height = buf_height;
ctx->Driver.ResizeBuffers( buffer );
}
ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
}
}