From 65a66f5bc37383c00423c21baf8ba9d6771e0259 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 27 Nov 2004 22:47:59 +0000 Subject: Remove _mesa_ResizeBuffersMESA() call from _mesa_set_viewport(). Now, the driver's Viewport routine should call _mesa_ResizeBuffersMESA() if necessary. Cleaned up code related to GLframebuffer width/height initialization. Set initial viewport/scissor params in _mesa_make_current2(), instead of in the drivers' MakeCurrent functions. --- src/mesa/drivers/x11/xm_dd.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/mesa/drivers/x11') diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index d8f3e22cfc..4afc81484a 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -25,6 +25,7 @@ #include "glxheader.h" #include "bufferobj.h" +#include "buffers.h" #include "context.h" #include "colormac.h" #include "depth.h" @@ -1202,6 +1203,23 @@ choose_tex_format( GLcontext *ctx, GLint internalFormat, } +/** + * Called by glViewport. + * This is a good time for us to poll the current X window size and adjust + * our ancillary (back color, depth, stencil, etc) buffers to match the + * current window size. Remember, we have no opportunity to respond to + * conventional X Resize/StructureNotify events since the X driver has no + * event loop. Thus, we poll. + * Note that this trick isn't fool-proof. If the application never calls + * glViewport, our notion of the current window size may be incorrect. + */ +static void +xmesa_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + _mesa_ResizeBuffersMESA(); +} + + /** * Initialize the device driver function table with the functions * we implement in this driver. @@ -1222,6 +1240,7 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, driver->Enable = enable; driver->Clear = clear_buffers; driver->ResizeBuffers = xmesa_resize_buffers; + driver->Viewport = xmesa_viewport; #ifndef XFree86Server driver->CopyPixels = xmesa_CopyPixels; if (xmvisual->undithered_pf == PF_8R8G8B && -- cgit v1.2.3