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().
* If anything special has to been done when the buffer/window is\r
* resized, do it now.\r
*/\r
-static void get_buffer_size (GLcontext *ctx, GLuint *width, GLuint *height)\r
+static void get_buffer_size (GLframebuffer *buffer, GLuint *width, GLuint *height)\r
{\r
+ /* XXX this may not be right. We should query the size of the DOS window\r
+ * associated with <buffer>. This function should work whether or\r
+ * not there is a current context.\r
+ */\r
+ GET_CURRENT_CONTEXT(ctx);\r
DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
\r
*width = c->Buffer->width;\r
ctx->Driver.Accum = _swrast_Accum;\r
ctx->Driver.Bitmap = _swrast_Bitmap;\r
ctx->Driver.Clear = clear;\r
- ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;\r
+ ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;\r
ctx->Driver.CopyPixels = _swrast_CopyPixels;\r
ctx->Driver.DrawPixels = _swrast_DrawPixels;\r
ctx->Driver.ReadPixels = _swrast_ReadPixels;\r
-/* $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
/* Return buffer size information */
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) {
- fprintf(stderr, "fxmesa: fxDDBufferSize(...) Start\n");
- }
+ if (MESA_VERBOSE & VERBOSE_DRIVER) {
+ fprintf(stderr, "fxmesa: fxDDBufferSize(...) Start\n");
+ }
- *width = fxMesa->width;
- *height = fxMesa->height;
+ *width = fxMesa->width;
+ *height = fxMesa->height;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDBufferSize(...) End\n");
+ if (MESA_VERBOSE & VERBOSE_DRIVER) {
+ fprintf(stderr, "fxmesa: fxDDBufferSize(...) End\n");
+ }
}
}
ctx->Driver.CopyPixels = _swrast_CopyPixels;
ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = fxDDReadPixels;
- ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
+ ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.Finish = fxDDFinish;
ctx->Driver.Flush = NULL;
ctx->Driver.ChooseTextureFormat = fxDDChooseTextureFormat;
-/* $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
-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);
- *width = osmesa->width;
- *height = osmesa->height;
+ GET_CURRENT_CONTEXT(ctx);
+ (void) buffer;
+ if (ctx) {
+ OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
+ *width = osmesa->width;
+ *height = osmesa->height;
+ }
}
ctx->Driver.GetString = get_string;
ctx->Driver.UpdateState = osmesa_update_state;
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.Accum = _swrast_Accum;
-/* $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
}
}
-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();
*height = SVGAMesa->height = vga_getydim();
ctx->Driver.GetBufferSize = get_buffer_size;
ctx->Driver.SetDrawBuffer = set_draw_buffer;
+ ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
/* Software rasterizer pixel paths:
*/
-/* $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
/* 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;
RECT CR;
ctx->Driver.GetString = get_string;
ctx->Driver.UpdateState = wmesa_update_state;
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.Accum = _swrast_Accum;
ctx->Driver.GetString = get_string;
ctx->Driver.UpdateState = wmesa_update_state;
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.Accum = _swrast_Accum;
-/* $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
- * Version: 4.1
+ * Version: 4.0.2
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
/* If we're swapping the buffer associated with the current context
* 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);
- }
if (b->db_state) {
#ifdef FX
}
+/*
+ * 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) );
+
+}
+
-/* $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
- * Version: 4.1
+ * Version: 4.0.2
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
/*
- * Return the size (width,height of the current color buffer.
- * 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.
+ * Return the size (width, height) of the X window for the given GLframebuffer.
* Output: width - width of buffer in pixels.
* height - height of buffer in pixels.
*/
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;
#ifndef XFree86Server
Window root;
unsigned int bw, d;
_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 );
_glthread_UNLOCK_MUTEX(_xmesa_lock);
#else
-
- winwidth = xmesa->xm_buffer->frontbuffer->width;
- winheight = xmesa->xm_buffer->frontbuffer->height;
+ /* XFree86 GLX renderer */
+ winwidth = xmBuffer->frontbuffer->width;
+ winheight = xmBuffer->frontbuffer->height;
#endif
(void)kernel8; /* Muffle compiler */
*width = winwidth;
*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);
- }
}
}
-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
ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.Bitmap = _swrast_Bitmap;
ctx->Driver.Clear = clear_buffers;
- ctx->Driver.ResizeBuffersMESA = resize_buffers;
+ ctx->Driver.ResizeBuffers = xmesa_resize_buffers;
ctx->Driver.CopyPixels = _swrast_CopyPixels;
ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = _swrast_ReadPixels;
-/* $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
- * Version: 4.2
+ * Version: 4.0.2
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
extern void xmesa_set_read_buffer( GLcontext *ctx,
GLframebuffer *buffer, GLenum mode );
+extern void xmesa_resize_buffers( GLframebuffer *buffer );
+
#endif
-/* $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
/*
* 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
_mesa_ResizeBuffersMESA( void )
{
GLcontext *ctx = _mesa_get_current_context();
- GLuint buf_width, buf_height;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
-
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glResizeBuffersMESA\n");
- /* ask device driver for size of output buffer */
- (*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );
+ if (ctx) {
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
- /* see if size of device driver's color buffer (window) has changed */
- if (ctx->DrawBuffer->Width == (GLint) buf_width &&
- ctx->DrawBuffer->Height == (GLint) buf_height)
- return;
+ if (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 );
- ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
+ /* 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 );
+ }
- /* save buffer size */
- ctx->DrawBuffer->Width = buf_width;
- ctx->DrawBuffer->Height = buf_height;
+ if (ctx->ReadBuffer && ctx->ReadBuffer != ctx->DrawBuffer) {
+ GLuint buf_width, buf_height;
+ GLframebuffer *buffer = ctx->DrawBuffer;
- ctx->Driver.ResizeBuffersMESA( ctx );
+ /* 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 */
+ }
}
-/* $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
fprintf(stderr, "Mesa user error: %s in %s\n", errstr, where);
}
+ if (!ctx)
+ return;
+
if (ctx->ErrorValue == GL_NO_ERROR) {
ctx->ErrorValue = error;
}
-/* $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
struct gl_frame_buffer {
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 UseSoftwareAccumBuffer;
-/* $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
#endif
-
void
-_mesa_alloc_accum_buffer( GLcontext *ctx )
+_mesa_alloc_accum_buffer( GLframebuffer *buffer )
{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ GET_CURRENT_CONTEXT(ctx);
GLint n;
- if (ctx->DrawBuffer->Accum) {
- FREE( ctx->DrawBuffer->Accum );
- ctx->DrawBuffer->Accum = NULL;
+ if (buffer->Accum) {
+ FREE( buffer->Accum );
+ buffer->Accum = NULL;
}
/* allocate accumulation buffer if not already present */
- n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height * 4 * sizeof(GLaccum);
- ctx->DrawBuffer->Accum = (GLaccum *) MALLOC( n );
- if (!ctx->DrawBuffer->Accum) {
+ n = buffer->Width * buffer->Height * 4 * sizeof(GLaccum);
+ buffer->Accum = (GLaccum *) MALLOC( n );
+ if (!buffer->Accum) {
/* 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
- swrast->_IntegerAccumMode = GL_TRUE;
+ swrast->_IntegerAccumMode = GL_TRUE;
#else
- swrast->_IntegerAccumMode = GL_FALSE;
+ swrast->_IntegerAccumMode = GL_FALSE;
#endif
- swrast->_IntegerAccumScaler = 0.0;
+ swrast->_IntegerAccumScaler = 0.0;
+ }
}
-
-
-
-
/*
* 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
-/* $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
- * 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
* copy of this software and associated documentation files (the "Software"),
extern void
-_mesa_alloc_accum_buffer( GLcontext *ctx );
+_mesa_alloc_accum_buffer( GLframebuffer *buffer );
extern void
_mesa_clear_accum_buffer( GLcontext *ctx );
-
#endif
-/* $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
- * 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
* copy of this software and associated documentation files (the "Software"),
#include "s_alphabuf.h"
-
-
#define ALPHA_DRAW_ADDR(X,Y) \
(ctx->DrawBuffer->Alpha + (Y) * ctx->DrawBuffer->Width + (X))
(ctx->ReadBuffer->Alpha + (Y) * ctx->ReadBuffer->Width + (X))
-
/*
- * Allocate new front/back/left/right alpha buffers.
- * Input: ctx - the context
- *
+ * Allocate a new front and back alpha buffer.
*/
-static void
-alloc_alpha_buffers( GLcontext *ctx, GLframebuffer *buf )
+void
+_mesa_alloc_alpha_buffers( GLframebuffer *buffer )
{
- GLint bytes = buf->Width * buf->Height * sizeof(GLchan);
+ GET_CURRENT_CONTEXT(ctx);
+ const GLint bytes = buffer->Width * buffer->Height * sizeof(GLchan);
- ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers);
+ ASSERT(buffer->UseSoftwareAlphaBuffers);
- if (buf->FrontLeftAlpha) {
- FREE( buf->FrontLeftAlpha );
+ if (buffer->FrontLeftAlpha) {
+ FREE( buffer->FrontLeftAlpha );
}
- buf->FrontLeftAlpha = (GLchan *) MALLOC( bytes );
- if (!buf->FrontLeftAlpha) {
+ buffer->FrontLeftAlpha = (GLchan *) MALLOC( bytes );
+ if (!buffer->FrontLeftAlpha) {
/* out of memory */
- _mesa_error( ctx, GL_OUT_OF_MEMORY,
- "Couldn't allocate front-left alpha buffer" );
+ _mesa_error( NULL, GL_OUT_OF_MEMORY,
+ "Couldn't allocate front-left alpha buffer" );
}
- if (ctx->Visual.doubleBufferMode) {
- if (buf->BackLeftAlpha) {
- FREE( buf->BackLeftAlpha );
+ if (buffer->Visual.doubleBufferMode) {
+ if (buffer->BackLeftAlpha) {
+ FREE( buffer->BackLeftAlpha );
}
- buf->BackLeftAlpha = (GLchan *) MALLOC( bytes );
- if (!buf->BackLeftAlpha) {
+ buffer->BackLeftAlpha = (GLchan *) MALLOC( bytes );
+ if (!buffer->BackLeftAlpha) {
/* out of memory */
- _mesa_error( ctx, GL_OUT_OF_MEMORY,
+ _mesa_error( NULL, GL_OUT_OF_MEMORY,
"Couldn't allocate back-left alpha buffer" );
}
}
- if (ctx->Visual.stereoMode) {
- if (buf->FrontRightAlpha) {
- FREE( buf->FrontRightAlpha );
+ if (buffer->Visual.stereoMode) {
+ if (buffer->FrontRightAlpha) {
+ FREE( buffer->FrontRightAlpha );
}
- buf->FrontRightAlpha = (GLchan *) MALLOC( bytes );
- if (!buf->FrontRightAlpha) {
+ buffer->FrontRightAlpha = (GLchan *) MALLOC( bytes );
+ if (!buffer->FrontRightAlpha) {
/* out of memory */
- _mesa_error( ctx, GL_OUT_OF_MEMORY,
- "Couldn't allocate front-right alpha buffer" );
+ _mesa_error( NULL, GL_OUT_OF_MEMORY,
+ "Couldn't allocate front-right alpha buffer" );
}
- if (ctx->Visual.doubleBufferMode) {
- if (buf->BackRightAlpha) {
- FREE( buf->BackRightAlpha );
+ if (buffer->Visual.doubleBufferMode) {
+ if (buffer->BackRightAlpha) {
+ FREE( buffer->BackRightAlpha );
}
- buf->BackRightAlpha = (GLchan *) MALLOC( bytes );
- if (!buf->BackRightAlpha) {
+ buffer->BackRightAlpha = (GLchan *) MALLOC( bytes );
+ if (!buffer->BackRightAlpha) {
/* out of memory */
- _mesa_error( ctx, GL_OUT_OF_MEMORY,
- "Couldn't allocate back-right alpha buffer" );
+ _mesa_error( NULL, 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.
- */
-void
-_mesa_alloc_alpha_buffers( GLcontext *ctx )
-{
- alloc_alpha_buffers( ctx, ctx->DrawBuffer );
- if (ctx->ReadBuffer != ctx->DrawBuffer) {
- alloc_alpha_buffers( ctx, ctx->ReadBuffer );
+ 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;
}
}
-/* $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
- * 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
* copy of this software and associated documentation files (the "Software"),
extern void
-_mesa_alloc_alpha_buffers( GLcontext *ctx );
+_mesa_alloc_alpha_buffers( GLframebuffer *buffer );
extern void
-/* $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
void
-_swrast_alloc_buffers( GLcontext *ctx )
+_swrast_alloc_buffers( GLframebuffer *buffer )
{
/* Reallocate other buffers if needed. */
- if (ctx->DrawBuffer->UseSoftwareDepthBuffer) {
- _mesa_alloc_depth_buffer( ctx );
+ if (buffer->UseSoftwareDepthBuffer) {
+ _mesa_alloc_depth_buffer( buffer );
}
- if (ctx->DrawBuffer->UseSoftwareStencilBuffer) {
- _mesa_alloc_stencil_buffer( ctx );
+ if (buffer->UseSoftwareStencilBuffer) {
+ _mesa_alloc_stencil_buffer( buffer );
}
- if (ctx->DrawBuffer->UseSoftwareAccumBuffer) {
- _mesa_alloc_accum_buffer( ctx );
+ if (buffer->UseSoftwareAccumBuffer) {
+ _mesa_alloc_accum_buffer( buffer );
}
- if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) {
- _mesa_alloc_alpha_buffers( ctx );
+ if (buffer->UseSoftwareAlphaBuffers) {
+ _mesa_alloc_alpha_buffers( buffer );
}
}
-/* $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
* This function is only called through Driver.alloc_depth_buffer.
*/
void
-_mesa_alloc_depth_buffer( GLcontext *ctx )
+_mesa_alloc_depth_buffer( GLframebuffer *buffer )
{
- /* deallocate current depth buffer if present */
- if (ctx->DrawBuffer->UseSoftwareDepthBuffer) {
- GLint bytesPerValue;
+ GLint bytesPerValue;
- if (ctx->DrawBuffer->DepthBuffer) {
- FREE(ctx->DrawBuffer->DepthBuffer);
- ctx->DrawBuffer->DepthBuffer = NULL;
- }
+ ASSERT(buffer->UseSoftwareDepthBuffer);
- /* allocate new depth buffer, but don't initialize it */
- if (ctx->Visual.depthBits <= 16)
- bytesPerValue = sizeof(GLushort);
- else
- bytesPerValue = sizeof(GLuint);
+ /* deallocate current depth buffer if present */
+ if (buffer->DepthBuffer) {
+ FREE(buffer->DepthBuffer);
+ buffer->DepthBuffer = NULL;
+ }
+
+ /* allocate new depth buffer, but don't initialize it */
+ if (buffer->Visual.depthBits <= 16)
+ bytesPerValue = sizeof(GLushort);
+ else
+ bytesPerValue = sizeof(GLuint);
- ctx->DrawBuffer->DepthBuffer = MALLOC( ctx->DrawBuffer->Width
- * ctx->DrawBuffer->Height
- * bytesPerValue );
+ buffer->DepthBuffer =MALLOC(buffer->Width * buffer->Height * bytesPerValue);
- if (!ctx->DrawBuffer->DepthBuffer) {
- /* out of memory */
+ if (!buffer->DepthBuffer) {
+ /* out of memory */
+ GET_CURRENT_CONTEXT(ctx);
+ if (ctx) {
ctx->Depth.Test = GL_FALSE;
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");
}
}
}
-/* $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
extern void
-_mesa_alloc_depth_buffer( GLcontext* ctx );
+_mesa_alloc_depth_buffer( GLframebuffer *buffer );
extern void
-_mesa_clear_depth_buffer( GLcontext* ctx );
+_mesa_clear_depth_buffer( GLcontext *ctx );
#endif
-/* $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
* deallocated first. The new stencil buffer will be uninitialized.
*/
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 */
- if (ctx->DrawBuffer->Stencil) {
- FREE(ctx->DrawBuffer->Stencil);
- ctx->DrawBuffer->Stencil = NULL;
+ if (buffer->Stencil) {
+ FREE(buffer->Stencil);
+ buffer->Stencil = NULL;
}
/* allocate new stencil buffer */
- ctx->DrawBuffer->Stencil = (GLstencil *) MALLOC(buffersize * sizeof(GLstencil));
- if (!ctx->DrawBuffer->Stencil) {
+ buffer->Stencil = (GLstencil *) MALLOC(buffer->Width * buffer->Height
+ * sizeof(GLstencil));
+ if (!buffer->Stencil) {
/* out of memory */
-/* _mesa_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE ); */
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "_mesa_alloc_stencil_buffer" );
+ _mesa_error( NULL, GL_OUT_OF_MEMORY, "_mesa_alloc_stencil_buffer" );
}
}
-/* $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
extern void
-_mesa_alloc_stencil_buffer( GLcontext *ctx );
+_mesa_alloc_stencil_buffer( GLframebuffer *buffer );
extern void
-/* $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
GLfixed index, indexStep;
GLfixed z, zStep;
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];
- GLfloat rho[MAX_TEXTURE_UNITS]; /* for texture lambda/lod computation */
/**
* This bitmask (of SPAN_* flags) indicates which of the fragment arrays
/* These are the public-access functions exported from swrast.
*/
extern void
-_swrast_alloc_buffers( GLcontext *ctx );
+_swrast_alloc_buffers( GLframebuffer *buffer );
extern GLboolean
_swrast_CreateContext( GLcontext *ctx );