driver->GetString = NULL; /* REQUIRED! */
driver->UpdateState = NULL; /* REQUIRED! */
- driver->GetBufferSize = NULL; /* REQUIRED! */
driver->ResizeBuffers = _mesa_resize_framebuffer;
driver->Finish = NULL;
*/
static void r200InitDriverFuncs( struct dd_function_table *functions )
{
- functions->GetBufferSize = NULL; /* OBSOLETE */
functions->GetString = r200GetString;
}
{
driver->GetString = get_string;
driver->UpdateState = update_state;
- driver->GetBufferSize = NULL;
driver->Viewport = viewport;
driver->ChooseTextureFormat = swrastChooseTextureFormat;
driver->MapRenderbuffer = swrast_map_renderbuffer;
/* override with our functions */
functions.GetString = get_string;
functions.UpdateState = osmesa_update_state;
- functions.GetBufferSize = NULL;
if (!_mesa_initialize_context(&osmesa->mesa,
API_OPENGL_COMPAT,
_mesa_init_driver_functions(&functions);
functions.GetString = wmesa_get_string;
functions.UpdateState = wmesa_update_state;
- functions.GetBufferSize = wmesa_get_buffer_size;
functions.Flush = wmesa_flush;
functions.Clear = clear;
functions.ResizeBuffers = wmesa_resize_buffers;
{
driver->GetString = get_string;
driver->UpdateState = xmesa_update_state;
- driver->GetBufferSize = NULL; /* OBSOLETE */
driver->Flush = finish_or_flush;
driver->Finish = finish_or_flush;
driver->ColorMask = color_mask;
}
-/**
- * Do one-time initialization for the given framebuffer. Specifically,
- * ask the driver for the window's current size and update the framebuffer
- * object to match.
- * Really, the device driver should totally take care of this.
- */
-static void
-initialize_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb)
-{
- GLuint width, height;
- if (ctx->Driver.GetBufferSize) {
- ctx->Driver.GetBufferSize(fb, &width, &height);
- if (ctx->Driver.ResizeBuffers)
- ctx->Driver.ResizeBuffers(ctx, fb, width, height);
- fb->Initialized = GL_TRUE;
- }
-}
-
-
/**
* Check if the viewport/scissor size has not yet been initialized.
* Initialize the size if the given width and height are non-zero.
*/
newCtx->NewState |= _NEW_BUFFERS;
-#if 1
- /* We want to get rid of these lines: */
- if (!drawBuffer->Initialized) {
- initialize_framebuffer_size(newCtx, drawBuffer);
- }
- if (readBuffer != drawBuffer && !readBuffer->Initialized) {
- initialize_framebuffer_size(newCtx, readBuffer);
- }
-
- _mesa_resizebuffers(newCtx);
-#else
- /* We want the drawBuffer and readBuffer to be initialized by
- * the driver.
- * This generally means the Width and Height match the actual
- * window size and the renderbuffers (both hardware and software
- * based) are allocated to match. The later can generally be
- * done with a call to _mesa_resize_framebuffer().
- *
- * It's theoretically possible for a buffer to have zero width
- * or height, but for now, assert check that the driver did what's
- * expected of it.
- */
- ASSERT(drawBuffer->Width > 0);
- ASSERT(drawBuffer->Height > 0);
-#endif
-
if (drawBuffer) {
_mesa_check_init_viewport(newCtx,
drawBuffer->Width, drawBuffer->Height);
*/
void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state );
- /**
- * Get the width and height of the named buffer/window.
- *
- * Mesa uses this to determine when the driver's window size has changed.
- * XXX OBSOLETE: this function will be removed in the future.
- */
- void (*GetBufferSize)( struct gl_framebuffer *buffer,
- GLuint *width, GLuint *height );
-
/**
* Resize the given framebuffer to the given size.
* XXX OBSOLETE: this function will be removed in the future.
}
}
-
-
-/**
- * XXX THIS IS OBSOLETE - drivers should take care of detecting window
- * size changes and act accordingly, likely calling _mesa_resize_framebuffer().
- *
- * GL_MESA_resize_buffers extension.
- *
- * When this function is called, we'll ask the window system how large
- * the current window is. If it's a new size, we'll call the driver's
- * ResizeBuffers function. The driver will then resize its color buffers
- * as needed, and maybe call the swrast's routine for reallocating
- * swrast-managed depth/stencil/accum/etc buffers.
- * \note This function should only be called through the GL API, not
- * from device drivers (as was done in the past).
- */
-void
-_mesa_resizebuffers( struct gl_context *ctx )
-{
- FLUSH_VERTICES(ctx, 0);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glResizeBuffersMESA\n");
-
- if (!ctx->Driver.GetBufferSize) {
- return;
- }
-
- if (ctx->WinSysDrawBuffer) {
- GLuint newWidth, newHeight;
- struct gl_framebuffer *buffer = ctx->WinSysDrawBuffer;
-
- assert(_mesa_is_winsys_fbo(buffer));
-
- /* ask device driver for size of output buffer */
- ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
-
- /* see if size of device driver's color buffer (window) has changed */
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- if (ctx->Driver.ResizeBuffers)
- ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
- }
- }
-
- if (ctx->WinSysReadBuffer
- && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) {
- GLuint newWidth, newHeight;
- struct gl_framebuffer *buffer = ctx->WinSysReadBuffer;
-
- assert(_mesa_is_winsys_fbo(buffer));
-
- /* ask device driver for size of read buffer */
- ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
-
- /* see if size of device driver's color buffer (window) has changed */
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- if (ctx->Driver.ResizeBuffers)
- ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
- }
- }
-
- ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
-}
-
-
/*
* XXX THIS IS OBSOLETE
*/
void GLAPIENTRY
_mesa_ResizeBuffersMESA( void )
{
- GET_CURRENT_CONTEXT(ctx);
-
- if (ctx->Extensions.MESA_resize_buffers)
- _mesa_resizebuffers( ctx );
}