summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dos/dmesa.c9
-rw-r--r--src/mesa/drivers/glide/fxdd.c25
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c16
-rw-r--r--src/mesa/drivers/svga/svgamesa.c5
-rw-r--r--src/mesa/drivers/windows/wmesa.c9
-rw-r--r--src/mesa/drivers/x11/xm_api.c12
-rw-r--r--src/mesa/drivers/x11/xm_dd.c111
-rw-r--r--src/mesa/drivers/x11/xmesaP.h4
-rw-r--r--src/mesa/main/buffers.c60
-rw-r--r--src/mesa/main/context.c9
-rw-r--r--src/mesa/main/dd.h22
-rw-r--r--src/mesa/main/glheader.h10
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/main/state.c4
-rw-r--r--src/mesa/swrast/s_accum.c41
-rw-r--r--src/mesa/swrast/s_accum.h9
-rw-r--r--src/mesa/swrast/s_alphabuf.c103
-rw-r--r--src/mesa/swrast/s_alphabuf.h8
-rw-r--r--src/mesa/swrast/s_buffers.c20
-rw-r--r--src/mesa/swrast/s_depth.c42
-rw-r--r--src/mesa/swrast/s_depth.h11
-rw-r--r--src/mesa/swrast/s_stencil.c24
-rw-r--r--src/mesa/swrast/s_stencil.h8
-rw-r--r--src/mesa/swrast/swrast.h4
24 files changed, 305 insertions, 265 deletions
diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c
index 454b891c08b..d150cdca5ac 100644
--- a/src/mesa/drivers/dos/dmesa.c
+++ b/src/mesa/drivers/dos/dmesa.c
@@ -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
* 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;
*width = c->Buffer->width;
@@ -636,7 +641,7 @@ void dmesa_init_pointers (GLcontext *ctx)
ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.Bitmap = _swrast_Bitmap;
ctx->Driver.Clear = clear;
- ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
+ ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.CopyPixels = _swrast_CopyPixels;
ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = _swrast_ReadPixels;
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 720ef41d3fc..1653b6e4636 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -1,4 +1,4 @@
-/* $Id: fxdd.c,v 1.84 2001/09/23 16:50:01 brianp Exp $ */
+/* $Id: fxdd.c,v 1.84.2.1 2002/03/16 00:50:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -103,19 +103,22 @@ fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
/* 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");
+ }
}
}
@@ -1002,7 +1005,7 @@ fxSetupDDPointers(GLcontext * ctx)
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;
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 4a461fee1c4..34de8226ce4 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,4 +1,4 @@
-/* $Id: osmesa.c,v 1.71.2.2 2002/03/01 19:37:28 brianp Exp $ */
+/* $Id: osmesa.c,v 1.71.2.3 2002/03/16 00:50:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -876,11 +876,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);
- *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;
+ }
}
@@ -2024,8 +2028,8 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state )
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.GetBufferSize = buffer_size;
+ ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.Bitmap = _swrast_Bitmap;
diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c
index db97d20194c..d31a237dd94 100644
--- a/src/mesa/drivers/svga/svgamesa.c
+++ b/src/mesa/drivers/svga/svgamesa.c
@@ -1,4 +1,4 @@
-/* $Id: svgamesa.c,v 1.16 2001/09/23 16:11:27 brianp Exp $ */
+/* $Id: svgamesa.c,v 1.16.2.1 2002/03/16 00:50:12 brianp Exp $ */
/*
* 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();
*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.SetDrawBuffer = set_draw_buffer;
+ ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
/* Software rasterizer pixel paths:
*/
diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c
index e9677c5ff11..a194df21f2a 100644
--- a/src/mesa/drivers/windows/wmesa.c
+++ b/src/mesa/drivers/windows/wmesa.c
@@ -1,4 +1,4 @@
-/* $Id: wmesa.c,v 1.22.2.3 2002/01/16 15:37:49 kschultz Exp $ */
+/* $Id: wmesa.c,v 1.22.2.4 2002/03/16 00:50:12 brianp Exp $ */
/*
* 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. */
-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;
@@ -1021,7 +1022,7 @@ static void SetFunctionPointers(GLcontext *ctx)
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;
@@ -1100,7 +1101,7 @@ static void wmesa_update_state( GLcontext *ctx, GLuint new_state )
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;
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 350746be29c..94024289d43 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1,4 +1,4 @@
-/* $Id: xm_api.c,v 1.29.2.5 2002/03/12 21:54:03 brianp Exp $ */
+/* $Id: xm_api.c,v 1.29.2.6 2002/03/16 00:50:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -2629,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) );
+
+}
+
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index dff18961f01..fe33092803a 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -1,4 +1,4 @@
-/* $Id: xm_dd.c,v 1.26.2.3 2002/03/01 04:25:42 brianp Exp $ */
+/* $Id: xm_dd.c,v 1.26.2.4 2002/03/16 00:50:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -48,17 +48,18 @@
/*
- * 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;
@@ -66,58 +67,19 @@ get_buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
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);
- }
}
@@ -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
@@ -951,7 +954,7 @@ void xmesa_init_pointers( GLcontext *ctx )
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;
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 9127025d682..1103d33ef11 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -1,4 +1,4 @@
-/* $Id: xmesaP.h,v 1.24.2.2 2002/03/12 21:54:04 brianp Exp $ */
+/* $Id: xmesaP.h,v 1.24.2.3 2002/03/16 00:50:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -532,4 +532,6 @@ extern void XMesaReset( void );
extern void xmesa_set_read_buffer( GLcontext *ctx,
GLframebuffer *buffer, GLenum mode );
+extern void xmesa_resize_buffers( GLframebuffer *buffer );
+
#endif
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 2fa540250ab..a8cca41a81d 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,10 +1,10 @@
-/* $Id: buffers.c,v 1.31 2001/09/14 21:36:43 brianp Exp $ */
+/* $Id: buffers.c,v 1.31.2.1 2002/03/16 00:50:11 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"),
@@ -341,33 +341,59 @@ _mesa_ReadBuffer( GLenum mode )
/*
* 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 */
+ }
}
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 76b3a6b1470..36d690fdef5 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,10 +1,10 @@
-/* $Id: context.c,v 1.148.2.1 2001/11/06 15:51:06 brianp Exp $ */
+/* $Id: context.c,v 1.148.2.2 2002/03/16 00:50:12 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"),
@@ -2046,6 +2046,9 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *where )
fprintf(stderr, "Mesa user error: %s in %s\n", errstr, where);
}
+ if (!ctx)
+ return;
+
if (ctx->ErrorValue == GL_NO_ERROR) {
ctx->ErrorValue = error;
}
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 88849b099a9..a00a67b31cb 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.62.2.1 2002/02/12 17:37:26 keithw Exp $ */
+/* $Id: dd.h,v 1.62.2.2 2002/03/16 00:50:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,6 +31,8 @@
/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
+#include "macros.h"
+
struct gl_pixelstore_attrib;
/* Mask bits sent to the driver Clear() function */
@@ -97,9 +99,18 @@ struct dd_function_table {
* GL_NONE - disable buffer write in device driver.
*/
- void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
+ void (*GetBufferSize)( GLframebuffer *buffer,
+ GLuint *width, GLuint *height );
+ /*
+ * Returns the width and height of the named buffer/window.
+ * Mesa uses this to determine when the driver's window size has changed.
+ */
+
+ void (*ResizeBuffers)( GLframebuffer *buffer );
/*
- * Returns the width and height of the current color buffer.
+ * Resize the driver's depth/stencil/accum/back buffers to match the
+ * size given in the GLframebuffer struct. This is typically called
+ * when Mesa detects that a window size has changed.
*/
void (*Finish)( GLcontext *ctx );
@@ -164,9 +175,6 @@ struct dd_function_table {
/* This is called by glBitmap. Works the same as DrawPixels, above.
*/
- void (*ResizeBuffersMESA)( GLcontext *ctx );
-
-
/***
*** Texture image functions:
***/
@@ -470,6 +478,8 @@ struct dd_function_table {
void (*BlendFuncSeparate)(GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA);
+ void (*BlendConstColor)(GLcontext *ctx, GLfloat red, GLfloat green,
+ GLfloat blue, GLfloat alpha);
void (*ClearColor)(GLcontext *ctx, const GLchan color[4]);
void (*ClearDepth)(GLcontext *ctx, GLclampd d);
void (*ClearIndex)(GLcontext *ctx, GLuint index);
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 7257432bcb6..37374d320c0 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -1,4 +1,4 @@
-/* $Id: glheader.h,v 1.23.2.1 2001/12/20 18:58:24 kschultz Exp $ */
+/* $Id: glheader.h,v 1.23.2.2 2002/03/16 00:50:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -261,12 +261,4 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
typedef union { GLfloat f; GLint i; } fi_type;
-#ifndef GL_MIRRORED_REPEAT_ARB
-#define GL_MIRRORED_REPEAT_ARB 0x8370
-#endif
-#ifndef GL_ARB_texture_mirrored_repeat
-#define GL_ARB_texture_mirrored_repeat 1
-#endif
-
-
#endif /* GLHEADER_H */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a737de30050..cab6879345c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.51.2.2 2002/02/12 17:37:26 keithw Exp $ */
+/* $Id: mtypes.h,v 1.51.2.3 2002/03/16 00:50:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1126,7 +1126,7 @@ struct gl_shared_state {
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;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 56e9a08eeef..141c176459c 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.69.2.1 2002/02/12 17:37:26 keithw Exp $ */
+/* $Id: state.c,v 1.69.2.2 2002/03/16 00:50:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -955,7 +955,7 @@ void _mesa_update_state( GLcontext *ctx )
ASSERT(ctx->Driver.ReadPixels);
ASSERT(ctx->Driver.CopyPixels);
ASSERT(ctx->Driver.Bitmap);
- ASSERT(ctx->Driver.ResizeBuffersMESA);
+ ASSERT(ctx->Driver.ResizeBuffers);
ASSERT(ctx->Driver.TexImage1D);
ASSERT(ctx->Driver.TexImage2D);
ASSERT(ctx->Driver.TexImage3D);
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index 5b7936b210a..3dcca858cbb 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -1,10 +1,10 @@
-/* $Id: s_accum.c,v 1.13 2001/09/19 20:30:44 kschultz Exp $ */
+/* $Id: s_accum.c,v 1.13.2.1 2002/03/16 00:50:14 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"),
@@ -66,39 +66,38 @@
#define USE_OPTIMIZED_ACCUM /* enable the optimization */
#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
diff --git a/src/mesa/swrast/s_accum.h b/src/mesa/swrast/s_accum.h
index 014ca98b94b..6ffa6c895a8 100644
--- a/src/mesa/swrast/s_accum.h
+++ b/src/mesa/swrast/s_accum.h
@@ -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.3.2.1 2002/03/16 00:50:14 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"),
@@ -34,12 +34,11 @@
extern void
-_mesa_alloc_accum_buffer( GLcontext *ctx );
+_mesa_alloc_accum_buffer( GLframebuffer *buffer );
extern void
_mesa_clear_accum_buffer( GLcontext *ctx );
-
#endif
diff --git a/src/mesa/swrast/s_alphabuf.c b/src/mesa/swrast/s_alphabuf.c
index 2a066aeee70..7d70ab23bb5 100644
--- a/src/mesa/swrast/s_alphabuf.c
+++ b/src/mesa/swrast/s_alphabuf.c
@@ -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.8.2.1 2002/03/16 00:50:14 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"),
@@ -38,8 +38,6 @@
#include "s_alphabuf.h"
-
-
#define ALPHA_DRAW_ADDR(X,Y) \
(ctx->DrawBuffer->Alpha + (Y) * ctx->DrawBuffer->Width + (X))
@@ -47,85 +45,72 @@
(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;
}
}
diff --git a/src/mesa/swrast/s_alphabuf.h b/src/mesa/swrast/s_alphabuf.h
index 889a6c94e6b..a7593cf18bf 100644
--- a/src/mesa/swrast/s_alphabuf.h
+++ b/src/mesa/swrast/s_alphabuf.h
@@ -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.3.2.1 2002/03/16 00:50:14 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"),
@@ -34,7 +34,7 @@
extern void
-_mesa_alloc_alpha_buffers( GLcontext *ctx );
+_mesa_alloc_alpha_buffers( GLframebuffer *buffer );
extern void
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index 409c3f64422..0099a2127d9 100644
--- a/src/mesa/swrast/s_buffers.c
+++ b/src/mesa/swrast/s_buffers.c
@@ -1,4 +1,4 @@
-/* $Id: s_buffers.c,v 1.8 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: s_buffers.c,v 1.8.2.1 2002/03/16 00:50:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -242,19 +242,19 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask,
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 );
}
}
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 5001081ae04..30301ed92b8 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -1,4 +1,4 @@
-/* $Id: s_depth.c,v 1.9 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: s_depth.c,v 1.9.2.1 2002/03/16 00:50:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1484,35 +1484,35 @@ _mesa_read_depth_span_float( GLcontext *ctx,
/*
* Allocate a new depth buffer. If there's already a depth buffer allocated
* it will be free()'d. The new depth buffer will be uniniitalized.
- * 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");
}
}
}
diff --git a/src/mesa/swrast/s_depth.h b/src/mesa/swrast/s_depth.h
index 4d53de350f1..a8c436bc695 100644
--- a/src/mesa/swrast/s_depth.h
+++ b/src/mesa/swrast/s_depth.h
@@ -1,10 +1,10 @@
-/* $Id: s_depth.h,v 1.3 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_depth.h,v 1.3.2.1 2002/03/16 00:50:14 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"),
@@ -58,12 +58,11 @@ _mesa_read_depth_span_float( GLcontext *ctx, GLint n, GLint x, GLint y,
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
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index 2a94be5cd51..d942bd137dd 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -1,10 +1,10 @@
-/* $Id: s_stencil.c,v 1.12.2.1 2002/01/08 14:56:33 brianp Exp $ */
+/* $Id: s_stencil.c,v 1.12.2.2 2002/03/16 00:50:14 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"),
@@ -1109,22 +1109,20 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
* 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" );
}
}
diff --git a/src/mesa/swrast/s_stencil.h b/src/mesa/swrast/s_stencil.h
index 30394a90594..407675de5d5 100644
--- a/src/mesa/swrast/s_stencil.h
+++ b/src/mesa/swrast/s_stencil.h
@@ -1,10 +1,10 @@
-/* $Id: s_stencil.h,v 1.3 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_stencil.h,v 1.3.2.1 2002/03/16 00:50:14 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"),
@@ -54,7 +54,7 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
extern void
-_mesa_alloc_stencil_buffer( GLcontext *ctx );
+_mesa_alloc_stencil_buffer( GLframebuffer *buffer );
extern void
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index 76453cdaef9..231fdb43fe5 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -1,4 +1,4 @@
-/* $Id: swrast.h,v 1.12 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: swrast.h,v 1.12.2.1 2002/03/16 00:50:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -73,7 +73,7 @@ struct swrast_device_driver;
/* 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 );