summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/x11
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-11-27 22:47:59 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-11-27 22:47:59 +0000
commit65a66f5bc37383c00423c21baf8ba9d6771e0259 (patch)
tree0d98e004b457adde579dd27b9fe32182d54268b6 /src/mesa/drivers/x11
parent118a8bad73bda88fc54f802b2beeb687c8ddb45a (diff)
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.
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r--src/mesa/drivers/x11/xm_dd.c19
1 files changed, 19 insertions, 0 deletions
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"
@@ -1203,6 +1204,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 &&