diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/buffers.c | 108 | ||||
-rw-r--r-- | src/mesa/main/context.c | 119 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 8 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 26 |
4 files changed, 205 insertions, 56 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 2bf691dd08e..efb35531680 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -1,4 +1,4 @@ -/* $Id: buffers.c,v 1.40 2002/10/11 15:17:12 brianp Exp $ */ +/* $Id: buffers.c,v 1.41 2002/10/11 17:41:03 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -151,13 +151,6 @@ _mesa_DrawBuffer( GLenum mode ) * Do error checking and compute the _DrawDestMask bitfield. */ switch (mode) { - case GL_AUX0: - case GL_AUX1: - case GL_AUX2: - case GL_AUX3: - /* AUX buffers not implemented in Mesa at this time */ - _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); - return; case GL_RIGHT: if (!ctx->Visual.stereoMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); @@ -175,11 +168,7 @@ _mesa_DrawBuffer( GLenum mode ) ctx->Color._DrawDestMask = FRONT_RIGHT_BIT; break; case GL_BACK_RIGHT: - if (!ctx->Visual.stereoMode) { - _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); - return; - } - if (!ctx->Visual.doubleBufferMode) { + if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } @@ -235,6 +224,42 @@ _mesa_DrawBuffer( GLenum mode ) /* never an error */ ctx->Color._DrawDestMask = 0; break; + case GL_AUX0: + if (ctx->Const.NumAuxBuffers >= 1) { + ctx->Color._DrawDestMask = AUX0_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX0)" ); + return; + } + break; + case GL_AUX1: + if (ctx->Const.NumAuxBuffers >= 2) { + ctx->Color._DrawDestMask = AUX1_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX1)" ); + return; + } + break; + case GL_AUX2: + if (ctx->Const.NumAuxBuffers >= 3) { + ctx->Color._DrawDestMask = AUX2_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX2)" ); + return; + } + break; + case GL_AUX3: + if (ctx->Const.NumAuxBuffers >= 4) { + ctx->Color._DrawDestMask = AUX3_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX3)" ); + return; + } + break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" ); return; @@ -261,22 +286,15 @@ _mesa_ReadBuffer( GLenum mode ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode)); - if (ctx->Pixel.ReadBuffer == mode) - return; /* no change */ - + /* + * Do error checking and compute ctx->Pixel._ReadSrcMask. + */ switch (mode) { - case GL_AUX0: - case GL_AUX1: - case GL_AUX2: - case GL_AUX3: - /* AUX buffers not implemented in Mesa at this time */ - _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); - return; case GL_LEFT: case GL_FRONT: case GL_FRONT_LEFT: /* Front-Left buffer, always exists */ - ctx->Pixel._DriverReadBuffer = GL_FRONT_LEFT; + ctx->Pixel._ReadSrcMask = FRONT_LEFT_BIT; break; case GL_BACK: case GL_BACK_LEFT: @@ -285,7 +303,7 @@ _mesa_ReadBuffer( GLenum mode ) _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } - ctx->Pixel._DriverReadBuffer = GL_BACK_LEFT; + ctx->Pixel._ReadSrcMask = BACK_LEFT_BIT; break; case GL_FRONT_RIGHT: case GL_RIGHT: @@ -293,14 +311,50 @@ _mesa_ReadBuffer( GLenum mode ) _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } - ctx->Pixel._DriverReadBuffer = GL_FRONT_RIGHT; + ctx->Pixel._ReadSrcMask = FRONT_RIGHT_BIT; break; case GL_BACK_RIGHT: if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } - ctx->Pixel._DriverReadBuffer = GL_BACK_RIGHT; + ctx->Pixel._ReadSrcMask = BACK_RIGHT_BIT; + break; + case GL_AUX0: + if (ctx->Const.NumAuxBuffers >= 1) { + ctx->Pixel._ReadSrcMask = AUX0_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX0)" ); + return; + } + break; + case GL_AUX1: + if (ctx->Const.NumAuxBuffers >= 2) { + ctx->Pixel._ReadSrcMask = AUX1_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX1)" ); + return; + } + break; + case GL_AUX2: + if (ctx->Const.NumAuxBuffers >= 3) { + ctx->Pixel._ReadSrcMask = AUX2_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX2)" ); + return; + } + break; + case GL_AUX3: + if (ctx->Const.NumAuxBuffers >= 4) { + ctx->Pixel._ReadSrcMask = AUX3_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX3)" ); + return; + } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glReadBuffer" ); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index cac01e4d8e6..e9c82c91be7 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.182 2002/10/10 00:22:13 brianp Exp $ */ +/* $Id: context.c,v 1.183 2002/10/11 17:41:03 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1714,17 +1714,15 @@ _mesa_initialize_context( GLcontext *ctx, if (visual->doubleBufferMode) { ctx->Color.DrawBuffer = GL_BACK; - ctx->Color._DriverDrawBuffer = GL_BACK_LEFT; ctx->Color._DrawDestMask = BACK_LEFT_BIT; ctx->Pixel.ReadBuffer = GL_BACK; - ctx->Pixel._DriverReadBuffer = GL_BACK_LEFT; + ctx->Pixel._ReadSrcMask = BACK_LEFT_BIT; } else { ctx->Color.DrawBuffer = GL_FRONT; - ctx->Color._DriverDrawBuffer = GL_FRONT_LEFT; ctx->Color._DrawDestMask = FRONT_LEFT_BIT; ctx->Pixel.ReadBuffer = GL_FRONT; - ctx->Pixel._DriverReadBuffer = GL_FRONT_LEFT; + ctx->Pixel._ReadSrcMask = FRONT_LEFT_BIT; } if (!alloc_proxy_textures(ctx)) { @@ -1732,17 +1730,106 @@ _mesa_initialize_context( GLcontext *ctx, return GL_FALSE; } - /* register the most recent extension functions with libGL */ - _glapi_add_entrypoint("glTbufferMask3DFX", 553); - _glapi_add_entrypoint("glCompressedTexImage3DARB", 554); - _glapi_add_entrypoint("glCompressedTexImage2DARB", 555); - _glapi_add_entrypoint("glCompressedTexImage1DARB", 556); - _glapi_add_entrypoint("glCompressedTexSubImage3DARB", 557); - _glapi_add_entrypoint("glCompressedTexSubImage2DARB", 558); - _glapi_add_entrypoint("glCompressedTexSubImage1DARB", 559); - _glapi_add_entrypoint("glGetCompressedTexImageARB", 560); - /* XXX we should add a bunch of new functions here */ - + /* + * For XFree86/DRI: tell libGL to add these functions to the dispatcher. + * Basically, we should add all extension functions above offset 577. + * This enables older libGL libraries to work with newer drivers that + * have newer extensions. + */ + /* GL_ARB_window_pos aliases with GL_MESA_window_pos */ + _glapi_add_entrypoint("glWindowPos2dARB", 513); + _glapi_add_entrypoint("glWindowPos2dvARB", 514); + _glapi_add_entrypoint("glWindowPos2fARB", 515); + _glapi_add_entrypoint("glWindowPos2fvARB", 516); + _glapi_add_entrypoint("glWindowPos2iARB", 517); + _glapi_add_entrypoint("glWindowPos2ivARB", 518); + _glapi_add_entrypoint("glWindowPos2sARB", 519); + _glapi_add_entrypoint("glWindowPos2svARB", 520); + _glapi_add_entrypoint("glWindowPos3dARB", 521); + _glapi_add_entrypoint("glWindowPos3dvARB", 522); + _glapi_add_entrypoint("glWindowPos3fARB", 523); + _glapi_add_entrypoint("glWindowPos3fvARB", 524); + _glapi_add_entrypoint("glWindowPos3iARB", 525); + _glapi_add_entrypoint("glWindowPos3ivARB", 526); + _glapi_add_entrypoint("glWindowPos3sARB", 527); + _glapi_add_entrypoint("glWindowPos3svARB", 528); + /* new extension functions */ + _glapi_add_entrypoint("glAreProgramsResidentNV", 578); + _glapi_add_entrypoint("glBindProgramNV", 579); + _glapi_add_entrypoint("glDeleteProgramsNV", 580); + _glapi_add_entrypoint("glExecuteProgramNV", 581); + _glapi_add_entrypoint("glGenProgramsNV", 582); + _glapi_add_entrypoint("glGetProgramParameterdvNV", 583); + _glapi_add_entrypoint("glGetProgramParameterfvNV", 584); + _glapi_add_entrypoint("glGetProgramivNV", 585); + _glapi_add_entrypoint("glGetProgramStringNV", 586); + _glapi_add_entrypoint("glGetTrackMatrixivNV", 587); + _glapi_add_entrypoint("glGetVertexAttribdvNV", 588); + _glapi_add_entrypoint("glGetVertexAttribfvNV", 589); + _glapi_add_entrypoint("glGetVertexAttribivNV", 590); + _glapi_add_entrypoint("glGetVertexAttribPointervNV", 591); + _glapi_add_entrypoint("glIsProgramNV", 592); + _glapi_add_entrypoint("glLoadProgramNV", 593); + _glapi_add_entrypoint("glProgramParameter4dNV", 594); + _glapi_add_entrypoint("glProgramParameter4dvNV", 595); + _glapi_add_entrypoint("glProgramParameter4fNV", 596); + _glapi_add_entrypoint("glProgramParameter4fvNV", 597); + _glapi_add_entrypoint("glProgramParameters4dvNV", 598); + _glapi_add_entrypoint("glProgramParameters4fvNV", 599); + _glapi_add_entrypoint("glRequestResidentProgramsNV", 600); + _glapi_add_entrypoint("glTrackMatrixNV", 601); + _glapi_add_entrypoint("glVertexAttribPointerNV", 602); + _glapi_add_entrypoint("glVertexAttrib1dNV", 603); + _glapi_add_entrypoint("glVertexAttrib1dvNV", 604); + _glapi_add_entrypoint("glVertexAttrib1fNV", 605); + _glapi_add_entrypoint("glVertexAttrib1fvNV", 606); + _glapi_add_entrypoint("glVertexAttrib1sNV", 607); + _glapi_add_entrypoint("glVertexAttrib1svNV", 608); + _glapi_add_entrypoint("glVertexAttrib2dNV", 609); + _glapi_add_entrypoint("glVertexAttrib2dvNV", 610); + _glapi_add_entrypoint("glVertexAttrib2fNV", 611); + _glapi_add_entrypoint("glVertexAttrib2fvNV", 612); + _glapi_add_entrypoint("glVertexAttrib2sNV", 613); + _glapi_add_entrypoint("glVertexAttrib2svNV", 614); + _glapi_add_entrypoint("glVertexAttrib3dNV", 615); + _glapi_add_entrypoint("glVertexAttrib3dvNV", 616); + _glapi_add_entrypoint("glVertexAttrib3fNV", 617); + _glapi_add_entrypoint("glVertexAttrib3fvNV", 618); + _glapi_add_entrypoint("glVertexAttrib3sNV", 619); + _glapi_add_entrypoint("glVertexAttrib3svNV", 620); + _glapi_add_entrypoint("glVertexAttrib4dNV", 621); + _glapi_add_entrypoint("glVertexAttrib4dvNV", 622); + _glapi_add_entrypoint("glVertexAttrib4fNV", 623); + _glapi_add_entrypoint("glVertexAttrib4fvNV", 624); + _glapi_add_entrypoint("glVertexAttrib4sNV", 625); + _glapi_add_entrypoint("glVertexAttrib4svNV", 626); + _glapi_add_entrypoint("glVertexAttrib4ubNV", 627); + _glapi_add_entrypoint("glVertexAttrib4ubvNV", 628); + _glapi_add_entrypoint("glVertexAttribs1dvNV", 629); + _glapi_add_entrypoint("glVertexAttribs1fvNV", 630); + _glapi_add_entrypoint("glVertexAttribs1svNV", 631); + _glapi_add_entrypoint("glVertexAttribs2dvNV", 632); + _glapi_add_entrypoint("glVertexAttribs2fvNV", 633); + _glapi_add_entrypoint("glVertexAttribs2svNV", 634); + _glapi_add_entrypoint("glVertexAttribs3dvNV", 635); + _glapi_add_entrypoint("glVertexAttribs3fvNV", 636); + _glapi_add_entrypoint("glVertexAttribs3svNV", 637); + _glapi_add_entrypoint("glVertexAttribs4dvNV", 638); + _glapi_add_entrypoint("glVertexAttribs4fvNV", 639); + _glapi_add_entrypoint("glVertexAttribs4svNV", 640); + _glapi_add_entrypoint("glVertexAttribs4ubvNV", 641); + _glapi_add_entrypoint("glPointParameteriNV", 642); + _glapi_add_entrypoint("glPointParameterivNV", 643); + _glapi_add_entrypoint("glMultiDrawArraysEXT", 644); + _glapi_add_entrypoint("glMultiDrawElementsEXT", 645); + _glapi_add_entrypoint("glActiveStencilFaceEXT", 646); + _glapi_add_entrypoint("glDeleteFencesNV", 647); + _glapi_add_entrypoint("glGenFencesNV", 648); + _glapi_add_entrypoint("glIsFenceNV", 649); + _glapi_add_entrypoint("glTestFenceNV", 650); + _glapi_add_entrypoint("glGetFenceivNV", 651); + _glapi_add_entrypoint("glFinishFenceNV", 652); + _glapi_add_entrypoint("glSetFenceNV", 653); /* Find the larger of Mesa's dispatch table and libGL's dispatch table. * In practice, this'll be the same for stand-alone Mesa. But for DRI diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index fc02a15620b..d6f0da1c69e 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.73 2002/10/04 19:10:07 brianp Exp $ */ +/* $Id: dd.h,v 1.74 2002/10/11 17:41:04 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -38,9 +38,13 @@ struct gl_pixelstore_attrib; #define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */ #define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */ #define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */ +#define DD_AUX0 AUX0_BIT /* future use */ +#define DD_AUX1 AUX1_BIT /* future use */ +#define DD_AUX2 AUX2_BIT /* future use */ +#define DD_AUX3 AUX3_BIT /* future use */ #define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */ -#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */ #define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */ +#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */ /* diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 7d43de19fb5..10f8e2bf57d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.95 2002/10/09 23:56:32 brianp Exp $ */ +/* $Id: mtypes.h,v 1.96 2002/10/11 17:41:04 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -301,13 +301,16 @@ struct gl_accum_attrib { /* - * Used in DrawDestMask below + * Used in _DrawDestMask and _ReadSrcMask below to identify color buffers. */ -#define FRONT_LEFT_BIT 1 -#define FRONT_RIGHT_BIT 2 -#define BACK_LEFT_BIT 4 -#define BACK_RIGHT_BIT 8 - +#define FRONT_LEFT_BIT 0x1 +#define FRONT_RIGHT_BIT 0x2 +#define BACK_LEFT_BIT 0x4 +#define BACK_RIGHT_BIT 0x8 +#define AUX0_BIT 0x10 +#define AUX1_BIT 0x20 +#define AUX2_BIT 0x40 +#define AUX3_BIT 0x80 struct gl_colorbuffer_attrib { GLuint ClearIndex; /* Index to use for glClear */ @@ -316,9 +319,8 @@ struct gl_colorbuffer_attrib { GLuint IndexMask; /* Color index write mask */ GLubyte ColorMask[4]; /* Each flag is 0xff or 0x0 */ - GLenum DrawBuffer; /* Which buffer to draw into */ - GLenum _DriverDrawBuffer; /* Single src/dst buffer for drivers */ - GLubyte _DrawDestMask; /* bitwise-OR of bitflags above */ + GLenum DrawBuffer; /* Which buffer to draw into */ + GLubyte _DrawDestMask; /* bitwise-OR of FRONT/BACK_LEFT/RIGHT_BITs */ /* alpha testing */ GLboolean AlphaEnabled; /* Alpha test enabled flag */ @@ -598,7 +600,9 @@ struct gl_multisample_attrib { struct gl_pixel_attrib { GLenum ReadBuffer; /* src buffer for glRead/CopyPixels */ - GLenum _DriverReadBuffer; /* Driver's current source buffer */ + GLubyte _ReadSrcMask; /* Not really a mask, but like _DrawDestMask */ + /* May be: FRONT_LEFT_BIT, BACK_LEFT_BIT, */ + /* FRONT_RIGHT_BIT or BACK_RIGHT_BIT. */ GLfloat RedBias, RedScale; GLfloat GreenBias, GreenScale; GLfloat BlueBias, BlueScale; |