From cea0e8e6700e871bb9bcb334cb75fbfbfcdfd702 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Nov 1999 17:36:48 +0000 Subject: replaced Driver.SetBuffer() with SetDrawBuffer() and SetReadBuffer() --- src/mesa/main/accum.c | 17 ++++++++++++----- src/mesa/main/dd.h | 17 ++++++++++++++--- src/mesa/main/teximage.c | 18 +++++++++++------- 3 files changed, 37 insertions(+), 15 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 8e6f3cae0f..81af5f6068 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -1,4 +1,4 @@ -/* $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 @@ -221,7 +221,8 @@ _mesa_Accum( GLenum op, GLfloat value ) 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) @@ -269,11 +270,14 @@ _mesa_Accum( GLenum op, GLfloat value ) 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) { @@ -328,7 +332,10 @@ _mesa_Accum( GLenum op, GLfloat value ) 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: diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 55b973e43c..5dc04fb6fc 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $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 @@ -180,9 +180,9 @@ struct dd_function_table { * 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 @@ -200,6 +200,17 @@ struct dd_function_table { * 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. diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 56955af6c8..2db59c0d7f 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $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 @@ -1627,7 +1627,8 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, 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); @@ -1637,8 +1638,9 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, 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; } @@ -1728,7 +1730,8 @@ copy_tex_sub_image( GLcontext *ctx, struct gl_texture_image *dest, 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]; @@ -1740,8 +1743,9 @@ copy_tex_sub_image( GLcontext *ctx, struct gl_texture_image *dest, &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 ); } -- cgit v1.2.3