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/dri/fb/fb_dri.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/mesa/drivers/dri/fb') diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index 49ae5c98e8..16540ed051 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -63,6 +63,7 @@ #include "miniglxP.h" /* window-system-specific */ #include "dri_util.h" /* window-system-specific-ish */ +#include "buffers.h" #include "context.h" #include "extensions.h" #include "imports.h" @@ -133,6 +134,13 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) } +static void +viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + _mesa_ResizeBuffersMESA(); +} + + /* specifies the buffer for swrast span rendering/reading */ static void set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit ) @@ -166,6 +174,7 @@ init_core_functions( struct dd_function_table *functions ) functions->UpdateState = update_state; functions->ResizeBuffers = _swrast_alloc_buffers; functions->GetBufferSize = get_buffer_size; + functions->Viewport = viewport; functions->Clear = _swrast_Clear; /* could accelerate with blits */ } @@ -536,11 +545,6 @@ fbMakeCurrent( __DRIcontextPrivate *driContextPriv, _mesa_make_current2( newFbCtx->glCtx, (GLframebuffer *) driDrawPriv->driverPrivate, (GLframebuffer *) driReadPriv->driverPrivate ); - - if ( !newFbCtx->glCtx->Viewport.Width ) { - _mesa_set_viewport( newFbCtx->glCtx, 0, 0, - driDrawPriv->w, driDrawPriv->h ); - } } else { _mesa_make_current( 0, 0 ); } -- cgit v1.2.3