}
-/* Set the buffer used in double buffering */
-static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode )
+/* Set the buffer used for drawing */
+/* XXX support for separate read/draw buffers hasn't been tested */
+static GLboolean fxDDSetDrawBuffer(GLcontext *ctx, GLenum mode )
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
}
+/* Set the buffer used for reading */
+/* XXX support for separate read/draw buffers hasn't been tested */
+static void fxDDSetReadBuffer(GLcontext *ctx, GLframebuffer *buffer,
+ GLenum mode )
+{
+ fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
+ (void) buffer;
+
+ if (MESA_VERBOSE&VERBOSE_DRIVER) {
+ fprintf(stderr,"fxmesa: fxDDSetBuffer(%x)\n",mode);
+ }
+
+ if (mode == GL_FRONT_LEFT) {
+ fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
+ FX_grRenderBuffer(fxMesa->currentFB);
+ }
+ else if (mode == GL_BACK_LEFT) {
+ fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
+ FX_grRenderBuffer(fxMesa->currentFB);
+ }
+}
+
+
#ifdef XF86DRI
static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py)
{
ctx->Driver.Index=NULL;
ctx->Driver.Color=fxDDSetColor;
- ctx->Driver.SetBuffer=fxDDSetBuffer;
+ ctx->Driver.SetDrawBuffer=fxDDSetDrawBuffer;
+ ctx->Driver.SetReadBuffer=fxDDSetReadBuffer;
ctx->Driver.GetBufferSize=fxDDBufferSize;
ctx->Driver.Bitmap=fxDDDrawBitMap;
-/* $Id: osmesa.c,v 1.3 1999/11/11 01:28:41 brianp Exp $ */
+/* $Id: osmesa.c,v 1.4 1999/11/25 17:37:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
-static GLboolean set_buffer( GLcontext *ctx, GLenum mode )
+static GLboolean set_draw_buffer( GLcontext *ctx, GLenum mode )
{
(void) ctx;
if (mode==GL_FRONT_LEFT) {
}
+static void set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode )
+{
+ /* separate read buffer not supported */
+ ASSERT(buffer == ctx->DrawBuffer);
+ ASSERT(mode == GL_FRONT_LEFT);
+}
+
+
static void clear_index( GLcontext *ctx, GLuint index )
{
OSMesaContext osmesa = (OSMesaContext) ctx->DriverCtx;
ctx->Driver.GetString = get_string;
ctx->Driver.UpdateState = osmesa_update_state;
- ctx->Driver.SetBuffer = set_buffer;
+ ctx->Driver.SetDrawBuffer = set_draw_buffer;
+ ctx->Driver.SetReadBuffer = set_read_buffer;
ctx->Driver.Color = set_color;
ctx->Driver.Index = set_index;
ctx->Driver.ClearIndex = clear_index;
-/* $Id: accum.c,v 1.12 1999/11/24 18:48:30 brianp Exp $ */
+/* $Id: accum.c,v 1.13 1999/11/25 17:36:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
break;
case GL_ACCUM:
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
/* May have to leave optimized accum buffer mode */
if (ctx->IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0)
ypos++;
}
}
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DriverDrawBuffer );
+ /* restore read buffer = draw buffer (the default) */
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ ctx->Color.DriverDrawBuffer );
break;
case GL_LOAD:
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
/* This is a change to go into optimized accum buffer mode */
if (value > 0.0 && value <= 1.0) {
ypos++;
}
}
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DriverDrawBuffer );
+
+ /* restore read buffer = draw buffer (the default) */
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ ctx->Color.DriverDrawBuffer );
break;
case GL_RETURN:
-/* $Id: dd.h,v 1.5 1999/11/22 21:54:14 brianp Exp $ */
+/* $Id: dd.h,v 1.6 1999/11/25 17:36:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
* This color should also be used in the "mono" drawing functions.
*/
- GLboolean (*SetBuffer)( GLcontext *ctx, GLenum buffer );
+ GLboolean (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer );
/*
- * Selects the color buffer(s) for reading and writing.
+ * Specifies the current buffer for writing.
* The following values must be accepted when applicable:
* GL_FRONT_LEFT - this buffer always exists
* GL_BACK_LEFT - when double buffering
* GL_NONE - disable buffer write in device driver.
*/
+ void (*SetReadBuffer)( GLcontext *ctx, GLframebuffer *colorBuffer,
+ GLenum buffer );
+ /*
+ * Specifies the current buffer for reading.
+ * colorBuffer will be one of:
+ * GL_FRONT_LEFT - this buffer always exists
+ * GL_BACK_LEFT - when double buffering
+ * GL_FRONT_RIGHT - when using stereo
+ * GL_BACK_RIGHT - when using stereo and double buffering
+ */
+
void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
/*
* Returns the width and height of the current color buffer.
-/* $Id: teximage.c,v 1.13 1999/11/24 18:48:31 brianp Exp $ */
+/* $Id: teximage.c,v 1.14 1999/11/25 17:36:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
return NULL;
/* Select buffer to read from */
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
dst = image;
stride = width * 4 * sizeof(GLubyte);
dst += stride;
}
- /* Restore drawing buffer */
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DriverDrawBuffer );
+ /* Read from draw buffer (the default) */
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ ctx->Color.DriverDrawBuffer );
return image;
}
components = components_in_intformat( format );
/* Select buffer to read from */
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
for (i = 0;i < height; i++) {
GLubyte rgba[MAX_WIDTH][4];
&packing, GL_TRUE);
}
- /* Restore drawing buffer */
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DriverDrawBuffer );
+ /* Read from draw buffer (the default) */
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ ctx->Color.DriverDrawBuffer );
}