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/svga/svgamesa.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/svga/svgamesa.c') diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 5f636e14af..980daf30e9 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa.c,v 1.23 2002/11/11 18:42:38 brianp Exp $ */ +/* $Id: svgamesa.c,v 1.24 2004/11/27 22:48:00 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -39,6 +39,7 @@ #include #include #include "GL/svgamesa.h" +#include "buffers.h" #include "context.h" #include "extensions.h" #include "imports.h" @@ -212,6 +213,11 @@ static void get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *heigh *height = SVGAMesa->height = vga_getydim(); } +static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + /* poll for window size change and realloc software Z/stencil/etc if needed */ + _mesa_ResizeBuffersMESA(); +} static void set_buffer( GLcontext *ctx, GLframebuffer *colorBuffer, GLenum buffer ) @@ -258,6 +264,7 @@ static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.GetBufferSize = get_buffer_size; ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; + ctx->Driver.Viewport = viewport; /* Software rasterizer pixel paths: */ @@ -446,10 +453,8 @@ void SVGAMesaMakeCurrent( SVGAMesaContext ctx ) _mesa_make_current( ctx->gl_ctx, ctx->gl_buffer ); if (ctx->width==0 || ctx->height==0) { - /* setup initial viewport */ ctx->width = vga_getxdim(); ctx->height = vga_getydim(); - _mesa_set_viewport( ctx->gl_ctx, 0, 0, ctx->width, ctx->height ); } #endif } -- cgit v1.2.3