summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-03-16 00:53:15 +0000
committerBrian Paul <[email protected]>2002-03-16 00:53:15 +0000
commit18a285a5e244b7405b85feb7315a30d99920ec5d (patch)
tree02fbfa95292ef56eef26bb2e8456f65cf1348f18 /src/mesa/main
parent8d687e7e58a148f3f16573636023e54755372010 (diff)
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().
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/buffers.c56
-rw-r--r--src/mesa/main/context.c5
-rw-r--r--src/mesa/main/mtypes.h4
3 files changed, 47 insertions, 18 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index b4feb219fbf..be793417d48 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -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;
+
+ /* ask device driver for size of output buffer */
+ (*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
- ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
+ /* 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 );
+ }
- /* save buffer size */
- ctx->DrawBuffer->Width = buf_width;
- ctx->DrawBuffer->Height = buf_height;
+ if (ctx->ReadBuffer && ctx->ReadBuffer != ctx->DrawBuffer) {
+ GLuint buf_width, buf_height;
+ GLframebuffer *buffer = ctx->DrawBuffer;
- ctx->Driver.ResizeBuffersMESA( ctx );
+ /* 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 */
+ }
}
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 18477f32771..5ed31a18bc0 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.155 2002/03/13 04:33:32 brianp Exp $ */
+/* $Id: context.c,v 1.156 2002/03/16 00:53:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -2084,6 +2084,9 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *where )
fprintf(stderr, "Mesa user error: %s in %s\n", errstr, where);
}
+ if (!ctx)
+ return;
+
if (ctx->ErrorValue == GL_NO_ERROR) {
ctx->ErrorValue = error;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index efa26afe8b1..807a7b24ccd 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.66 2002/03/13 04:33:16 brianp Exp $ */
+/* $Id: mtypes.h,v 1.67 2002/03/16 00:53:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1312,7 +1312,7 @@ struct gl_shared_state {
struct gl_frame_buffer {
GLvisual Visual; /* The corresponding visual */
- GLint Width, Height; /* size of frame buffer in pixels */
+ GLuint Width, Height; /* size of frame buffer in pixels */
GLboolean UseSoftwareDepthBuffer;
GLboolean UseSoftwareAccumBuffer;