Lots of changes related to framebuffer/window buffer resizing. Basically,
instead of passing a GLcontext* to ResizeBuffers(), pass a GLframebuffer*. The idea is that a window can be resized without it being bound to a rendering context. This makes for a nice clean-up in the XFree86 server-side GLX code. Renamed ctx->Driver.ResizeBuffersMESA() to ctx->Driver.ResizeBuffers().
This commit is contained in:
parent
8d687e7e58
commit
18a285a5e2
|
@ -540,8 +540,13 @@ static GLboolean set_draw_buffer (GLcontext *ctx, GLenum mode)
|
||||||
* If anything special has to been done when the buffer/window is
|
* If anything special has to been done when the buffer/window is
|
||||||
* resized, do it now.
|
* resized, do it now.
|
||||||
*/
|
*/
|
||||||
static void get_buffer_size (GLcontext *ctx, GLuint *width, GLuint *height)
|
static void get_buffer_size (GLframebuffer *buffer, GLuint *width, GLuint *height)
|
||||||
{
|
{
|
||||||
|
/* XXX this may not be right. We should query the size of the DOS window
|
||||||
|
* associated with <buffer>. This function should work whether or
|
||||||
|
* not there is a current context.
|
||||||
|
*/
|
||||||
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
DMesaContext c = (DMesaContext)ctx->DriverCtx;
|
DMesaContext c = (DMesaContext)ctx->DriverCtx;
|
||||||
|
|
||||||
*width = c->Buffer->width;
|
*width = c->Buffer->width;
|
||||||
|
@ -636,7 +641,7 @@ void dmesa_init_pointers (GLcontext *ctx)
|
||||||
ctx->Driver.Accum = _swrast_Accum;
|
ctx->Driver.Accum = _swrast_Accum;
|
||||||
ctx->Driver.Bitmap = _swrast_Bitmap;
|
ctx->Driver.Bitmap = _swrast_Bitmap;
|
||||||
ctx->Driver.Clear = clear;
|
ctx->Driver.Clear = clear;
|
||||||
ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
|
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||||
ctx->Driver.CopyPixels = _swrast_CopyPixels;
|
ctx->Driver.CopyPixels = _swrast_CopyPixels;
|
||||||
ctx->Driver.DrawPixels = _swrast_DrawPixels;
|
ctx->Driver.DrawPixels = _swrast_DrawPixels;
|
||||||
ctx->Driver.ReadPixels = _swrast_ReadPixels;
|
ctx->Driver.ReadPixels = _swrast_ReadPixels;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: fxdd.c,v 1.84 2001/09/23 16:50:01 brianp Exp $ */
|
/* $Id: fxdd.c,v 1.85 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -103,19 +103,22 @@ fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
|
||||||
|
|
||||||
/* Return buffer size information */
|
/* Return buffer size information */
|
||||||
static void
|
static void
|
||||||
fxDDBufferSize(GLcontext * ctx, GLuint * width, GLuint * height)
|
fxDDBufferSize(GLframebuffer *buffer, GLuint * width, GLuint * height)
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
if (ctx && ctx->DriverCtx) {
|
||||||
|
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||||
|
|
||||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||||
fprintf(stderr, "fxmesa: fxDDBufferSize(...) Start\n");
|
fprintf(stderr, "fxmesa: fxDDBufferSize(...) Start\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
*width = fxMesa->width;
|
*width = fxMesa->width;
|
||||||
*height = fxMesa->height;
|
*height = fxMesa->height;
|
||||||
|
|
||||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||||
fprintf(stderr, "fxmesa: fxDDBufferSize(...) End\n");
|
fprintf(stderr, "fxmesa: fxDDBufferSize(...) End\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1002,7 +1005,7 @@ fxSetupDDPointers(GLcontext * ctx)
|
||||||
ctx->Driver.CopyPixels = _swrast_CopyPixels;
|
ctx->Driver.CopyPixels = _swrast_CopyPixels;
|
||||||
ctx->Driver.DrawPixels = _swrast_DrawPixels;
|
ctx->Driver.DrawPixels = _swrast_DrawPixels;
|
||||||
ctx->Driver.ReadPixels = fxDDReadPixels;
|
ctx->Driver.ReadPixels = fxDDReadPixels;
|
||||||
ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
|
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||||
ctx->Driver.Finish = fxDDFinish;
|
ctx->Driver.Finish = fxDDFinish;
|
||||||
ctx->Driver.Flush = NULL;
|
ctx->Driver.Flush = NULL;
|
||||||
ctx->Driver.ChooseTextureFormat = fxDDChooseTextureFormat;
|
ctx->Driver.ChooseTextureFormat = fxDDChooseTextureFormat;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: osmesa.c,v 1.74 2002/03/01 04:23:36 brianp Exp $ */
|
/* $Id: osmesa.c,v 1.75 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -875,11 +875,15 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
|
static void buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
|
||||||
{
|
{
|
||||||
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
*width = osmesa->width;
|
(void) buffer;
|
||||||
*height = osmesa->height;
|
if (ctx) {
|
||||||
|
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
|
||||||
|
*width = osmesa->width;
|
||||||
|
*height = osmesa->height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2023,7 +2027,7 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state )
|
||||||
ctx->Driver.GetString = get_string;
|
ctx->Driver.GetString = get_string;
|
||||||
ctx->Driver.UpdateState = osmesa_update_state;
|
ctx->Driver.UpdateState = osmesa_update_state;
|
||||||
ctx->Driver.SetDrawBuffer = set_draw_buffer;
|
ctx->Driver.SetDrawBuffer = set_draw_buffer;
|
||||||
ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
|
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||||
ctx->Driver.GetBufferSize = buffer_size;
|
ctx->Driver.GetBufferSize = buffer_size;
|
||||||
|
|
||||||
ctx->Driver.Accum = _swrast_Accum;
|
ctx->Driver.Accum = _swrast_Accum;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: svgamesa.c,v 1.16 2001/09/23 16:11:27 brianp Exp $ */
|
/* $Id: svgamesa.c,v 1.17 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -210,7 +210,7 @@ static void copy_buffer( const GLubyte * buffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
|
static void get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
|
||||||
{
|
{
|
||||||
*width = SVGAMesa->width = vga_getxdim();
|
*width = SVGAMesa->width = vga_getxdim();
|
||||||
*height = SVGAMesa->height = vga_getydim();
|
*height = SVGAMesa->height = vga_getydim();
|
||||||
|
@ -286,6 +286,7 @@ static void svgamesa_update_state( GLcontext *ctx, GLuint new_state )
|
||||||
|
|
||||||
ctx->Driver.GetBufferSize = get_buffer_size;
|
ctx->Driver.GetBufferSize = get_buffer_size;
|
||||||
ctx->Driver.SetDrawBuffer = set_draw_buffer;
|
ctx->Driver.SetDrawBuffer = set_draw_buffer;
|
||||||
|
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||||
|
|
||||||
/* Software rasterizer pixel paths:
|
/* Software rasterizer pixel paths:
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: wmesa.c,v 1.25 2002/01/16 15:42:17 kschultz Exp $ */
|
/* $Id: wmesa.c,v 1.26 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Windows (Win32) device driver for Mesa 3.4
|
* Windows (Win32) device driver for Mesa 3.4
|
||||||
|
@ -583,8 +583,9 @@ static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer,
|
||||||
|
|
||||||
|
|
||||||
/* Return characteristics of the output buffer. */
|
/* Return characteristics of the output buffer. */
|
||||||
static void buffer_size( GLcontext* ctx, GLuint *width, GLuint *height )
|
static void buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
|
||||||
{
|
{
|
||||||
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
int New_Size;
|
int New_Size;
|
||||||
RECT CR;
|
RECT CR;
|
||||||
|
|
||||||
|
@ -1021,7 +1022,7 @@ static void SetFunctionPointers(GLcontext *ctx)
|
||||||
ctx->Driver.GetString = get_string;
|
ctx->Driver.GetString = get_string;
|
||||||
ctx->Driver.UpdateState = wmesa_update_state;
|
ctx->Driver.UpdateState = wmesa_update_state;
|
||||||
ctx->Driver.SetDrawBuffer = set_draw_buffer;
|
ctx->Driver.SetDrawBuffer = set_draw_buffer;
|
||||||
ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
|
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||||
ctx->Driver.GetBufferSize = buffer_size;
|
ctx->Driver.GetBufferSize = buffer_size;
|
||||||
|
|
||||||
ctx->Driver.Accum = _swrast_Accum;
|
ctx->Driver.Accum = _swrast_Accum;
|
||||||
|
@ -1100,7 +1101,7 @@ static void wmesa_update_state( GLcontext *ctx, GLuint new_state )
|
||||||
ctx->Driver.GetString = get_string;
|
ctx->Driver.GetString = get_string;
|
||||||
ctx->Driver.UpdateState = wmesa_update_state;
|
ctx->Driver.UpdateState = wmesa_update_state;
|
||||||
ctx->Driver.SetDrawBuffer = set_draw_buffer;
|
ctx->Driver.SetDrawBuffer = set_draw_buffer;
|
||||||
ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
|
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||||
ctx->Driver.GetBufferSize = buffer_size;
|
ctx->Driver.GetBufferSize = buffer_size;
|
||||||
|
|
||||||
ctx->Driver.Accum = _swrast_Accum;
|
ctx->Driver.Accum = _swrast_Accum;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* $Id: xm_api.c,v 1.34 2002/03/12 21:55:50 brianp Exp $ */
|
/* $Id: xm_api.c,v 1.35 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 4.1
|
* Version: 4.0.2
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
|
@ -2329,9 +2329,8 @@ void XMesaSwapBuffers( XMesaBuffer b )
|
||||||
/* If we're swapping the buffer associated with the current context
|
/* If we're swapping the buffer associated with the current context
|
||||||
* we have to flush any pending rendering commands first.
|
* we have to flush any pending rendering commands first.
|
||||||
*/
|
*/
|
||||||
if (ctx && ctx->DrawBuffer == &(b->mesa_buffer)) {
|
if (ctx && ctx->DrawBuffer == &(b->mesa_buffer))
|
||||||
_mesa_swapbuffers(ctx);
|
_mesa_swapbuffers(ctx);
|
||||||
}
|
|
||||||
|
|
||||||
if (b->db_state) {
|
if (b->db_state) {
|
||||||
#ifdef FX
|
#ifdef FX
|
||||||
|
@ -2630,3 +2629,13 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is typically called when the window size changes and we need
|
||||||
|
* to reallocate the buffer's back/depth/stencil/accum buffers.
|
||||||
|
*/
|
||||||
|
void XMesaResizeBuffers( XMesaBuffer b )
|
||||||
|
{
|
||||||
|
xmesa_resize_buffers( &(b->mesa_buffer) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* $Id: xm_dd.c,v 1.29 2002/03/01 04:28:32 brianp Exp $ */
|
/* $Id: xm_dd.c,v 1.30 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 4.1
|
* Version: 4.0.2
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
|
@ -48,17 +48,18 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the size (width,height of the current color buffer.
|
* Return the size (width, height) of the X window for the given GLframebuffer.
|
||||||
* This function should be called by the glViewport function because
|
|
||||||
* glViewport is often called when the window gets resized. We need to
|
|
||||||
* update some X/Mesa stuff when that happens.
|
|
||||||
* Output: width - width of buffer in pixels.
|
* Output: width - width of buffer in pixels.
|
||||||
* height - height of buffer in pixels.
|
* height - height of buffer in pixels.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
get_buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
|
get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
|
||||||
{
|
{
|
||||||
const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
|
/* We can do this cast because the first field in the XMesaBuffer
|
||||||
|
* struct is a GLframebuffer struct. If this weren't true, we'd
|
||||||
|
* need a pointer from the GLframebuffer to the XMesaBuffer.
|
||||||
|
*/
|
||||||
|
const XMesaBuffer xmBuffer = (XMesaBuffer) buffer;
|
||||||
unsigned int winwidth, winheight;
|
unsigned int winwidth, winheight;
|
||||||
#ifndef XFree86Server
|
#ifndef XFree86Server
|
||||||
Window root;
|
Window root;
|
||||||
|
@ -66,58 +67,19 @@ get_buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
|
||||||
unsigned int bw, d;
|
unsigned int bw, d;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(_xmesa_lock);
|
_glthread_LOCK_MUTEX(_xmesa_lock);
|
||||||
XGetGeometry( xmesa->display, xmesa->xm_buffer->frontbuffer, &root,
|
XGetGeometry( xmBuffer->xm_visual->display, xmBuffer->frontbuffer, &root,
|
||||||
&winx, &winy, &winwidth, &winheight, &bw, &d );
|
&winx, &winy, &winwidth, &winheight, &bw, &d );
|
||||||
_glthread_UNLOCK_MUTEX(_xmesa_lock);
|
_glthread_UNLOCK_MUTEX(_xmesa_lock);
|
||||||
#else
|
#else
|
||||||
|
/* XFree86 GLX renderer */
|
||||||
winwidth = xmesa->xm_buffer->frontbuffer->width;
|
winwidth = xmBuffer->frontbuffer->width;
|
||||||
winheight = xmesa->xm_buffer->frontbuffer->height;
|
winheight = xmBuffer->frontbuffer->height;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void)kernel8; /* Muffle compiler */
|
(void)kernel8; /* Muffle compiler */
|
||||||
|
|
||||||
*width = winwidth;
|
*width = winwidth;
|
||||||
*height = winheight;
|
*height = winheight;
|
||||||
|
|
||||||
if ( winwidth!=xmesa->xm_buffer->width
|
|
||||||
|| winheight!=xmesa->xm_buffer->height) {
|
|
||||||
xmesa->xm_buffer->width = winwidth;
|
|
||||||
xmesa->xm_buffer->height = winheight;
|
|
||||||
xmesa_alloc_back_buffer( xmesa->xm_buffer );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Needed by FLIP macro */
|
|
||||||
xmesa->xm_buffer->bottom = (int) winheight - 1;
|
|
||||||
|
|
||||||
if (xmesa->xm_buffer->backimage) {
|
|
||||||
/* Needed by PIXELADDR1 macro */
|
|
||||||
xmesa->xm_buffer->ximage_width1
|
|
||||||
= xmesa->xm_buffer->backimage->bytes_per_line;
|
|
||||||
xmesa->xm_buffer->ximage_origin1
|
|
||||||
= (GLubyte *) xmesa->xm_buffer->backimage->data
|
|
||||||
+ xmesa->xm_buffer->ximage_width1 * (winheight-1);
|
|
||||||
|
|
||||||
/* Needed by PIXELADDR2 macro */
|
|
||||||
xmesa->xm_buffer->ximage_width2
|
|
||||||
= xmesa->xm_buffer->backimage->bytes_per_line / 2;
|
|
||||||
xmesa->xm_buffer->ximage_origin2
|
|
||||||
= (GLushort *) xmesa->xm_buffer->backimage->data
|
|
||||||
+ xmesa->xm_buffer->ximage_width2 * (winheight-1);
|
|
||||||
|
|
||||||
/* Needed by PIXELADDR3 macro */
|
|
||||||
xmesa->xm_buffer->ximage_width3
|
|
||||||
= xmesa->xm_buffer->backimage->bytes_per_line;
|
|
||||||
xmesa->xm_buffer->ximage_origin3
|
|
||||||
= (GLubyte *) xmesa->xm_buffer->backimage->data
|
|
||||||
+ xmesa->xm_buffer->ximage_width3 * (winheight-1);
|
|
||||||
|
|
||||||
/* Needed by PIXELADDR4 macro */
|
|
||||||
xmesa->xm_buffer->ximage_width4 = xmesa->xm_buffer->backimage->width;
|
|
||||||
xmesa->xm_buffer->ximage_origin4
|
|
||||||
= (GLuint *) xmesa->xm_buffer->backimage->data
|
|
||||||
+ xmesa->xm_buffer->ximage_width4 * (winheight-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -780,10 +742,51 @@ clear_buffers( GLcontext *ctx, GLbitfield mask,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
/*
|
||||||
resize_buffers( GLcontext *ctx )
|
* When we detect that the user has resized the window this function will
|
||||||
|
* get called. Here we'll reallocate the back buffer, depth buffer,
|
||||||
|
* stencil buffer etc. to match the new window size.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmesa_resize_buffers( GLframebuffer *buffer )
|
||||||
{
|
{
|
||||||
_swrast_alloc_buffers( ctx );
|
int height = (int) buffer->Height;
|
||||||
|
/* We can do this cast because the first field in the XMesaBuffer
|
||||||
|
* struct is a GLframebuffer struct. If this weren't true, we'd
|
||||||
|
* need a pointer from the GLframebuffer to the XMesaBuffer.
|
||||||
|
*/
|
||||||
|
XMesaBuffer xmBuffer = (XMesaBuffer) buffer;
|
||||||
|
|
||||||
|
xmBuffer->width = buffer->Width;
|
||||||
|
xmBuffer->height = buffer->Height;
|
||||||
|
xmesa_alloc_back_buffer( xmBuffer );
|
||||||
|
|
||||||
|
/* Needed by FLIP macro */
|
||||||
|
xmBuffer->bottom = height - 1;
|
||||||
|
|
||||||
|
if (xmBuffer->backimage) {
|
||||||
|
/* Needed by PIXELADDR1 macro */
|
||||||
|
xmBuffer->ximage_width1 = xmBuffer->backimage->bytes_per_line;
|
||||||
|
xmBuffer->ximage_origin1 = (GLubyte *) xmBuffer->backimage->data
|
||||||
|
+ xmBuffer->ximage_width1 * (height-1);
|
||||||
|
|
||||||
|
/* Needed by PIXELADDR2 macro */
|
||||||
|
xmBuffer->ximage_width2 = xmBuffer->backimage->bytes_per_line / 2;
|
||||||
|
xmBuffer->ximage_origin2 = (GLushort *) xmBuffer->backimage->data
|
||||||
|
+ xmBuffer->ximage_width2 * (height-1);
|
||||||
|
|
||||||
|
/* Needed by PIXELADDR3 macro */
|
||||||
|
xmBuffer->ximage_width3 = xmBuffer->backimage->bytes_per_line;
|
||||||
|
xmBuffer->ximage_origin3 = (GLubyte *) xmBuffer->backimage->data
|
||||||
|
+ xmBuffer->ximage_width3 * (height-1);
|
||||||
|
|
||||||
|
/* Needed by PIXELADDR4 macro */
|
||||||
|
xmBuffer->ximage_width4 = xmBuffer->backimage->width;
|
||||||
|
xmBuffer->ximage_origin4 = (GLuint *) xmBuffer->backimage->data
|
||||||
|
+ xmBuffer->ximage_width4 * (height-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_swrast_alloc_buffers( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -951,7 +954,7 @@ void xmesa_init_pointers( GLcontext *ctx )
|
||||||
ctx->Driver.Accum = _swrast_Accum;
|
ctx->Driver.Accum = _swrast_Accum;
|
||||||
ctx->Driver.Bitmap = _swrast_Bitmap;
|
ctx->Driver.Bitmap = _swrast_Bitmap;
|
||||||
ctx->Driver.Clear = clear_buffers;
|
ctx->Driver.Clear = clear_buffers;
|
||||||
ctx->Driver.ResizeBuffersMESA = resize_buffers;
|
ctx->Driver.ResizeBuffers = xmesa_resize_buffers;
|
||||||
ctx->Driver.CopyPixels = _swrast_CopyPixels;
|
ctx->Driver.CopyPixels = _swrast_CopyPixels;
|
||||||
ctx->Driver.DrawPixels = _swrast_DrawPixels;
|
ctx->Driver.DrawPixels = _swrast_DrawPixels;
|
||||||
ctx->Driver.ReadPixels = _swrast_ReadPixels;
|
ctx->Driver.ReadPixels = _swrast_ReadPixels;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* $Id: xmesaP.h,v 1.26 2002/03/12 21:55:50 brianp Exp $ */
|
/* $Id: xmesaP.h,v 1.27 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 4.2
|
* Version: 4.0.2
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
|
@ -532,4 +532,6 @@ extern void XMesaReset( void );
|
||||||
extern void xmesa_set_read_buffer( GLcontext *ctx,
|
extern void xmesa_set_read_buffer( GLcontext *ctx,
|
||||||
GLframebuffer *buffer, GLenum mode );
|
GLframebuffer *buffer, GLenum mode );
|
||||||
|
|
||||||
|
extern void xmesa_resize_buffers( GLframebuffer *buffer );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: buffers.c,v 1.32 2002/02/15 16:25:16 brianp Exp $ */
|
/* $Id: buffers.c,v 1.33 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -350,33 +350,59 @@ _mesa_ReadBuffer( GLenum mode )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GL_MESA_resize_buffers extension
|
* 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 not what we expect, we'll have to
|
||||||
|
* resize/reallocate the software accum/stencil/depth/alpha buffers.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_mesa_ResizeBuffersMESA( void )
|
_mesa_ResizeBuffersMESA( void )
|
||||||
{
|
{
|
||||||
GLcontext *ctx = _mesa_get_current_context();
|
GLcontext *ctx = _mesa_get_current_context();
|
||||||
GLuint buf_width, buf_height;
|
|
||||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
|
|
||||||
|
|
||||||
|
|
||||||
if (MESA_VERBOSE & VERBOSE_API)
|
if (MESA_VERBOSE & VERBOSE_API)
|
||||||
fprintf(stderr, "glResizeBuffersMESA\n");
|
fprintf(stderr, "glResizeBuffersMESA\n");
|
||||||
|
|
||||||
/* ask device driver for size of output buffer */
|
if (ctx) {
|
||||||
(*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );
|
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
|
||||||
|
|
||||||
/* see if size of device driver's color buffer (window) has changed */
|
if (ctx->DrawBuffer) {
|
||||||
if (ctx->DrawBuffer->Width == (GLint) buf_width &&
|
GLuint buf_width, buf_height;
|
||||||
ctx->DrawBuffer->Height == (GLint) buf_height)
|
GLframebuffer *buffer = ctx->DrawBuffer;
|
||||||
return;
|
|
||||||
|
|
||||||
ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
|
/* ask device driver for size of output buffer */
|
||||||
|
(*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
|
||||||
|
|
||||||
/* save buffer size */
|
/* see if size of device driver's color buffer (window) has changed */
|
||||||
ctx->DrawBuffer->Width = buf_width;
|
if (buffer->Width == (GLint) buf_width &&
|
||||||
ctx->DrawBuffer->Height = buf_height;
|
buffer->Height == (GLint) buf_height)
|
||||||
|
return; /* size is as expected */
|
||||||
|
|
||||||
ctx->Driver.ResizeBuffersMESA( ctx );
|
buffer->Width = buf_width;
|
||||||
|
buffer->Height = buf_height;
|
||||||
|
|
||||||
|
ctx->Driver.ResizeBuffers( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->ReadBuffer && ctx->ReadBuffer != ctx->DrawBuffer) {
|
||||||
|
GLuint buf_width, buf_height;
|
||||||
|
GLframebuffer *buffer = ctx->DrawBuffer;
|
||||||
|
|
||||||
|
/* ask device driver for size of output buffer */
|
||||||
|
(*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height );
|
||||||
|
|
||||||
|
/* see if size of device driver's color buffer (window) has changed */
|
||||||
|
if (buffer->Width == (GLint) buf_width &&
|
||||||
|
buffer->Height == (GLint) buf_height)
|
||||||
|
return; /* size is as expected */
|
||||||
|
|
||||||
|
buffer->Width = buf_width;
|
||||||
|
buffer->Height = buf_height;
|
||||||
|
|
||||||
|
ctx->Driver.ResizeBuffers( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: context.c,v 1.155 2002/03/13 04:33:32 brianp Exp $ */
|
/* $Id: context.c,v 1.156 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -2084,6 +2084,9 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *where )
|
||||||
fprintf(stderr, "Mesa user error: %s in %s\n", errstr, where);
|
fprintf(stderr, "Mesa user error: %s in %s\n", errstr, where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ctx)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ctx->ErrorValue == GL_NO_ERROR) {
|
if (ctx->ErrorValue == GL_NO_ERROR) {
|
||||||
ctx->ErrorValue = error;
|
ctx->ErrorValue = error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mtypes.h,v 1.66 2002/03/13 04:33:16 brianp Exp $ */
|
/* $Id: mtypes.h,v 1.67 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -1312,7 +1312,7 @@ struct gl_shared_state {
|
||||||
struct gl_frame_buffer {
|
struct gl_frame_buffer {
|
||||||
GLvisual Visual; /* The corresponding visual */
|
GLvisual Visual; /* The corresponding visual */
|
||||||
|
|
||||||
GLint Width, Height; /* size of frame buffer in pixels */
|
GLuint Width, Height; /* size of frame buffer in pixels */
|
||||||
|
|
||||||
GLboolean UseSoftwareDepthBuffer;
|
GLboolean UseSoftwareDepthBuffer;
|
||||||
GLboolean UseSoftwareAccumBuffer;
|
GLboolean UseSoftwareAccumBuffer;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: s_accum.c,v 1.14 2002/02/02 17:24:11 brianp Exp $ */
|
/* $Id: s_accum.c,v 1.15 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -67,38 +67,38 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_alloc_accum_buffer( GLcontext *ctx )
|
_mesa_alloc_accum_buffer( GLframebuffer *buffer )
|
||||||
{
|
{
|
||||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
GLint n;
|
GLint n;
|
||||||
|
|
||||||
if (ctx->DrawBuffer->Accum) {
|
if (buffer->Accum) {
|
||||||
FREE( ctx->DrawBuffer->Accum );
|
FREE( buffer->Accum );
|
||||||
ctx->DrawBuffer->Accum = NULL;
|
buffer->Accum = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate accumulation buffer if not already present */
|
/* allocate accumulation buffer if not already present */
|
||||||
n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height * 4 * sizeof(GLaccum);
|
n = buffer->Width * buffer->Height * 4 * sizeof(GLaccum);
|
||||||
ctx->DrawBuffer->Accum = (GLaccum *) MALLOC( n );
|
buffer->Accum = (GLaccum *) MALLOC( n );
|
||||||
if (!ctx->DrawBuffer->Accum) {
|
if (!buffer->Accum) {
|
||||||
/* unable to setup accumulation buffer */
|
/* unable to setup accumulation buffer */
|
||||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glAccum" );
|
_mesa_error( NULL, GL_OUT_OF_MEMORY, "glAccum" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx) {
|
||||||
|
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||||
|
/* XXX these fields should probably be in the GLframebuffer */
|
||||||
#ifdef USE_OPTIMIZED_ACCUM
|
#ifdef USE_OPTIMIZED_ACCUM
|
||||||
swrast->_IntegerAccumMode = GL_TRUE;
|
swrast->_IntegerAccumMode = GL_TRUE;
|
||||||
#else
|
#else
|
||||||
swrast->_IntegerAccumMode = GL_FALSE;
|
swrast->_IntegerAccumMode = GL_FALSE;
|
||||||
#endif
|
#endif
|
||||||
swrast->_IntegerAccumScaler = 0.0;
|
swrast->_IntegerAccumScaler = 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is called when we fall out of optimized/unscaled accum buffer mode.
|
* This is called when we fall out of optimized/unscaled accum buffer mode.
|
||||||
* That is, we convert each unscaled accum buffer value into a scaled value
|
* That is, we convert each unscaled accum buffer value into a scaled value
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* $Id: s_accum.h,v 1.3 2001/03/12 00:48:41 gareth Exp $ */
|
/* $Id: s_accum.h,v 1.4 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 3.5
|
* Version: 4.0.2
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -34,12 +34,11 @@
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_alloc_accum_buffer( GLcontext *ctx );
|
_mesa_alloc_accum_buffer( GLframebuffer *buffer );
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_clear_accum_buffer( GLcontext *ctx );
|
_mesa_clear_accum_buffer( GLcontext *ctx );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* $Id: s_alphabuf.c,v 1.8 2001/07/13 20:07:37 brianp Exp $ */
|
/* $Id: s_alphabuf.c,v 1.9 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 3.5
|
* Version: 4.0.2
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -38,8 +38,6 @@
|
||||||
#include "s_alphabuf.h"
|
#include "s_alphabuf.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define ALPHA_DRAW_ADDR(X,Y) \
|
#define ALPHA_DRAW_ADDR(X,Y) \
|
||||||
(ctx->DrawBuffer->Alpha + (Y) * ctx->DrawBuffer->Width + (X))
|
(ctx->DrawBuffer->Alpha + (Y) * ctx->DrawBuffer->Width + (X))
|
||||||
|
|
||||||
|
@ -47,85 +45,72 @@
|
||||||
(ctx->ReadBuffer->Alpha + (Y) * ctx->ReadBuffer->Width + (X))
|
(ctx->ReadBuffer->Alpha + (Y) * ctx->ReadBuffer->Width + (X))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate new front/back/left/right alpha buffers.
|
|
||||||
* Input: ctx - the context
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
alloc_alpha_buffers( GLcontext *ctx, GLframebuffer *buf )
|
|
||||||
{
|
|
||||||
GLint bytes = buf->Width * buf->Height * sizeof(GLchan);
|
|
||||||
|
|
||||||
ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers);
|
|
||||||
|
|
||||||
if (buf->FrontLeftAlpha) {
|
|
||||||
FREE( buf->FrontLeftAlpha );
|
|
||||||
}
|
|
||||||
buf->FrontLeftAlpha = (GLchan *) MALLOC( bytes );
|
|
||||||
if (!buf->FrontLeftAlpha) {
|
|
||||||
/* out of memory */
|
|
||||||
_mesa_error( ctx, GL_OUT_OF_MEMORY,
|
|
||||||
"Couldn't allocate front-left alpha buffer" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->Visual.doubleBufferMode) {
|
|
||||||
if (buf->BackLeftAlpha) {
|
|
||||||
FREE( buf->BackLeftAlpha );
|
|
||||||
}
|
|
||||||
buf->BackLeftAlpha = (GLchan *) MALLOC( bytes );
|
|
||||||
if (!buf->BackLeftAlpha) {
|
|
||||||
/* out of memory */
|
|
||||||
_mesa_error( ctx, GL_OUT_OF_MEMORY,
|
|
||||||
"Couldn't allocate back-left alpha buffer" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->Visual.stereoMode) {
|
|
||||||
if (buf->FrontRightAlpha) {
|
|
||||||
FREE( buf->FrontRightAlpha );
|
|
||||||
}
|
|
||||||
buf->FrontRightAlpha = (GLchan *) MALLOC( bytes );
|
|
||||||
if (!buf->FrontRightAlpha) {
|
|
||||||
/* out of memory */
|
|
||||||
_mesa_error( ctx, GL_OUT_OF_MEMORY,
|
|
||||||
"Couldn't allocate front-right alpha buffer" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->Visual.doubleBufferMode) {
|
|
||||||
if (buf->BackRightAlpha) {
|
|
||||||
FREE( buf->BackRightAlpha );
|
|
||||||
}
|
|
||||||
buf->BackRightAlpha = (GLchan *) MALLOC( bytes );
|
|
||||||
if (!buf->BackRightAlpha) {
|
|
||||||
/* out of memory */
|
|
||||||
_mesa_error( ctx, GL_OUT_OF_MEMORY,
|
|
||||||
"Couldn't allocate back-right alpha buffer" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT)
|
|
||||||
buf->Alpha = buf->FrontLeftAlpha;
|
|
||||||
else if (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT)
|
|
||||||
buf->Alpha = buf->BackLeftAlpha;
|
|
||||||
else if (ctx->Color.DriverDrawBuffer == GL_FRONT_RIGHT)
|
|
||||||
buf->Alpha = buf->FrontRightAlpha;
|
|
||||||
else if (ctx->Color.DriverDrawBuffer == GL_BACK_RIGHT)
|
|
||||||
buf->Alpha = buf->BackRightAlpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a new front and back alpha buffer.
|
* Allocate a new front and back alpha buffer.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_mesa_alloc_alpha_buffers( GLcontext *ctx )
|
_mesa_alloc_alpha_buffers( GLframebuffer *buffer )
|
||||||
{
|
{
|
||||||
alloc_alpha_buffers( ctx, ctx->DrawBuffer );
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
if (ctx->ReadBuffer != ctx->DrawBuffer) {
|
const GLint bytes = buffer->Width * buffer->Height * sizeof(GLchan);
|
||||||
alloc_alpha_buffers( ctx, ctx->ReadBuffer );
|
|
||||||
|
ASSERT(buffer->UseSoftwareAlphaBuffers);
|
||||||
|
|
||||||
|
if (buffer->FrontLeftAlpha) {
|
||||||
|
FREE( buffer->FrontLeftAlpha );
|
||||||
|
}
|
||||||
|
buffer->FrontLeftAlpha = (GLchan *) MALLOC( bytes );
|
||||||
|
if (!buffer->FrontLeftAlpha) {
|
||||||
|
/* out of memory */
|
||||||
|
_mesa_error( NULL, GL_OUT_OF_MEMORY,
|
||||||
|
"Couldn't allocate front-left alpha buffer" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer->Visual.doubleBufferMode) {
|
||||||
|
if (buffer->BackLeftAlpha) {
|
||||||
|
FREE( buffer->BackLeftAlpha );
|
||||||
|
}
|
||||||
|
buffer->BackLeftAlpha = (GLchan *) MALLOC( bytes );
|
||||||
|
if (!buffer->BackLeftAlpha) {
|
||||||
|
/* out of memory */
|
||||||
|
_mesa_error( NULL, GL_OUT_OF_MEMORY,
|
||||||
|
"Couldn't allocate back-left alpha buffer" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer->Visual.stereoMode) {
|
||||||
|
if (buffer->FrontRightAlpha) {
|
||||||
|
FREE( buffer->FrontRightAlpha );
|
||||||
|
}
|
||||||
|
buffer->FrontRightAlpha = (GLchan *) MALLOC( bytes );
|
||||||
|
if (!buffer->FrontRightAlpha) {
|
||||||
|
/* out of memory */
|
||||||
|
_mesa_error( NULL, GL_OUT_OF_MEMORY,
|
||||||
|
"Couldn't allocate front-right alpha buffer" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer->Visual.doubleBufferMode) {
|
||||||
|
if (buffer->BackRightAlpha) {
|
||||||
|
FREE( buffer->BackRightAlpha );
|
||||||
|
}
|
||||||
|
buffer->BackRightAlpha = (GLchan *) MALLOC( bytes );
|
||||||
|
if (!buffer->BackRightAlpha) {
|
||||||
|
/* out of memory */
|
||||||
|
_mesa_error( NULL, GL_OUT_OF_MEMORY,
|
||||||
|
"Couldn't allocate back-right alpha buffer" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx) {
|
||||||
|
if (ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT)
|
||||||
|
buffer->Alpha = buffer->FrontLeftAlpha;
|
||||||
|
else if (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT)
|
||||||
|
buffer->Alpha = buffer->BackLeftAlpha;
|
||||||
|
else if (ctx->Color.DriverDrawBuffer == GL_FRONT_RIGHT)
|
||||||
|
buffer->Alpha = buffer->FrontRightAlpha;
|
||||||
|
else if (ctx->Color.DriverDrawBuffer == GL_BACK_RIGHT)
|
||||||
|
buffer->Alpha = buffer->BackRightAlpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* $Id: s_alphabuf.h,v 1.3 2001/03/12 00:48:41 gareth Exp $ */
|
/* $Id: s_alphabuf.h,v 1.4 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 3.5
|
* Version: 4.0.2
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_alloc_alpha_buffers( GLcontext *ctx );
|
_mesa_alloc_alpha_buffers( GLframebuffer *buffer );
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: s_buffers.c,v 1.9 2002/02/02 17:24:11 brianp Exp $ */
|
/* $Id: s_buffers.c,v 1.10 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -242,19 +242,19 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask,
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_swrast_alloc_buffers( GLcontext *ctx )
|
_swrast_alloc_buffers( GLframebuffer *buffer )
|
||||||
{
|
{
|
||||||
/* Reallocate other buffers if needed. */
|
/* Reallocate other buffers if needed. */
|
||||||
if (ctx->DrawBuffer->UseSoftwareDepthBuffer) {
|
if (buffer->UseSoftwareDepthBuffer) {
|
||||||
_mesa_alloc_depth_buffer( ctx );
|
_mesa_alloc_depth_buffer( buffer );
|
||||||
}
|
}
|
||||||
if (ctx->DrawBuffer->UseSoftwareStencilBuffer) {
|
if (buffer->UseSoftwareStencilBuffer) {
|
||||||
_mesa_alloc_stencil_buffer( ctx );
|
_mesa_alloc_stencil_buffer( buffer );
|
||||||
}
|
}
|
||||||
if (ctx->DrawBuffer->UseSoftwareAccumBuffer) {
|
if (buffer->UseSoftwareAccumBuffer) {
|
||||||
_mesa_alloc_accum_buffer( ctx );
|
_mesa_alloc_accum_buffer( buffer );
|
||||||
}
|
}
|
||||||
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) {
|
if (buffer->UseSoftwareAlphaBuffers) {
|
||||||
_mesa_alloc_alpha_buffers( ctx );
|
_mesa_alloc_alpha_buffers( buffer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: s_depth.c,v 1.17 2002/02/06 03:22:00 brianp Exp $ */
|
/* $Id: s_depth.c,v 1.18 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -1513,32 +1513,33 @@ _mesa_read_depth_span_float( GLcontext *ctx,
|
||||||
* This function is only called through Driver.alloc_depth_buffer.
|
* This function is only called through Driver.alloc_depth_buffer.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_mesa_alloc_depth_buffer( GLcontext *ctx )
|
_mesa_alloc_depth_buffer( GLframebuffer *buffer )
|
||||||
{
|
{
|
||||||
|
GLint bytesPerValue;
|
||||||
|
|
||||||
|
ASSERT(buffer->UseSoftwareDepthBuffer);
|
||||||
|
|
||||||
/* deallocate current depth buffer if present */
|
/* deallocate current depth buffer if present */
|
||||||
if (ctx->DrawBuffer->UseSoftwareDepthBuffer) {
|
if (buffer->DepthBuffer) {
|
||||||
GLint bytesPerValue;
|
FREE(buffer->DepthBuffer);
|
||||||
|
buffer->DepthBuffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx->DrawBuffer->DepthBuffer) {
|
/* allocate new depth buffer, but don't initialize it */
|
||||||
FREE(ctx->DrawBuffer->DepthBuffer);
|
if (buffer->Visual.depthBits <= 16)
|
||||||
ctx->DrawBuffer->DepthBuffer = NULL;
|
bytesPerValue = sizeof(GLushort);
|
||||||
}
|
else
|
||||||
|
bytesPerValue = sizeof(GLuint);
|
||||||
|
|
||||||
/* allocate new depth buffer, but don't initialize it */
|
buffer->DepthBuffer =MALLOC(buffer->Width * buffer->Height * bytesPerValue);
|
||||||
if (ctx->Visual.depthBits <= 16)
|
|
||||||
bytesPerValue = sizeof(GLushort);
|
|
||||||
else
|
|
||||||
bytesPerValue = sizeof(GLuint);
|
|
||||||
|
|
||||||
ctx->DrawBuffer->DepthBuffer = MALLOC( ctx->DrawBuffer->Width
|
if (!buffer->DepthBuffer) {
|
||||||
* ctx->DrawBuffer->Height
|
/* out of memory */
|
||||||
* bytesPerValue );
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
if (ctx) {
|
||||||
if (!ctx->DrawBuffer->DepthBuffer) {
|
|
||||||
/* out of memory */
|
|
||||||
ctx->Depth.Test = GL_FALSE;
|
ctx->Depth.Test = GL_FALSE;
|
||||||
ctx->NewState |= _NEW_DEPTH;
|
ctx->NewState |= _NEW_DEPTH;
|
||||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "Couldn't allocate depth buffer" );
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "Couldn't allocate depth buffer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: s_depth.h,v 1.5 2002/02/04 15:59:29 brianp Exp $ */
|
/* $Id: s_depth.h,v 1.6 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -54,11 +54,11 @@ _mesa_read_depth_span_float( GLcontext *ctx, GLint n, GLint x, GLint y,
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_alloc_depth_buffer( GLcontext* ctx );
|
_mesa_alloc_depth_buffer( GLframebuffer *buffer );
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_clear_depth_buffer( GLcontext* ctx );
|
_mesa_clear_depth_buffer( GLcontext *ctx );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: s_stencil.c,v 1.20 2002/02/04 15:59:30 brianp Exp $ */
|
/* $Id: s_stencil.c,v 1.21 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -1112,22 +1112,20 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
|
||||||
* deallocated first. The new stencil buffer will be uninitialized.
|
* deallocated first. The new stencil buffer will be uninitialized.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_mesa_alloc_stencil_buffer( GLcontext *ctx )
|
_mesa_alloc_stencil_buffer( GLframebuffer *buffer )
|
||||||
{
|
{
|
||||||
GLuint buffersize = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height;
|
|
||||||
|
|
||||||
/* deallocate current stencil buffer if present */
|
/* deallocate current stencil buffer if present */
|
||||||
if (ctx->DrawBuffer->Stencil) {
|
if (buffer->Stencil) {
|
||||||
FREE(ctx->DrawBuffer->Stencil);
|
FREE(buffer->Stencil);
|
||||||
ctx->DrawBuffer->Stencil = NULL;
|
buffer->Stencil = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate new stencil buffer */
|
/* allocate new stencil buffer */
|
||||||
ctx->DrawBuffer->Stencil = (GLstencil *) MALLOC(buffersize * sizeof(GLstencil));
|
buffer->Stencil = (GLstencil *) MALLOC(buffer->Width * buffer->Height
|
||||||
if (!ctx->DrawBuffer->Stencil) {
|
* sizeof(GLstencil));
|
||||||
|
if (!buffer->Stencil) {
|
||||||
/* out of memory */
|
/* out of memory */
|
||||||
/* _mesa_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE ); */
|
_mesa_error( NULL, GL_OUT_OF_MEMORY, "_mesa_alloc_stencil_buffer" );
|
||||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "_mesa_alloc_stencil_buffer" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: s_stencil.h,v 1.6 2002/02/02 21:40:34 brianp Exp $ */
|
/* $Id: s_stencil.h,v 1.7 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -50,7 +50,7 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_alloc_stencil_buffer( GLcontext *ctx );
|
_mesa_alloc_stencil_buffer( GLframebuffer *buffer );
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: swrast.h,v 1.20 2002/02/02 17:24:11 brianp Exp $ */
|
/* $Id: swrast.h,v 1.21 2002/03/16 00:53:15 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -134,9 +134,10 @@ struct sw_span {
|
||||||
GLfixed index, indexStep;
|
GLfixed index, indexStep;
|
||||||
GLfixed z, zStep;
|
GLfixed z, zStep;
|
||||||
GLfloat fog, fogStep;
|
GLfloat fog, fogStep;
|
||||||
GLfloat tex[MAX_TEXTURE_UNITS][4], texStep[MAX_TEXTURE_UNITS][4];
|
GLfloat tex[MAX_TEXTURE_UNITS][4];
|
||||||
|
GLfloat texStepX[MAX_TEXTURE_UNITS][4];
|
||||||
|
GLfloat texStepY[MAX_TEXTURE_UNITS][4];
|
||||||
GLfixed intTex[2], intTexStep[2];
|
GLfixed intTex[2], intTexStep[2];
|
||||||
GLfloat rho[MAX_TEXTURE_UNITS]; /* for texture lambda/lod computation */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This bitmask (of SPAN_* flags) indicates which of the fragment arrays
|
* This bitmask (of SPAN_* flags) indicates which of the fragment arrays
|
||||||
|
@ -182,7 +183,7 @@ struct swrast_device_driver;
|
||||||
/* These are the public-access functions exported from swrast.
|
/* These are the public-access functions exported from swrast.
|
||||||
*/
|
*/
|
||||||
extern void
|
extern void
|
||||||
_swrast_alloc_buffers( GLcontext *ctx );
|
_swrast_alloc_buffers( GLframebuffer *buffer );
|
||||||
|
|
||||||
extern GLboolean
|
extern GLboolean
|
||||||
_swrast_CreateContext( GLcontext *ctx );
|
_swrast_CreateContext( GLcontext *ctx );
|
||||||
|
|
Loading…
Reference in New Issue