From: Brian Paul Date: Sun, 15 Oct 2006 18:51:22 +0000 (+0000) Subject: Remove calls to _mesa_ResizeBuffersMESA() - generally replace with code to X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7a26503b67b8baa9df8b2bb194435d681559550;p=mesa.git Remove calls to _mesa_ResizeBuffersMESA() - generally replace with code to check the current window size, then call _mesa_resize_framebuffer(). --- diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c index cb46efa56ac..594668affda 100644 --- a/src/mesa/drivers/allegro/amesa.c +++ b/src/mesa/drivers/allegro/amesa.c @@ -145,10 +145,20 @@ static void get_buffer_size(GLcontext *ctx, GLuint *width, GLuint *height) } +/** + * We only implement this function as a mechanism to check if the + * framebuffer size has changed (and update corresponding state). + */ 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(); + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysDrawBuffer; + get_buffer_size( &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } + } diff --git a/src/mesa/drivers/directfb/idirectfbgl_mesa.c b/src/mesa/drivers/directfb/idirectfbgl_mesa.c index d11241b2b21..3c2a77b5bc4 100644 --- a/src/mesa/drivers/directfb/idirectfbgl_mesa.c +++ b/src/mesa/drivers/directfb/idirectfbgl_mesa.c @@ -214,7 +214,8 @@ IDirectFBGL_Mesa_Lock( IDirectFBGL *thiz ) if (data->width != width || data->height != height) { data->width = width; data->height = height; - _mesa_ResizeBuffersMESA(); + _mesa_resize_framebuffer(&data->context, + &data->framebuffer, width, height); } data->locked = DFB_TRUE; @@ -355,10 +356,19 @@ dfbGetBufferSize( GLframebuffer *buffer, GLuint *width, GLuint *height ) *height = (GLuint) data->height; } +/** + * We only implement this function as a mechanism to check if the + * framebuffer size has changed (and update corresponding state). + */ static void dfbSetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { - _mesa_ResizeBuffersMESA(); + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysDrawBuffer; + dfbGetBufferSize( buffer, &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } } static void diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index 3a6b452065b..bd9d3ac0ad9 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -157,11 +157,27 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) } +/** + * We only implement this function as a mechanism to check if the + * framebuffer size has changed (and update corresponding state). + */ 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(); + GLuint newWidth, newHeight; + GLframebuffer *buffer; + + buffer = ctx->WinSysDrawBuffer; + get_buffer_size( buffer, &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } + + buffer = ctx->WinSysReadBuffer; + get_buffer_size( buffer, &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } } diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c index 64312204c54..4fbbe61ab84 100644 --- a/src/mesa/drivers/ggi/ggimesa.c +++ b/src/mesa/drivers/ggi/ggimesa.c @@ -257,10 +257,18 @@ static void gl_ggiGetSize(GLframebuffer *fb, GLuint *width, GLuint *height) printf("returning %d, %d\n", *width, *height); } +/** + * We only implement this function as a mechanism to check if the + * framebuffer size has changed (and update corresponding state). + */ static void gl_ggiViewport(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(); + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysDrawBuffer; + gl_ggiGetSize( buffer, &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } } diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 1614a7a43a7..0ee0e0cae00 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -123,11 +123,19 @@ fxDDGetBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) } +/** + * We only implement this function as a mechanism to check if the + * framebuffer size has changed (and update corresponding state). + */ static void fxDDViewport(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(); + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysDrawBuffer; + fxDDGetBufferSize( buffer, &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } } diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 09330e78ab5..0dd9a144fe8 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa.c,v 1.26 2005/09/07 23:26:01 brianp Exp $ */ +/* $Id: svgamesa.c,v 1.27 2006/10/15 18:51:22 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -213,10 +213,18 @@ static void get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *heigh *height = SVGAMesa->height = vga_getydim(); } +/** + * We only implement this function as a mechanism to check if the + * framebuffer size has changed (and update corresponding state). + */ 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(); + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysDrawBuffer; + get_buffer_size( buffer, &newWidth, &newHeight ); + if (buffer->Width != newWidth || buffer->Height != newHeight) { + _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); + } } static void set_buffer( GLcontext *ctx, GLframebuffer *colorBuffer,