diff options
author | Brian Paul <[email protected]> | 2002-10-11 17:41:03 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-10-11 17:41:03 +0000 |
commit | 8ad1076dc2afda8ed37e5a9f6a757583eba90375 (patch) | |
tree | 30bc52e2db6e089972d441a53c070e8377cb684d | |
parent | 9e84910749744efcba06670f622cc00d279f26f1 (diff) |
Another round of glRead/DrawBuffer() clean-ups and simplifications.
Replaced ctx->Color._DriverDrawBuffer with swrast->CurrentBuffer.
Replaced ctx->Pixel._DriverReadBuffer with ctx->Pixel._ReadSrcMask.
swrast->Driver.SetBuffer() takes FRONT/BACK_LEFT/RIGHT_BIT values now.
Added tokens and code for GL_AUX buffers, for completeness.
-rw-r--r-- | src/mesa/drivers/allegro/amesa.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/d3d/NullProcs.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/ggimesa.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxddspan.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/osmesa/osmesa.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/windows/wmesa.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 11 | ||||
-rw-r--r-- | src/mesa/glapi/glapi.c | 49 | ||||
-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 | ||||
-rw-r--r-- | src/mesa/swrast/s_alphabuf.c | 19 | ||||
-rw-r--r-- | src/mesa/swrast/s_buffers.c | 33 | ||||
-rw-r--r-- | src/mesa/swrast/s_context.h | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_span.c | 32 | ||||
-rw-r--r-- | src/mesa/swrast/swrast.h | 20 |
17 files changed, 291 insertions, 171 deletions
diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c index 41dfcb18f08..0728c342733 100644 --- a/src/mesa/drivers/allegro/amesa.c +++ b/src/mesa/drivers/allegro/amesa.c @@ -112,15 +112,15 @@ IMPLEMENT_READ_RGBA_PIXELS(32, unsigned long) /***** Miscellaneous device driver funcs *****/
/**********************************************************************/
-static GLboolean set_buffer(GLcontext *ctx, GLenum mode)
+static GLboolean set_buffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bit)
{
AMesaContext context = (AMesaContext)(ctx->DriverCtx);
GLboolean ok = GL_TRUE;
- if (mode == GL_FRONT_LEFT)
+ if (bit == FRONT_LEFT_BIT)
context->Buffer->Active = context->Buffer->Screen;
- else if (mode == GL_BACK_LEFT)
+ else if (bit == BACK_LEFT)
{
if (context->Buffer->Background)
context->Buffer->Active = context->Buffer->Background;
diff --git a/src/mesa/drivers/d3d/NullProcs.c b/src/mesa/drivers/d3d/NullProcs.c index 58be86c2318..d6fb598074b 100644 --- a/src/mesa/drivers/d3d/NullProcs.c +++ b/src/mesa/drivers/d3d/NullProcs.c @@ -28,7 +28,7 @@ /*===========================================================================*/ void NULLSetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ); void NULLClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ); -GLboolean NULLSetBuffer( GLcontext *ctx, GLenum mode ); +GLboolean NULLSetBuffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bit ); void NULLGetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height ); GLbitfield NULLClearBuffers( GLcontext *ctx, GLbitfield m, GLboolean a, GLint x, GLint y, GLint w, GLint h ); void NULLWrSpRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][3], const GLubyte m[] ); diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c index 94364f49e45..b3afe6ef6c0 100644 --- a/src/mesa/drivers/ggi/ggimesa.c +++ b/src/mesa/drivers/ggi/ggimesa.c @@ -151,14 +151,14 @@ static void gl_ggiClear(GLcontext *ctx, GLbitfield mask, GLboolean all, /* Set the buffer used for reading */ /* XXX support for separate read/draw buffers hasn't been tested */ -static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLenum mode) +static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit) { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; printf("set read %d\n", mode); GGIMESADPRINT_CORE("gl_ggiSetBuffer() called\n"); - if (mode == GL_FRONT_LEFT) + if (bufferBit == FRONT_LEFT_BIT) { ggiSetReadFrame(ggi_ctx->ggi_visual, ggiGetDisplayFrame(ggi_ctx->ggi_visual)); @@ -166,7 +166,7 @@ static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLenum m ggiGetDisplayFrame(ggi_ctx->ggi_visual)); return GL_TRUE; } - else if (mode == GL_BACK_LEFT) + else if (bufferBit == BACK_LEFT_BIT) { ggiSetReadFrame(ggi_ctx->ggi_visual, ggiGetDisplayFrame(ggi_ctx->ggi_visual)?0 : 1); diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c index 98aabc5c0d1..f9108cfd19e 100644 --- a/src/mesa/drivers/glide/fxddspan.c +++ b/src/mesa/drivers/glide/fxddspan.c @@ -1,4 +1,4 @@ -/* $Id: fxddspan.c,v 1.20 2002/07/09 01:22:51 brianp Exp $ */ +/* $Id: fxddspan.c,v 1.21 2002/10/11 17:41:05 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -536,7 +536,7 @@ fxDDReadDepthPixels(GLcontext * ctx, GLuint n, /* Set the buffer used for reading */ /* XXX support for separate read/draw buffers hasn't been tested */ static void -fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLenum mode) +fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLuint bufferBit) { fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; (void) buffer; @@ -545,11 +545,11 @@ fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLenum mode) fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode); } - if (mode == GL_FRONT_LEFT) { + if (bufferBit == FRONT_LEFT_BIT) { fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; FX_grRenderBuffer(fxMesa->currentFB); } - else if (mode == GL_BACK_LEFT) { + else if (bufferBit == BACK_LEFT_BIT) { fxMesa->currentFB = GR_BUFFER_BACKBUFFER; FX_grRenderBuffer(fxMesa->currentFB); } diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index e6f9ebc3d83..5c1f7691c93 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,4 +1,4 @@ -/* $Id: osmesa.c,v 1.89 2002/10/05 03:02:01 brianp Exp $ */ +/* $Id: osmesa.c,v 1.90 2002/10/11 17:41:05 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -721,11 +721,11 @@ do { \ -static void set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) +static void set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit ) { /* separate read buffer not supported */ ASSERT(buffer == ctx->DrawBuffer); - ASSERT(mode == GL_FRONT_LEFT); + ASSERT(bufferBit == FRONT_LEFT_BIT); } diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c index 8d59cff2039..bd91040221b 100644 --- a/src/mesa/drivers/windows/wmesa.c +++ b/src/mesa/drivers/windows/wmesa.c @@ -1,4 +1,4 @@ -/* $Id: wmesa.c,v 1.38 2002/10/04 19:10:11 brianp Exp $ */ +/* $Id: wmesa.c,v 1.39 2002/10/11 17:41:05 brianp Exp $ */ /* * Windows (Win32) device driver for Mesa 3.4 @@ -582,9 +582,9 @@ static void enable( GLcontext* ctx, GLenum pname, GLboolean enable ) static void set_buffer(GLcontext *ctx, GLframebuffer *colorBuffer, - GLenum buffer ) + GLuint bufferBit ) { - /* XXX todo - examine buffer and set read/write pointers */ + /* XXX todo - examine bufferBit and set read/write pointers */ return; } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 9be4aba69be..81a4b006a46 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.37 2002/10/04 19:10:12 brianp Exp $ */ +/* $Id: xm_dd.c,v 1.38 2002/10/11 17:41:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -123,7 +123,7 @@ flush( GLcontext *ctx ) * lines, and triangles. */ static void -set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) +set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit ) { /* We can make this cast since the XMesaBuffer wraps GLframebuffer. * GLframebuffer is the first member in a XMesaBuffer struct. @@ -139,10 +139,10 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) /* * Now determine front vs back color buffer. */ - if (mode == GL_FRONT_LEFT) { + if (bufferBit == FRONT_LEFT_BIT) { target->buffer = target->frontbuffer; } - else if (mode == GL_BACK_LEFT) { + else if (bufferBit == BACK_LEFT_BIT) { ASSERT(target->db_state); if (target->backpixmap) { /* back buffer is a pixmape */ @@ -158,7 +158,8 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) } } else { - _mesa_problem(ctx, "invalid buffer in set_buffer() in xmesa2.c"); + _mesa_problem(ctx, "invalid buffer in set_buffer() in xm_dd.c"); + printf("bufferBit = 0x%x\n", bufferBit); return; } xmesa_update_span_funcs(ctx); diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index b0d26fdcdd9..acfd6181f2f 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -1,4 +1,4 @@ -/* $Id: glapi.c,v 1.64 2002/10/02 01:51:44 brianp Exp $ */ +/* $Id: glapi.c,v 1.65 2002/10/11 17:41:04 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -653,6 +653,10 @@ fill_in_entrypoint_offset(void *entrypoint, GLuint offset) GLboolean _glapi_add_entrypoint(const char *funcName, GLuint offset) { + /* trivial rejection test */ + if (!funcName || funcName[0] != 'g' || funcName[1] != 'l') + return GL_FALSE; + /* first check if the named function is already statically present */ { GLint index = get_static_proc_offset(funcName); @@ -661,13 +665,6 @@ _glapi_add_entrypoint(const char *funcName, GLuint offset) } } - /* make sure this offset/name pair is legal (this isn't really needed) */ - { - const char *name = _glapi_get_proc_name(offset); - if (name && strcmp(name, funcName) != 0) - return GL_FALSE; /* bad name! */ - } - /* See if this function has already been dynamically added */ { GLuint i; @@ -691,29 +688,29 @@ _glapi_add_entrypoint(const char *funcName, GLuint offset) } } } + } - /* This is a new function, try to add it. */ - if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS || - offset >= DISPATCH_TABLE_SIZE) { - /* No space left */ - return GL_FALSE; - } - else { - void *entrypoint = generate_entrypoint(offset); - if (!entrypoint) - return GL_FALSE; /* couldn't generate assembly */ + /* This is a new function, try to add it. */ + if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS || + offset >= DISPATCH_TABLE_SIZE) { + /* No space left */ + return GL_FALSE; + } + else { + void *entrypoint = generate_entrypoint(offset); + if (!entrypoint) + return GL_FALSE; /* couldn't generate assembly */ - /* OK! */ - ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); - ExtEntryTable[NumExtEntryPoints].Offset = offset; - ExtEntryTable[NumExtEntryPoints].Address = entrypoint; - NumExtEntryPoints++; + /* OK! */ + ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); + ExtEntryTable[NumExtEntryPoints].Offset = offset; + ExtEntryTable[NumExtEntryPoints].Address = entrypoint; + NumExtEntryPoints++; - return GL_TRUE; /* success */ - } + return GL_TRUE; /* success */ } - /* should never get here, but play it safe */ + /* should never get here, silence compiler warnings */ return GL_FALSE; } 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; diff --git a/src/mesa/swrast/s_alphabuf.c b/src/mesa/swrast/s_alphabuf.c index 2eab878a23a..4bf3368cb28 100644 --- a/src/mesa/swrast/s_alphabuf.c +++ b/src/mesa/swrast/s_alphabuf.c @@ -1,4 +1,4 @@ -/* $Id: s_alphabuf.c,v 1.12 2002/10/04 19:10:12 brianp Exp $ */ +/* $Id: s_alphabuf.c,v 1.13 2002/10/11 17:41:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -35,6 +35,7 @@ #include "context.h" #include "mem.h" +#include "s_context.h" #include "s_alphabuf.h" @@ -171,22 +172,24 @@ _mesa_clear_alpha_buffers( GLcontext *ctx ) static INLINE GLchan *get_alpha_buffer( GLcontext *ctx ) { - switch (ctx->Color._DriverDrawBuffer) { - case GL_FRONT_LEFT: + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + switch (swrast->CurrentBuffer) { + case FRONT_LEFT_BIT: return (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; break; - case GL_BACK_LEFT: + case BACK_LEFT_BIT: return (GLchan *) ctx->DrawBuffer->BackLeftAlpha; break; - case GL_FRONT_RIGHT: + case FRONT_RIGHT_BIT: return (GLchan *) ctx->DrawBuffer->FrontRightAlpha; break; - case GL_BACK_RIGHT: + case BACK_RIGHT_BIT: return (GLchan *) ctx->DrawBuffer->BackRightAlpha; break; default: - _mesa_problem(ctx, "Bad DriverDrawBuffer in _mesa_write_alpha_span()"); - return (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; /* aribitrary */ + _mesa_problem(ctx, "Bad CurrentBuffer in get_alpha_buffer()"); + return (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; } } diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c index 1b07eb0bef0..102d53ac7fa 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.13 2002/10/04 19:10:12 brianp Exp $ */ +/* $Id: s_buffers.c,v 1.14 2002/10/11 17:41:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -166,18 +166,7 @@ clear_color_buffers(GLcontext *ctx) /* loop over four possible dest color buffers */ for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { if (bufferBit & ctx->Color._DrawDestMask) { - if (bufferBit == FRONT_LEFT_BIT) { - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_FRONT_LEFT); - } - else if (bufferBit == FRONT_RIGHT_BIT) { - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_FRONT_RIGHT); - } - else if (bufferBit == BACK_LEFT_BIT) { - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_BACK_LEFT); - } - else { - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_BACK_RIGHT); - } + (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); if (colorMask != 0xffffffff) { clear_color_buffer_with_masking(ctx); @@ -274,10 +263,9 @@ _swrast_use_read_buffer( GLcontext *ctx ) SWcontext *swrast = SWRAST_CONTEXT(ctx); /* Do this so the software-emulated alpha plane span functions work! */ - ctx->Color._DriverDrawBuffer = ctx->Pixel._DriverReadBuffer; + swrast->CurrentBuffer = ctx->Pixel._ReadSrcMask; /* Tell the device driver where to read/write spans */ - (*swrast->Driver.SetBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel._DriverReadBuffer ); + (*swrast->Driver.SetBuffer)( ctx, ctx->ReadBuffer, swrast->CurrentBuffer ); } @@ -302,17 +290,16 @@ _swrast_use_draw_buffer( GLcontext *ctx ) */ if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) - ctx->Color._DriverDrawBuffer = GL_FRONT_LEFT; + swrast->CurrentBuffer = FRONT_LEFT_BIT; else if (ctx->Color._DrawDestMask & BACK_LEFT_BIT) - ctx->Color._DriverDrawBuffer = GL_BACK_LEFT; + swrast->CurrentBuffer = BACK_LEFT_BIT; else if (ctx->Color._DrawDestMask & FRONT_RIGHT_BIT) - ctx->Color._DriverDrawBuffer = GL_FRONT_RIGHT; + swrast->CurrentBuffer = FRONT_RIGHT_BIT; else if (ctx->Color._DrawDestMask & BACK_RIGHT_BIT) - ctx->Color._DriverDrawBuffer = GL_BACK_RIGHT; + swrast->CurrentBuffer = BACK_RIGHT_BIT; else /* glDrawBuffer(GL_NONE) */ - ctx->Color._DriverDrawBuffer = GL_FRONT_LEFT; /* always have this */ + swrast->CurrentBuffer = FRONT_LEFT_BIT; /* we always have this buffer */ - (*swrast->Driver.SetBuffer)( ctx, ctx->DrawBuffer, - ctx->Color._DriverDrawBuffer ); + (*swrast->Driver.SetBuffer)( ctx, ctx->DrawBuffer, swrast->CurrentBuffer ); } diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index ecf173adbcb..8493ad42643 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -1,4 +1,4 @@ -/* $Id: s_context.h,v 1.20 2002/10/04 17:37:47 brianp Exp $ */ +/* $Id: s_context.h,v 1.21 2002/10/11 17:41:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -138,6 +138,7 @@ typedef struct GLuint NewState; GLuint StateChanges; GLenum Primitive; /* current primitive being drawn (ala glBegin) */ + GLuint CurrentBuffer; /* exactly one of FRONT_LEFT_BIT, BACK_LEFT_BIT, etc*/ /** Mechanism to allow driver (like X11) to register further * software rasterization routines. diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index b134890a3b2..2628a7af3e0 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1,4 +1,4 @@ -/* $Id: s_span.c,v 1.48 2002/10/02 23:24:04 brianp Exp $ */ +/* $Id: s_span.c,v 1.49 2002/10/11 17:41:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -618,14 +618,9 @@ multi_write_index_span( GLcontext *ctx, struct sw_span *span ) GLuint indexTmp[MAX_WIDTH]; ASSERT(span->end < MAX_WIDTH); - if (bufferBit == FRONT_LEFT_BIT) - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_FRONT_LEFT); - else if (bufferBit == FRONT_RIGHT_BIT) - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_FRONT_RIGHT); - else if (bufferBit == BACK_LEFT_BIT) - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_BACK_LEFT); - else - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_BACK_RIGHT); + /* Set the current read/draw buffer */ + swrast->CurrentBuffer = bufferBit; + (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); /* make copy of incoming indexes */ MEMCPY( indexTmp, span->array->index, span->end * sizeof(GLuint) ); @@ -680,22 +675,9 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) GLchan rgbaTmp[MAX_WIDTH][4]; ASSERT(span->end < MAX_WIDTH); - if (bufferBit == FRONT_LEFT_BIT) { - ctx->Color._DriverDrawBuffer = GL_FRONT_LEFT; - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_FRONT_LEFT); - } - else if (bufferBit == FRONT_RIGHT_BIT) { - ctx->Color._DriverDrawBuffer = GL_FRONT_RIGHT; - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_FRONT_RIGHT); - } - else if (bufferBit == BACK_LEFT_BIT) { - ctx->Color._DriverDrawBuffer = GL_BACK_LEFT; - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_BACK_LEFT); - } - else { - ctx->Color._DriverDrawBuffer = GL_BACK_RIGHT; - (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_BACK_RIGHT); - } + /* Set the current read/draw buffer */ + swrast->CurrentBuffer = bufferBit; + (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); /* make copy of incoming colors */ MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) ); diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 1cb55a9d8c8..43c9aea8dcd 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -1,4 +1,4 @@ -/* $Id: swrast.h,v 1.29 2002/10/04 17:37:47 brianp Exp $ */ +/* $Id: swrast.h,v 1.30 2002/10/11 17:41:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -390,23 +390,23 @@ _swrast_copy_texsubimage3d(GLcontext *ctx, -/* The driver interface for the software rasterizer. Unless otherwise - * noted, all functions are mandatory. +/* The driver interface for the software rasterizer. + * Unless otherwise noted, all functions are mandatory. */ struct swrast_device_driver { - void (*SetBuffer)( GLcontext *ctx, GLframebuffer *buffer, - GLenum colorBuffer ); + void (*SetBuffer)( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit); /* * Specifies the current buffer for span/pixel writing/reading. * buffer indicates which window to write to / read from. Normally, * this'll be the buffer currently bound to the context, but it doesn't * have to be! - * colorBuffer indicates which color buffer, 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 + * bufferBit indicates which color buffer, one of: + * FRONT_LEFT_BIT - this buffer always exists + * BACK_LEFT_BIT - when double buffering + * FRONT_RIGHT_BIT - when using stereo + * BACK_RIGHT_BIT - when using stereo and double buffering + * AUXn_BIT - if aux buffers are implemented */ |