From b1394fa92aaaf859ce9efc8b5fc194397921320c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 26 Sep 2000 20:53:53 +0000 Subject: First batch of OpenGL SI related changes: Renamed struct gl_context to struct __GLcontextRec. Include glcore.h, setup GL imports/exports. Replaced gl_ prefix with _mesa_ prefix in context.[ch] functions. GLcontext's Visual field is no longer a pointer. --- src/mesa/Makefile.X11 | 3 +- src/mesa/drivers/allegro/amesa.c | 112 ++++++++--------- src/mesa/drivers/beos/GLView.cpp | 41 ++++--- src/mesa/drivers/d3d/WGL.C | 68 +++++------ src/mesa/drivers/dos/dosmesa.c | 52 ++++---- src/mesa/drivers/ggi/ggimesa.c | 39 +++--- src/mesa/drivers/glide/fxapi.c | 46 +++---- src/mesa/drivers/glide/fxdd.c | 2 +- src/mesa/drivers/osmesa/osmesa.c | 36 +++--- src/mesa/drivers/svga/svgamesa.c | 52 ++++---- src/mesa/drivers/windows/wmesa.c | 38 +++--- src/mesa/drivers/windows/wmesa_stereo.c | 35 +++--- src/mesa/drivers/x11/xm_api.c | 52 ++++---- src/mesa/drivers/x11/xm_line.c | 4 +- src/mesa/drivers/x11/xm_tri.c | 6 +- src/mesa/drivers/x11/xmesaP.h | 4 +- src/mesa/main/Makefile.X11 | 3 +- src/mesa/main/accum.c | 8 +- src/mesa/main/attrib.c | 4 +- src/mesa/main/buffers.c | 55 +++++---- src/mesa/main/clip.c | 4 +- src/mesa/main/config.h | 10 +- src/mesa/main/context.c | 209 ++++++++++++++++++-------------- src/mesa/main/context.h | 58 +++------ src/mesa/main/depth.c | 30 ++--- src/mesa/main/dlist.c | 4 +- src/mesa/main/drawpix.c | 30 ++--- src/mesa/main/enable.c | 18 +-- src/mesa/main/feedback.c | 18 +-- src/mesa/main/fog.c | 4 +- src/mesa/main/get.c | 122 +++++++++---------- src/mesa/main/glheader.h | 8 +- src/mesa/main/image.c | 8 +- src/mesa/main/imports.c | 163 +++++++++++++++++++++++++ src/mesa/main/imports.h | 39 ++++++ src/mesa/main/light.c | 4 +- src/mesa/main/lines.c | 4 +- src/mesa/main/matrix.c | 10 +- src/mesa/main/points.c | 4 +- src/mesa/main/polygon.c | 6 +- src/mesa/main/rastpos.c | 8 +- src/mesa/main/state.c | 8 +- src/mesa/main/stencil.c | 4 +- 43 files changed, 836 insertions(+), 597 deletions(-) create mode 100644 src/mesa/main/imports.c create mode 100644 src/mesa/main/imports.h (limited to 'src') diff --git a/src/mesa/Makefile.X11 b/src/mesa/Makefile.X11 index d4b1b5ba92..f3f97af303 100644 --- a/src/mesa/Makefile.X11 +++ b/src/mesa/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.23 2000/09/26 15:27:23 brianp Exp $ +# $Id: Makefile.X11,v 1.24 2000/09/26 20:53:53 brianp Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -55,6 +55,7 @@ CORE_SOURCES = \ hint.c \ image.c \ imaging.c \ + imports.c \ light.c \ lines.c \ logic.c \ diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c index 6e0f21d804..1645c5d11c 100644 --- a/src/mesa/drivers/allegro/amesa.c +++ b/src/mesa/drivers/allegro/amesa.c @@ -248,15 +248,18 @@ AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth, visual->DBFlag = dbFlag; visual->Depth = depth; - visual->GLVisual = gl_create_visual(GL_TRUE, /* rgb mode */ - GL_TRUE, /* software alpha */ - dbFlag, /* db_flag */ - GL_FALSE, /* stereo */ - depthSize, /* depth bits */ - stencilSize,/* stencil bits */ - accumSize, /* accum bits */ - 0, /* index bits */ - redBits, greenBits, blueBits, 0); + visual->GLVisual = _mesa_create_visual(GL_TRUE, /* rgb mode */ + dbFlag, /* db_flag */ + GL_FALSE, /* stereo */ + redBits, greenBits, blueBits, 8, + 0, /* index bits */ + depthSize, /* depth bits */ + stencilSize,/* stencil bits */ + accumSize, /* accum bits */ + accumSize, /* accum bits */ + accumSize, /* accum bits */ + accumSize, /* accum bits */ + 1 ); if (!visual->GLVisual) { free(visual); @@ -269,8 +272,8 @@ AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth, void AMesaDestroyVisual(AMesaVisual visual) { - gl_destroy_visual(visual->GLVisual); - free(visual); + _mesa_destroy_visual(visual->GLVisual); + free(visual); } @@ -299,7 +302,7 @@ AMesaBuffer AMesaCreateBuffer(AMesaVisual visual, } } - buffer->GLBuffer = gl_create_framebuffer(visual->GLVisual); + buffer->GLBuffer = _mesa_create_framebuffer(visual->GLVisual); if (!buffer->GLBuffer) { if (buffer->Background) destroy_bitmap(buffer->Background); @@ -312,12 +315,12 @@ AMesaBuffer AMesaCreateBuffer(AMesaVisual visual, void AMesaDestroyBuffer(AMesaBuffer buffer) - { - if (buffer->Screen) destroy_bitmap(buffer->Screen); - if (buffer->Background) destroy_bitmap(buffer->Background); - gl_destroy_framebuffer(buffer->GLBuffer); - free(buffer); - } +{ + if (buffer->Screen) destroy_bitmap(buffer->Screen); + if (buffer->Background) destroy_bitmap(buffer->Background); + _mesa_destroy_framebuffer(buffer->GLBuffer); + free(buffer); +} AMesaContext AMesaCreateContext(AMesaVisual visual, @@ -334,7 +337,7 @@ AMesaContext AMesaCreateContext(AMesaVisual visual, context->Buffer = NULL; context->ClearColor = 0; context->CurrentColor = 0; - context->GLContext = gl_create_context(visual->GLVisual, + context->GLContext = _mesa_create_context(visual->GLVisual, share ? share->GLContext : NULL, (void*)context, direct); @@ -349,47 +352,44 @@ AMesaContext AMesaCreateContext(AMesaVisual visual, void AMesaDestroyContext(AMesaContext context) - { - gl_destroy_context(context->GLContext); - free(context); - } +{ + _mesa_destroy_context(context->GLContext); + free(context); +} GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer) - { - if (context && buffer) - { - set_color_depth(context->Visual->Depth); - if (set_gfx_mode(GFX_AUTODETECT, buffer->Width, buffer->Height, 0, 0) != 0) - return GL_FALSE; - - context->Buffer = buffer; - buffer->Screen = screen; - buffer->Active = buffer->Background ? buffer->Background : screen; +{ + if (context && buffer) { + set_color_depth(context->Visual->Depth); + if (set_gfx_mode(GFX_AUTODETECT, buffer->Width, buffer->Height, 0, 0) != 0) + return GL_FALSE; + + context->Buffer = buffer; + buffer->Screen = screen; + buffer->Active = buffer->Background ? buffer->Background : screen; - setup_dd_pointers(context->GLContext); - gl_make_current(context->GLContext, buffer->GLBuffer); - gl_Viewport(context->GLContext, 0, 0, buffer->Width, buffer->Height); - } - else - { - destroy_bitmap(context->Buffer->Screen); - context->Buffer->Screen = NULL; - context->Buffer->Active = NULL; - context->Buffer = NULL; - gl_make_current(NULL, NULL); - } - - return GL_TRUE; - } + setup_dd_pointers(context->GLContext); + _mesa_make_current(context->GLContext, buffer->GLBuffer); + gl_Viewport(context->GLContext, 0, 0, buffer->Width, buffer->Height); + } + else { + destroy_bitmap(context->Buffer->Screen); + context->Buffer->Screen = NULL; + context->Buffer->Active = NULL; + context->Buffer = NULL; + _mesa_make_current(NULL, NULL); + } + + return GL_TRUE; +} void AMesaSwapBuffers(AMesaBuffer buffer) - { - if (buffer->Background) - { - blit(buffer->Background, buffer->Screen, - 0, 0, 0, 0, - buffer->Width, buffer->Height); - } - } +{ + if (buffer->Background) { + blit(buffer->Background, buffer->Screen, + 0, 0, 0, 0, + buffer->Width, buffer->Height); + } +} diff --git a/src/mesa/drivers/beos/GLView.cpp b/src/mesa/drivers/beos/GLView.cpp index 45ed1b49ce..5bf0b4926c 100644 --- a/src/mesa/drivers/beos/GLView.cpp +++ b/src/mesa/drivers/beos/GLView.cpp @@ -1,10 +1,10 @@ -/* $Id: GLView.cpp,v 1.2 2000/03/19 01:13:13 brianp Exp $ */ +/* $Id: GLView.cpp,v 1.3 2000/09/26 20:54:09 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -27,6 +27,13 @@ /* * $Log: GLView.cpp,v $ + * Revision 1.3 2000/09/26 20:54:09 brianp + * First batch of OpenGL SI related changes: + * Renamed struct gl_context to struct __GLcontextRec. + * Include glcore.h, setup GL imports/exports. + * Replaced gl_ prefix with _mesa_ prefix in context.[ch] functions. + * GLcontext's Visual field is no longer a pointer. + * * Revision 1.2 2000/03/19 01:13:13 brianp * updated for Mesa 3.3 * @@ -242,9 +249,9 @@ AuxInfo::AuxInfo() AuxInfo::~AuxInfo() { - gl_destroy_visual(mVisual); - gl_destroy_framebuffer(mBuffer); - gl_destroy_context(mContext); + _mesa_destroy_visual(mVisual); + _mesa_destroy_framebuffer(mBuffer); + _mesa_destroy_context(mContext); } @@ -260,7 +267,7 @@ void AuxInfo::Init(BGLView *bglView, GLcontext *c, GLvisual *v, GLframebuffer *b void AuxInfo::MakeCurrent() { UpdateState(mContext); - gl_make_current(mContext, mBuffer); + _mesa_make_current(mContext, mBuffer); } @@ -1008,13 +1015,19 @@ BGLView::BGLView(BRect rect, char *name, AuxInfo *aux = new AuxInfo; // examine option flags and create gl_context struct - GLvisual *visual = gl_create_visual( rgbFlag, alphaFlag, - dblFlag, stereoFlag, - depth, stencil, accum, index, - red, green, blue, alpha); + GLvisual *visual = _mesa__create_visual( rgbFlag, + dblFlag, + stereoFlag, + red, green, blue, alpha, + index, + depth, + stencil, + accum, accum, accum, accum, + 1 + ); // create core framebuffer - GLframebuffer *buffer = gl_create_framebuffer(visual, + GLframebuffer *buffer = _mesa_create_framebuffer(visual, depth > 0 ? GL_TRUE : GL_FALSE, stencil > 0 ? GL_TRUE: GL_FALSE, accum > 0 ? GL_TRUE : GL_FALSE, @@ -1023,7 +1036,7 @@ BGLView::BGLView(BRect rect, char *name, // create core context const GLboolean direct = GL_TRUE; - GLcontext *ctx = gl_create_context( visual, NULL, aux, direct ); + GLcontext *ctx = _mesa_create_context( visual, NULL, aux, direct ); aux->Init(this, ctx, visual, buffer ); @@ -1051,7 +1064,7 @@ void BGLView::UnlockGL() { AuxInfo *aux = (AuxInfo *) m_gc; assert(aux); - // Could call gl_make_current(NULL, NULL) but it would just + // Could call _mesa_make_current(NULL, NULL) but it would just // hinder performance } diff --git a/src/mesa/drivers/d3d/WGL.C b/src/mesa/drivers/d3d/WGL.C index 2d1a6a0c4d..e3b95e1de7 100644 --- a/src/mesa/drivers/d3d/WGL.C +++ b/src/mesa/drivers/d3d/WGL.C @@ -147,15 +147,15 @@ static BOOL InitOpenGL( HINSTANCE hInst ) /*========================================================================*/ /* Do all core Mesa stuff. */ /*========================================================================*/ - pD3DDefault->gl_visual = gl_create_visual( TRUE, - GL_FALSE, /* software alpha */ - FALSE, /* db_flag */ - GL_FALSE, /* stereo */ - 16, /* depth_bits */ - 8, /* stencil_bits */ - 8, /* accum_bits */ - 0, /* index bits */ - 8,8,8,8 ); /* r, g, b, a bits */ + pD3DDefault->gl_visual = _mesa_create_visual( TRUE, + FALSE, /* db_flag */ + GL_FALSE, /* stereo */ + 8,8,8,8, /* r, g, b, a bits */ + 0, /* index bits */ + 16, /* depth_bits */ + 8, /* stencil_bits */ + 8,8,8,8, /* accum_bits */ + 1 ); if ( pD3DDefault->gl_visual == NULL) { @@ -164,25 +164,25 @@ static BOOL InitOpenGL( HINSTANCE hInst ) } /* Allocate a new Mesa context */ - pD3DDefault->gl_ctx = gl_create_context( pD3DDefault->gl_visual, NULL, pD3DDefault, GL_TRUE ); + pD3DDefault->gl_ctx = _mesa_create_context( pD3DDefault->gl_visual, NULL, pD3DDefault, GL_TRUE ); if ( pD3DDefault->gl_ctx == NULL ) { - gl_destroy_visual( pD3DDefault->gl_visual ); + _mesa_destroy_visual( pD3DDefault->gl_visual ); FREE( pD3DDefault ); return FALSE; } /* Allocate a new Mesa frame buffer */ - pD3DDefault->gl_buffer = gl_create_framebuffer( pD3DDefault->gl_visual ); + pD3DDefault->gl_buffer = _mesa_create_framebuffer( pD3DDefault->gl_visual ); if ( pD3DDefault->gl_buffer == NULL ) { - gl_destroy_visual( pD3DDefault->gl_visual ); - gl_destroy_context( pD3DDefault->gl_ctx ); + _mesa_destroy_visual( pD3DDefault->gl_visual ); + _mesa_destroy_context( pD3DDefault->gl_ctx ); FREE( pD3DDefault ); return FALSE; } SetupDDPointers( pD3DDefault->gl_ctx ); - gl_make_current( pD3DDefault->gl_ctx, pD3DDefault->gl_buffer ); + _mesa_make_current( pD3DDefault->gl_ctx, pD3DDefault->gl_buffer ); return TRUE; } @@ -214,15 +214,15 @@ HGLRC APIENTRY wglCreateContext( HDC hdc ) /*========================================================================*/ /* TODO: support more then one visual. */ - pNewContext->gl_visual = gl_create_visual( TRUE, - GL_TRUE, /* software alpha */ - TRUE, /* db_flag */ - GL_FALSE, /* stereo */ - 16, /* depth_bits */ - 8, /* stencil_bits */ - 8, /* accum_bits */ - 0, /* index bits */ - 8,8,8,8 ); /* r, g, b, a bits */ + pNewContext->gl_visual = _mesa_create_visual( TRUE, + TRUE, /* db_flag */ + GL_FALSE, /* stereo */ + 8,8,8,8, /* r, g, b, a bits */ + 0, /* index bits */ + 16, /* depth_bits */ + 8, /* stencil_bits */ + 16,16,16,16,/* accum_bits */ + 1 ); if ( pNewContext->gl_visual == NULL) { FREE( pNewContext ); @@ -231,21 +231,21 @@ HGLRC APIENTRY wglCreateContext( HDC hdc ) } /* Allocate a new Mesa context */ - pNewContext->gl_ctx = gl_create_context( pNewContext->gl_visual, NULL, pNewContext, GL_TRUE ); + pNewContext->gl_ctx = _mesa_create_context( pNewContext->gl_visual, NULL, pNewContext, GL_TRUE ); if ( pNewContext->gl_ctx == NULL ) { - gl_destroy_visual( pNewContext->gl_visual ); + _mesa_destroy_visual( pNewContext->gl_visual ); FREE( pNewContext ); SetLastError( 0 ); return (HGLRC)NULL; } /* Allocate a new Mesa frame buffer */ - pNewContext->gl_buffer = gl_create_framebuffer( pNewContext->gl_visual ); + pNewContext->gl_buffer = _mesa_create_framebuffer( pNewContext->gl_visual ); if ( pNewContext->gl_buffer == NULL ) { - gl_destroy_visual( pNewContext->gl_visual ); - gl_destroy_context( pNewContext->gl_ctx ); + _mesa_destroy_visual( pNewContext->gl_visual ); + _mesa_destroy_context( pNewContext->gl_ctx ); FREE( pNewContext ); SetLastError( 0 ); return (HGLRC)NULL; @@ -314,7 +314,7 @@ static BOOL MakeCurrent( D3DMESACONTEXT *pContext ) /* Let Mesa-3.0 we have a new context. */ /*=====================================*/ SetupDDPointers( pContext->gl_ctx ); - gl_make_current( pContext->gl_ctx, pContext->gl_buffer ); + _mesa_make_current( pContext->gl_ctx, pContext->gl_buffer ); /* We are done so set the internal current context. */ if ( pContext != pD3DDefault ) @@ -409,7 +409,7 @@ static BOOL ResizeContext( GLcontext *ctx ) /* Update Mesa as we might have changed from SW <-> HW. */ SetupDDPointers( pContext->gl_ctx ); - gl_make_current( pContext->gl_ctx, pContext->gl_buffer ); + _mesa_make_current( pContext->gl_ctx, pContext->gl_buffer ); /* If we are in HW we need to load the current texture if there is one already. */ // if ( (ctx->Texture.Set[ctx->Texture.CurrentSet].Current != NULL) && @@ -1076,17 +1076,17 @@ static void DestroyContext( D3DMESACONTEXT *pContext ) /* Free the Mesa stuff. */ if ( pContext->gl_visual ) { - gl_destroy_visual( pContext->gl_visual ); + _mesa_destroy_visual( pContext->gl_visual ); pContext->gl_visual = NULL; } if ( pContext->gl_buffer ) { - gl_destroy_framebuffer( pContext->gl_buffer ); + _mesa_destroy_framebuffer( pContext->gl_buffer ); pContext->gl_buffer = NULL; } if ( pContext->gl_ctx ) { - gl_destroy_context( pContext->gl_ctx ); + _mesa_destroy_context( pContext->gl_ctx ); pContext->gl_ctx = NULL; } diff --git a/src/mesa/drivers/dos/dosmesa.c b/src/mesa/drivers/dos/dosmesa.c index 2f3973284a..6221268b52 100644 --- a/src/mesa/drivers/dos/dosmesa.c +++ b/src/mesa/drivers/dos/dosmesa.c @@ -1,4 +1,4 @@ -/* $Id: dosmesa.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */ +/* $Id: dosmesa.c,v 1.2 2000/09/26 20:54:10 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -23,8 +23,15 @@ /* * $Log: dosmesa.c,v $ - * Revision 1.1 1999/08/19 00:55:41 jtg - * Initial revision + * Revision 1.2 2000/09/26 20:54:10 brianp + * First batch of OpenGL SI related changes: + * Renamed struct gl_context to struct __GLcontextRec. + * Include glcore.h, setup GL imports/exports. + * Replaced gl_ prefix with _mesa_ prefix in context.[ch] functions. + * GLcontext's Visual field is no longer a pointer. + * + * Revision 1.1.1.1 1999/08/19 00:55:41 jtg + * Imported sources * * Revision 1.2 1999/03/28 21:11:57 brianp * updated SetBuffer driver function @@ -1406,26 +1413,25 @@ DOSMesaContext DOSMesaCreateContext( void ) return NULL; } - ctx->gl_vis = gl_create_visual( rgb_flag, - alpha_flag, - db_flag, - 16, /* depth_size */ - 8, /* stencil_size */ - 16, /* accum_size */ - index_bits, - redscale, - greenscale, - bluescale, - alphascale, - redbits, greenbits, - bluebits, alphabits); - - ctx->gl_ctx = gl_create_context( ctx->gl_vis, + ctx->gl_vis = _mesa_create_visual( rgb_flag, + db_flag, + GL_FALSE, /* stereo */ + redbits, + greenbits, + bluebits, + alphabits, + index_bits, + 16, /* depth_size */ + 8, /* stencil_size */ + 16, 16, 16, 16, /* accum_size */ + 1 ); + + ctx->gl_ctx = _mesa_create_context( ctx->gl_vis, NULL, /* share list context */ (void *) ctx ); - ctx->gl_buffer = gl_create_framebuffer( ctx->gl_vis ); + ctx->gl_buffer = _mesa_create_framebuffer( ctx->gl_vis ); ctx->index = 1; ctx->red = ctx->green = ctx->blue = 255; @@ -1441,9 +1447,9 @@ DOSMesaContext DOSMesaCreateContext( void ) void DOSMesaDestroyContext( DOSMesaContext ctx ) { if (ctx) { - gl_destroy_visual( ctx->gl_vis ); - gl_destroy_context( ctx->gl_ctx ); - gl_destroy_framebuffer( ctx->gl_buffer ); + _mesa_destroy_visual( ctx->gl_vis ); + _mesa_destroy_context( ctx->gl_ctx ); + _mesa_destroy_framebuffer( ctx->gl_buffer ); free( ctx ); if (ctx==DOSMesa) { DOSMesa = NULL; @@ -1459,7 +1465,7 @@ void DOSMesaDestroyContext( DOSMesaContext ctx ) void DOSMesaMakeCurrent( DOSMesaContext ctx ) { DOSMesa = ctx; - gl_make_current( ctx->gl_ctx, ctx->gl_buffer ); + _mesa_make_current( ctx->gl_ctx, ctx->gl_buffer ); DOSmesa_setup_DD_pointers( ctx->gl_ctx ); if (ctx->width==0 || ctx->height==0) { diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c index 6e8dd47e74..2311959f5f 100644 --- a/src/mesa/drivers/ggi/ggimesa.c +++ b/src/mesa/drivers/ggi/ggimesa.c @@ -317,7 +317,7 @@ GGIMesaContext GGIMesaCreateContext(void) ctx->viewport_init = GL_FALSE; ctx->gl_vis->DBflag = GL_FALSE; - ctx->gl_ctx = gl_create_context(ctx->gl_vis, NULL, (void *)ctx, GL_TRUE); + ctx->gl_ctx = _mesa_create_context(ctx->gl_vis, NULL, (void *)ctx, GL_TRUE); if (!ctx->gl_ctx) return NULL; @@ -328,9 +328,9 @@ void GGIMesaDestroyContext(GGIMesaContext ctx) { if (ctx) { - gl_destroy_visual(ctx->gl_vis); - gl_destroy_context(ctx->gl_ctx); - gl_destroy_framebuffer(ctx->gl_buffer); + _mesa_destroy_visual(ctx->gl_vis); + _mesa_destroy_context(ctx->gl_ctx); + _mesa_destroy_framebuffer(ctx->gl_buffer); if (ctx == GGIMesa) GGIMesa = NULL; if (ctx->ggi_vis) @@ -367,7 +367,7 @@ int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis, changed(vis, GGI_CHG_APILIST); if (ctx->gl_vis) - gl_destroy_visual(ctx->gl_vis); + _mesa_destroy_visual(ctx->gl_vis); if (ctx->gl_buffer) gl_destroy_framebuffer(ctx->gl_buffer); @@ -394,23 +394,26 @@ int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis, if (err) return -1; - ctx->gl_vis = gl_create_visual(info.rgb_flag, - info.alpha_flag, - info.db_flag, - GL_FALSE, - info.depth_bits, - info.stencil_bits, - info.accum_bits, - info.index_bits, - info.red_bits, info.green_bits, - info.blue_bits, info.alpha_bits); + ctx->gl_vis = _mesa_create_visual(info.rgb_flag, + info.db_flag, + GL_FALSE, /*stereo*/ + info.red_bits, info.green_bits, + info.blue_bits, info.alpha_bits, + info.index_bits, + info.depth_bits, + info.stencil_bits, + info.accum_bits, + info.accum_bits, + info.accum_bits, + info.accum_bits, + 1); if (!ctx->gl_vis) { fprintf(stderr, "Can't create gl_visual!\n"); return -1; } - ctx->gl_buffer = gl_create_framebuffer(ctx->gl_vis, + ctx->gl_buffer = _mesa_create_framebuffer(ctx->gl_vis, ctx->gl_vis->DepthBits > 0, ctx->gl_vis->StencilBits > 0, ctx->gl_vis->AccumRedBits > 0, @@ -461,7 +464,7 @@ int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis, ctx->gl_ctx->Color.DrawBuffer = (db_flag) ? GL_BACK : GL_FRONT; if (GGIMesa == ctx) - gl_make_current(ctx->gl_ctx, ctx->gl_buffer); + _mesa_make_current(ctx->gl_ctx, ctx->gl_buffer); if (rgb_flag && mode.graphtype==GT_8BIT) { @@ -485,7 +488,7 @@ void GGIMesaMakeCurrent(GGIMesaContext ctx) return; GGIMesa = ctx; - gl_make_current(ctx->gl_ctx, ctx->gl_buffer); + _mesa_make_current(ctx->gl_ctx, ctx->gl_buffer); if (!ctx->viewport_init) { diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index 75d61c93a0..4166f792aa 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -1061,25 +1061,25 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, fprintf(stderr,"Voodoo Glide screen size: %dx%d\n", (int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight()); - fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */ - alphaBuffer, - doubleBuffer, - GL_FALSE, /* stereo */ - depthSize, /* depth_size */ - stencilSize, /* stencil_size */ - accumSize, /* accum_size */ - 0, /* index bits */ - 5,6,5,0); /* RGBA bits */ + fxMesa->glVis=_mesa_create_visual(GL_TRUE, /* RGB mode */ + doubleBuffer, + GL_FALSE, /* stereo */ + 5,6,5,0, /* RGBA bits */ + 0, /* index bits */ + depthSize, /* depth_size */ + stencilSize, /* stencil_size */ + accumSize, accumSize, accumSize, accumSize, + 1 ); if (!fxMesa->glVis) { - errorstr = "gl_create_visual"; + errorstr = "_mesa_create_visual"; goto errorhandler; } - ctx = fxMesa->glCtx=gl_create_context(fxMesa->glVis, + ctx = fxMesa->glCtx=_mesa_create_context(fxMesa->glVis, shareCtx, /* share list context */ (void *) fxMesa, GL_TRUE); if (!ctx) { - errorstr = "gl_create_context"; + errorstr = "_mesa_create_context"; goto errorhandler; } @@ -1090,13 +1090,13 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, } - fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis, + fxMesa->glBuffer=_mesa_create_framebuffer(fxMesa->glVis, GL_FALSE, /* no software depth */ fxMesa->glVis->StencilBits > 0, fxMesa->glVis->AccumRedBits > 0, fxMesa->glVis->AlphaBits > 0 ); if (!fxMesa->glBuffer) { - errorstr = "gl_create_framebuffer"; + errorstr = "_mesa_create_framebuffer"; goto errorhandler; } @@ -1134,11 +1134,11 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, if (fxMesa->fogTable) free(fxMesa->fogTable); if (fxMesa->glBuffer) - gl_destroy_framebuffer(fxMesa->glBuffer); + _mesa_destroy_framebuffer(fxMesa->glBuffer); if (fxMesa->glVis) - gl_destroy_visual(fxMesa->glVis); + _mesa_destroy_visual(fxMesa->glVis); if (fxMesa->glCtx) - gl_destroy_context(fxMesa->glCtx); + _mesa_destroy_context(fxMesa->glCtx); free(fxMesa); } @@ -1169,9 +1169,9 @@ void GLAPIENTRY fxMesaDestroyContext(fxMesaContext fxMesa) } if(fxMesa) { - gl_destroy_visual(fxMesa->glVis); - gl_destroy_context(fxMesa->glCtx); - gl_destroy_framebuffer(fxMesa->glBuffer); + _mesa_destroy_visual(fxMesa->glVis); + _mesa_destroy_context(fxMesa->glCtx); + _mesa_destroy_framebuffer(fxMesa->glBuffer); glbTotNumCtx--; @@ -1226,7 +1226,7 @@ void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext fxMesa) } if(!fxMesa) { - gl_make_current(NULL,NULL); + _mesa_make_current(NULL,NULL); fxMesaCurrentCtx=NULL; if (MESA_VERBOSE&VERBOSE_DRIVER) { @@ -1238,7 +1238,7 @@ void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext fxMesa) /* if this context is already the current one, we can return early */ if (fxMesaCurrentCtx == fxMesa - && fxMesaCurrentCtx->glCtx == gl_get_current_context()) { + && fxMesaCurrentCtx->glCtx == _mesa_get_current_context()) { if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxMesaMakeCurrent(fxMesaCurrentCtx==fxMesa) End\n"); } @@ -1254,7 +1254,7 @@ void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext fxMesa) grSstSelect(fxMesa->board); grGlideSetState((GrState*)fxMesa->state); - gl_make_current(fxMesa->glCtx,fxMesa->glBuffer); + _mesa_make_current(fxMesa->glCtx,fxMesa->glBuffer); fxSetupDDPointers(fxMesa->glCtx); diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index a560fefa69..c0808c35df 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -863,7 +863,7 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) fxMesa->glCtx->NrPipelineStages); /* Run the config file */ - gl_context_initialize( fxMesa->glCtx ); + _mesa_context_initialize( fxMesa->glCtx ); return 1; } diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 7f79a1f272..11336e5cd9 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,4 +1,4 @@ -/* $Id: osmesa.c,v 1.20 2000/09/08 16:41:39 brianp Exp $ */ +/* $Id: osmesa.c,v 1.21 2000/09/26 20:54:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -30,7 +30,7 @@ * * Note on thread safety: this driver is thread safe. All * functions are reentrant. The notion of current context is - * managed by the core gl_make_current() and gl_get_current_context() + * managed by the core _mesa_make_current() and _mesa_get_current_context() * functions. Those functions are thread-safe. */ @@ -265,15 +265,15 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, gl_extensions_enable(&(osmesa->gl_ctx), "GL_ARB_texture_cube_map"); gl_extensions_enable(&(osmesa->gl_ctx), "GL_EXT_texture_env_combine"); - osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual, - osmesa->gl_visual->DepthBits > 0, - osmesa->gl_visual->StencilBits > 0, - osmesa->gl_visual->AccumRedBits > 0, - osmesa->gl_visual->AlphaBits > 0 ); + osmesa->gl_buffer = _mesa_create_framebuffer( osmesa->gl_visual, + osmesa->gl_visual->DepthBits > 0, + osmesa->gl_visual->StencilBits > 0, + osmesa->gl_visual->AccumRedBits > 0, + osmesa->gl_visual->AlphaBits > 0 ); if (!osmesa->gl_buffer) { - gl_destroy_visual( osmesa->gl_visual ); - gl_free_context_data( &osmesa->gl_ctx ); + _mesa_destroy_visual( osmesa->gl_visual ); + _mesa_free_context_data( &osmesa->gl_ctx ); FREE(osmesa); return NULL; } @@ -308,9 +308,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx ) { if (ctx) { - gl_destroy_visual( ctx->gl_visual ); - gl_destroy_framebuffer( ctx->gl_buffer ); - gl_free_context_data( &ctx->gl_ctx ); + _mesa_destroy_visual( ctx->gl_visual ); + _mesa_destroy_framebuffer( ctx->gl_buffer ); + _mesa_free_context_data( &ctx->gl_ctx ); FREE( ctx ); } } @@ -414,7 +414,7 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, } osmesa_update_state( &ctx->gl_ctx ); - gl_make_current( &ctx->gl_ctx, ctx->gl_buffer ); + _mesa_make_current( &ctx->gl_ctx, ctx->gl_buffer ); ctx->buffer = buffer; ctx->width = width; @@ -441,7 +441,7 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ) { - GLcontext *ctx = gl_get_current_context(); + GLcontext *ctx = _mesa_get_current_context(); if (ctx) return (OSMesaContext) ctx; else @@ -1404,7 +1404,7 @@ static line_func choose_line_function( GLcontext *ctx ) if (ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS) { + && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS) { switch(osmesa->format) { case OSMESA_RGBA: case OSMESA_BGRA: @@ -1429,7 +1429,7 @@ static line_func choose_line_function( GLcontext *ctx ) if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT) && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA && ctx->Color.BlendSrcA==GL_SRC_ALPHA @@ -1448,7 +1448,7 @@ static line_func choose_line_function( GLcontext *ctx ) if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT) && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_FALSE - && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA && ctx->Color.BlendSrcA==GL_SRC_ALPHA @@ -1586,7 +1586,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) if (ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && osmesa->format!=OSMESA_COLOR_INDEX) { if (ctx->Light.ShadeModel==GL_SMOOTH) { return smooth_rgba_z_triangle; diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 1b4a45e1ae..0d7fa158db 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa.c,v 1.5 2000/03/31 01:07:14 brianp Exp $ */ +/* $Id: svgamesa.c,v 1.6 2000/09/26 20:54:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -369,7 +369,6 @@ SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ) #ifndef DEV GLboolean rgb_flag; GLfloat redscale, greenscale, bluescale, alphascale; - GLboolean alpha_flag = GL_FALSE; GLint index_bits; GLint redbits, greenbits, bluebits, alphabits; /* determine if we're in RGB or color index mode */ @@ -408,26 +407,27 @@ SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ) return NULL; } - ctx->gl_vis = gl_create_visual( rgb_flag, - alpha_flag, - doubleBuffer, - GL_FALSE, /* stereo */ - 16, /* depth_size */ - 8, /* stencil_size */ - 16, /* accum_size */ - index_bits, - redbits, greenbits, - bluebits, alphabits ); - - ctx->gl_ctx = gl_create_context( ctx->gl_vis, - NULL, /* share list context */ - (void *) ctx, GL_TRUE ); - - ctx->gl_buffer = gl_create_framebuffer( ctx->gl_vis, - ctx->gl_vis->DepthBits > 0, - ctx->gl_vis->StencilBits > 0, - ctx->gl_vis->AccumRedBits > 0, - ctx->gl_vis->AlphaBits > 0 ); + ctx->gl_vis = _mesa_create_visual( rgb_flag, + doubleBuffer, + GL_FALSE, /* stereo */ + redbits, greenbits, + bluebits, alphabits, + index_bits, + 16, /* depth_size */ + 8, /* stencil_size */ + 16, 16, 16, 16, /* accum_size */ + 1 /* samples */ + ); + + ctx->gl_ctx = _mesa_create_context( ctx->gl_vis, + NULL, /* share list context */ + (void *) ctx, GL_TRUE ); + + ctx->gl_buffer = _mesa_create_framebuffer( ctx->gl_vis, + ctx->gl_vis->DepthBits > 0, + ctx->gl_vis->StencilBits > 0, + ctx->gl_vis->AccumRedBits > 0, + ctx->gl_vis->AlphaBits > 0 ); ctx->index = 1; ctx->red = ctx->green = ctx->blue = 255; @@ -444,9 +444,9 @@ void SVGAMesaDestroyContext( SVGAMesaContext ctx ) { #ifndef DEV if (ctx) { - gl_destroy_visual( ctx->gl_vis ); - gl_destroy_context( ctx->gl_ctx ); - gl_destroy_framebuffer( ctx->gl_buffer ); + _mesa_destroy_visual( ctx->gl_vis ); + _mesa_destroy_context( ctx->gl_ctx ); + _mesa_destroy_framebuffer( ctx->gl_buffer ); free( ctx ); if (ctx==SVGAMesa) { SVGAMesa = NULL; @@ -463,7 +463,7 @@ void SVGAMesaMakeCurrent( SVGAMesaContext ctx ) #ifndef DEV SVGAMesa = ctx; svgamesa_update_state( ctx->gl_ctx ); - gl_make_current( ctx->gl_ctx, ctx->gl_buffer ); + _mesa_make_current( ctx->gl_ctx, ctx->gl_buffer ); if (ctx->width==0 || ctx->height==0) { /* setup initial viewport */ diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c index 01fea7f5a0..b372469288 100644 --- a/src/mesa/drivers/windows/wmesa.c +++ b/src/mesa/drivers/windows/wmesa.c @@ -1,4 +1,4 @@ -/* $Id: wmesa.c,v 1.7 2000/09/12 15:46:43 brianp Exp $ */ +/* $Id: wmesa.c,v 1.8 2000/09/26 20:54:13 brianp Exp $ */ /* * Windows (Win32) device driver for Mesa 3.4 @@ -1280,37 +1280,37 @@ WMesaContext WMesaCreateContext( HWND hWnd, HPALETTE* Pal, #endif - c->gl_visual = gl_create_visual(rgb_flag, - GL_FALSE, /* software alpha */ - db_flag, /* db_flag */ - GL_FALSE, /* stereo */ - 16, /* depth_bits */ - 8, /* stencil_bits */ - 8, /* accum_bits */ - 0, /* index bits */ - 8,8,8,8 ); /* r, g, b, a bits */ + c->gl_visual = _mesa_create_visual(rgb_flag, + db_flag, /* db_flag */ + GL_FALSE, /* stereo */ + 8,8,8,8, /* r, g, b, a bits */ + 0, /* index bits */ + 16, /* depth_bits */ + 8, /* stencil_bits */ + 16,16,16,16,/* accum_bits */ + 1); if (!c->gl_visual) { return NULL; } /* allocate a new Mesa context */ - c->gl_ctx = gl_create_context( c->gl_visual, NULL, c, GL_TRUE); + c->gl_ctx = _mesa_create_context( c->gl_visual, NULL, c, GL_TRUE); if (!c->gl_ctx) { - gl_destroy_visual( c->gl_visual ); + _mesa_destroy_visual( c->gl_visual ); free(c); return NULL; } - c->gl_buffer = gl_create_framebuffer( c->gl_visual, + c->gl_buffer = _mesa_create_framebuffer( c->gl_visual, c->gl_visual->DepthBits > 0, c->gl_visual->StencilBits > 0, c->gl_visual->AccumRedBits > 0, c->gl_visual->AlphaBits > 0 ); if (!c->gl_buffer) { - gl_destroy_visual( c->gl_visual ); - gl_destroy_context( c->gl_ctx ); + _mesa_destroy_visual( c->gl_visual ); + _mesa_destroy_context( c->gl_ctx ); free(c); return NULL; } @@ -1329,9 +1329,9 @@ void WMesaDestroyContext( void ) WC = c; if(c->hPalHalfTone != NULL) DeleteObject(c->hPalHalfTone); - gl_destroy_visual( c->gl_visual ); - gl_destroy_framebuffer( c->gl_buffer ); - gl_destroy_context( c->gl_ctx ); + _mesa_destroy_visual( c->gl_visual ); + _mesa_destroy_framebuffer( c->gl_buffer ); + _mesa_destroy_context( c->gl_ctx ); if (c->db_flag) #ifdef DDRAW @@ -1367,7 +1367,7 @@ void /*APIENTRY*/ WMesaMakeCurrent( WMesaContext c ) return; //gl_set_context( c->gl_ctx ); - gl_make_current(c->gl_ctx, c->gl_buffer); + _mesa_make_current(c->gl_ctx, c->gl_buffer); setup_DD_pointers(c->gl_ctx); Current = c; if (Current->gl_ctx->Viewport.Width==0) { diff --git a/src/mesa/drivers/windows/wmesa_stereo.c b/src/mesa/drivers/windows/wmesa_stereo.c index 934e6a5f83..3408fe943c 100644 --- a/src/mesa/drivers/windows/wmesa_stereo.c +++ b/src/mesa/drivers/windows/wmesa_stereo.c @@ -1181,32 +1181,33 @@ WMesaContext /*APIENTRY*/ WMesaCreateContext( HWND hWnd, HPALETTE Pal, - c->gl_visual = gl_create_visual(rgb_flag, - GL_FALSE, /* software alpha */ - db_flag, /* db_flag */ - 16, /* depth_bits */ - 8, /* stencil_bits */ - 8, /* accum_bits */ - 8, - 255.0, 255.0, 255.0, 255.0 ); + c->gl_visual = _mesa_create_visual(rgb_flag, + db_flag, /* db_flag */ + GL_TRUE, /* stereo */ + 8, 8, 8, 8,/* rgba bits */ + 0, /* index bits */ + 16, /* depth_bits */ + 8, /* stencil_bits */ + 16,16,16,16,/* accum_bits */ + 1 ); if (!c->gl_visual) { return NULL; } /* allocate a new Mesa context */ - c->gl_ctx = gl_create_context( c->gl_visual, NULL,c); + c->gl_ctx = _mesa_create_context( c->gl_visual, NULL,c); if (!c->gl_ctx) { - gl_destroy_visual( c->gl_visual ); + _mesa_destroy_visual( c->gl_visual ); free(c); return NULL; } - c->gl_buffer = gl_create_framebuffer( c->gl_visual ); + c->gl_buffer = _mesa_create_framebuffer( c->gl_visual ); if (!c->gl_buffer) { - gl_destroy_visual( c->gl_visual ); - gl_destroy_context( c->gl_ctx ); + _mesa_destroy_visual( c->gl_visual ); + _mesa_destroy_context( c->gl_ctx ); free(c); return NULL; } @@ -1223,9 +1224,9 @@ void /*APIENTRY*/ WMesaDestroyContext( void ) ReleaseDC(c->Window,c->hDC); WC = c; - gl_destroy_visual( c->gl_visual ); - gl_destroy_framebuffer( c->gl_buffer ); - gl_destroy_context( c->gl_ctx ); + _mesa_destroy_visual( c->gl_visual ); + _mesa_destroy_framebuffer( c->gl_buffer ); + _mesa_destroy_context( c->gl_ctx ); if (c->db_flag){ wmDeleteBackingStore(c); @@ -1267,7 +1268,7 @@ void /*APIENTRY*/ WMesaMakeCurrent( WMesaContext c ) return; //gl_set_context( c->gl_ctx ); - gl_make_current(c->gl_ctx, c->gl_buffer); + _mesa_make_current(c->gl_ctx, c->gl_buffer); Current = c; setup_DD_pointers(c->gl_ctx); if (Current->gl_ctx->Viewport.Width==0) { diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 88650d675a..5b31b8f790 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.1 2000/09/07 15:40:30 brianp Exp $ */ +/* $Id: xm_api.c,v 1.2 2000/09/26 20:54:13 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1629,7 +1629,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) return NULL; } - c->gl_ctx = gl_create_context( v->gl_visual, + c->gl_ctx = _mesa_create_context( v->gl_visual, share_list ? share_list->gl_ctx : (GLcontext *) NULL, (void *) c, direct ); if (!c->gl_ctx) { @@ -1660,7 +1660,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) #endif /* Run the config file */ - gl_context_initialize( c->gl_ctx ); + _mesa_context_initialize( c->gl_ctx ); return c; } @@ -1675,7 +1675,7 @@ void XMesaDestroyContext( XMesaContext c ) fxMesaDestroyContext(c->xm_buffer->FXctx); #endif if (c->gl_ctx) - gl_destroy_context( c->gl_ctx ); + _mesa_destroy_context( c->gl_ctx ); /* Disassociate old buffer with this context */ if (c->xm_buffer) @@ -1787,11 +1787,11 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, b->db_state = 0; } - b->gl_buffer = gl_create_framebuffer( v->gl_visual, - v->gl_visual->DepthBits > 0, - v->gl_visual->StencilBits > 0, - v->gl_visual->AccumRedBits > 0, - v->gl_visual->AlphaBits > 0 ); + b->gl_buffer = _mesa_create_framebuffer( v->gl_visual, + v->gl_visual->DepthBits > 0, + v->gl_visual->StencilBits > 0, + v->gl_visual->AccumRedBits > 0, + v->gl_visual->AlphaBits > 0 ); if (!b->gl_buffer) { free_xmesa_buffer(client, b); return NULL; @@ -1799,7 +1799,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, if (!initialize_visual_and_buffer( client, v, b, v->gl_visual->RGBAflag, (XMesaDrawable)w, b->cmap )) { - gl_destroy_framebuffer( b->gl_buffer ); + _mesa_destroy_framebuffer( b->gl_buffer ); free_xmesa_buffer(client, b); return NULL; } @@ -1929,13 +1929,13 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, b->db_state = 0; } - b->gl_buffer = gl_create_framebuffer( v->gl_visual, - v->gl_visual->DepthBits > 0, - v->gl_visual->StencilBits > 0, - v->gl_visual->AccumRedBits + - v->gl_visual->AccumGreenBits + - v->gl_visual->AccumBlueBits > 0, - v->gl_visual->AlphaBits > 0 ); + b->gl_buffer = _mesa_create_framebuffer( v->gl_visual, + v->gl_visual->DepthBits > 0, + v->gl_visual->StencilBits > 0, + v->gl_visual->AccumRedBits + + v->gl_visual->AccumGreenBits + + v->gl_visual->AccumBlueBits > 0, + v->gl_visual->AlphaBits > 0 ); if (!b->gl_buffer) { free_xmesa_buffer(client, b); return NULL; @@ -1943,7 +1943,7 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, if (!initialize_visual_and_buffer(client, v, b, v->gl_visual->RGBAflag, (XMesaDrawable)p, cmap)) { - gl_destroy_framebuffer( b->gl_buffer ); + _mesa_destroy_framebuffer( b->gl_buffer ); free_xmesa_buffer(client, b); return NULL; } @@ -2001,7 +2001,7 @@ void XMesaDestroyBuffer( XMesaBuffer b ) if (b->xm_context) b->xm_context->xm_buffer = NULL; - gl_destroy_framebuffer( b->gl_buffer ); + _mesa_destroy_framebuffer( b->gl_buffer ); free_xmesa_buffer(client, b); } @@ -2044,7 +2044,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, return GL_TRUE; } #endif - if (c->gl_ctx == gl_get_current_context() + if (c->gl_ctx == _mesa_get_current_context() && c->xm_buffer == drawBuffer && c->xm_read_buffer == readBuffer && c->xm_buffer->wasCurrent) { @@ -2061,7 +2061,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, c->xm_read_buffer = readBuffer; c->use_read_buffer = (drawBuffer != readBuffer); - gl_make_current2(c->gl_ctx, drawBuffer->gl_buffer, readBuffer->gl_buffer); + _mesa_make_current2(c->gl_ctx, drawBuffer->gl_buffer, readBuffer->gl_buffer); if (c->gl_ctx->Viewport.Width == 0) { /* initialize viewport to window size */ @@ -2092,7 +2092,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, } else { /* Detach */ - gl_make_current2( NULL, NULL, NULL ); + _mesa_make_current2( NULL, NULL, NULL ); } return GL_TRUE; } @@ -2151,12 +2151,12 @@ XMesaBuffer XMesaGetCurrentReadBuffer( void ) GLboolean XMesaForceCurrent(XMesaContext c) { if (c) { - if (c->gl_ctx != gl_get_current_context()) { - gl_make_current(c->gl_ctx, c->xm_buffer->gl_buffer); + if (c->gl_ctx != _mesa_get_current_context()) { + _mesa_make_current(c->gl_ctx, c->xm_buffer->gl_buffer); } } else { - gl_make_current(NULL, NULL); + _mesa_make_current(NULL, NULL); } return GL_TRUE; } @@ -2165,7 +2165,7 @@ GLboolean XMesaForceCurrent(XMesaContext c) GLboolean XMesaLoseCurrent(XMesaContext c) { (void) c; - gl_make_current(NULL, NULL); + _mesa_make_current(NULL, NULL); return GL_TRUE; } diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index 86b85eccba..03af57b3bf 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -1,4 +1,4 @@ -/* $Id: xm_line.c,v 1.2 2000/09/12 17:03:59 brianp Exp $ */ +/* $Id: xm_line.c,v 1.3 2000/09/26 20:54:13 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -683,7 +683,7 @@ line_func xmesa_get_line_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Line.Width==1.0F) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 870a257573..29b97a03b0 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1,4 +1,4 @@ -/* $Id: xm_tri.c,v 1.2 2000/09/12 17:03:59 brianp Exp $ */ +/* $Id: xm_tri.c,v 1.3 2000/09/26 20:54:13 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1548,7 +1548,7 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: @@ -1580,7 +1580,7 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 9d311f21f3..ebea73981f 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -1,4 +1,4 @@ -/* $Id: xmesaP.h,v 1.12 2000/09/07 15:42:38 brianp Exp $ */ +/* $Id: xmesaP.h,v 1.13 2000/09/26 20:54:13 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -127,7 +127,7 @@ struct xmesa_visual { /* - * "Derived" from gl_context. Basically corresponds to a GLXContext. + * "Derived" from __GLcontextRec. Basically corresponds to a GLXContext. */ struct xmesa_context { GLcontext *gl_ctx; /* the core library context */ diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index d4b1b5ba92..f3f97af303 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.23 2000/09/26 15:27:23 brianp Exp $ +# $Id: Makefile.X11,v 1.24 2000/09/26 20:53:53 brianp Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -55,6 +55,7 @@ CORE_SOURCES = \ hint.c \ image.c \ imaging.c \ + imports.c \ light.c \ lines.c \ logic.c \ diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 3539418150..aeb6743c2f 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -1,4 +1,4 @@ -/* $Id: accum.c,v 1.25 2000/09/08 21:28:04 brianp Exp $ */ +/* $Id: accum.c,v 1.26 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -146,13 +146,13 @@ _mesa_Accum( GLenum op, GLfloat value ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum"); - if (ctx->Visual->AccumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) { + if (ctx->Visual.AccumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) { gl_error(ctx, GL_INVALID_OPERATION, "glAccum"); return; } if (!ctx->DrawBuffer->Accum) { - gl_warning(ctx, "Calling glAccum() without an accumulation buffer (low memory?)"); + _mesa_warning(ctx, "Calling glAccum() without an accumulation buffer (low memory?)"); return; } @@ -430,7 +430,7 @@ _mesa_clear_accum_buffer( GLcontext *ctx ) GLuint buffersize; GLfloat acc_scale; - if (ctx->Visual->AccumRedBits==0) { + if (ctx->Visual.AccumRedBits==0) { /* No accumulation buffer! */ return; } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 8c40063c13..b3c3643513 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.26 2000/08/21 14:22:24 brianp Exp $ */ +/* $Id: attrib.c,v 1.27 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -445,7 +445,7 @@ _mesa_PopAttrib(void) ctx->Driver.LogicOpcode) { ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp ); } - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index c53dd13704..dfa8a77d34 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -1,4 +1,4 @@ -/* $Id: buffers.c,v 1.11 2000/09/08 21:28:04 brianp Exp $ */ +/* $Id: buffers.c,v 1.12 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -51,7 +51,7 @@ _mesa_ClearIndex( GLfloat c ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex"); ctx->Color.ClearIndex = (GLuint) c; - if (!ctx->Visual->RGBAflag) { + if (!ctx->Visual.RGBAflag) { /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); } @@ -71,7 +71,7 @@ _mesa_ClearColor( GLclampf red, GLclampf green, ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F ); ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F ); - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); @@ -94,7 +94,7 @@ clear_color_buffer_with_masking( GLcontext *ctx ) const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin; const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin; - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { /* RGBA mode */ const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); @@ -145,7 +145,7 @@ clear_color_buffer(GLcontext *ctx) const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin; const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { /* RGBA mode */ const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); @@ -170,7 +170,7 @@ clear_color_buffer(GLcontext *ctx) else { /* Color index mode */ ASSERT(ctx->Color.IndexMask == ~0); - if (ctx->Visual->IndexBits == 8) { + if (ctx->Visual.IndexBits == 8) { /* 8-bit clear */ GLubyte span[MAX_WIDTH]; GLint i; @@ -331,64 +331,63 @@ _mesa_DrawBuffer( GLenum mode ) gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; case GL_RIGHT: - if (!ctx->Visual->StereoFlag) { + if (!ctx->Visual.StereoFlag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); - return; - } - if (ctx->Visual->DBflag) + return;} + if (ctx->Visual.DBflag) ctx->Color.DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT; else ctx->Color.DrawDestMask = FRONT_RIGHT_BIT; break; case GL_FRONT_RIGHT: - if (!ctx->Visual->StereoFlag) { + if (!ctx->Visual.StereoFlag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawDestMask = FRONT_RIGHT_BIT; break; case GL_BACK_RIGHT: - if (!ctx->Visual->StereoFlag) { + if (!ctx->Visual.StereoFlag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } - if (!ctx->Visual->DBflag) { + if (!ctx->Visual.DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawDestMask = BACK_RIGHT_BIT; break; case GL_BACK_LEFT: - if (!ctx->Visual->DBflag) { + if (!ctx->Visual.DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawDestMask = BACK_LEFT_BIT; break; case GL_FRONT_AND_BACK: - if (!ctx->Visual->DBflag) { + if (!ctx->Visual.DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } - if (ctx->Visual->StereoFlag) + if (ctx->Visual.StereoFlag) ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT | FRONT_RIGHT_BIT | BACK_RIGHT_BIT; else ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; break; case GL_BACK: - if (!ctx->Visual->DBflag) { + if (!ctx->Visual.DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } - if (ctx->Visual->StereoFlag) + if (ctx->Visual.StereoFlag) ctx->Color.DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT; else ctx->Color.DrawDestMask = BACK_LEFT_BIT; break; case GL_LEFT: /* never an error */ - if (ctx->Visual->DBflag) + if (ctx->Visual.DBflag) ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; else ctx->Color.DrawDestMask = FRONT_LEFT_BIT; @@ -399,7 +398,7 @@ _mesa_DrawBuffer( GLenum mode ) break; case GL_FRONT: /* never an error */ - if (ctx->Visual->StereoFlag) + if (ctx->Visual.StereoFlag) ctx->Color.DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT; else ctx->Color.DrawDestMask = FRONT_LEFT_BIT; @@ -416,13 +415,13 @@ _mesa_DrawBuffer( GLenum mode ) /* * Make the dest buffer mode more precise if possible */ - if (mode == GL_LEFT && !ctx->Visual->DBflag) + if (mode == GL_LEFT && !ctx->Visual.DBflag) ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; - else if (mode == GL_RIGHT && !ctx->Visual->DBflag) + else if (mode == GL_RIGHT && !ctx->Visual.DBflag) ctx->Color.DriverDrawBuffer = GL_FRONT_RIGHT; - else if (mode == GL_FRONT && !ctx->Visual->StereoFlag) + else if (mode == GL_FRONT && !ctx->Visual.StereoFlag) ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; - else if (mode == GL_BACK && !ctx->Visual->StereoFlag) + else if (mode == GL_BACK && !ctx->Visual.StereoFlag) ctx->Color.DriverDrawBuffer = GL_BACK_LEFT; else ctx->Color.DriverDrawBuffer = mode; @@ -492,7 +491,7 @@ _mesa_ReadBuffer( GLenum mode ) case GL_BACK: case GL_BACK_LEFT: /* Back-Left buffer, requires double buffering */ - if (!ctx->Visual->DBflag) { + if (!ctx->Visual.DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } @@ -500,14 +499,14 @@ _mesa_ReadBuffer( GLenum mode ) break; case GL_FRONT_RIGHT: case GL_RIGHT: - if (!ctx->Visual->StereoFlag) { + if (!ctx->Visual.StereoFlag) { gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } ctx->Pixel.DriverReadBuffer = GL_FRONT_RIGHT; break; case GL_BACK_RIGHT: - if (!ctx->Visual->StereoFlag || !ctx->Visual->DBflag) { + if (!ctx->Visual.StereoFlag || !ctx->Visual.DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } @@ -529,7 +528,7 @@ _mesa_ReadBuffer( GLenum mode ) void _mesa_ResizeBuffersMESA( void ) { - GLcontext *ctx = gl_get_current_context(); + GLcontext *ctx = _mesa_get_current_context(); GLuint buf_width, buf_height; diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c index d3d1395d26..5d589f7638 100644 --- a/src/mesa/main/clip.c +++ b/src/mesa/main/clip.c @@ -1,4 +1,4 @@ -/* $Id: clip.c,v 1.8 2000/04/17 18:18:00 keithw Exp $ */ +/* $Id: clip.c,v 1.9 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -375,7 +375,7 @@ void gl_update_clipmask( GLcontext *ctx ) { GLuint mask = 0; - if (ctx->Visual->RGBAflag) + if (ctx->Visual.RGBAflag) { mask |= CLIP_RGBA0; diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index e19dce2276..562040d431 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h,v 1.16 2000/08/21 14:24:53 brianp Exp $ */ +/* $Id: config.h,v 1.17 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -140,7 +140,7 @@ /* * Bits per depth buffer value: 16 or 32 (GLushort or GLuint) - * gl_create_visual() can select any depth in [0, 32]. + * _mesa_create_visual() can specify any depth in [0, 32]. */ #define DEFAULT_SOFTWARE_DEPTH_BITS 16 #define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort @@ -194,13 +194,13 @@ #define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS) - -typedef struct gl_context GLcontext; +typedef struct __GLcontextRec GLcontext; extern void -gl_read_config_file( struct gl_context *ctx ); +gl_read_config_file(GLcontext *ctx); extern void gl_register_config_var(const char *name, void (*notify)( const char *, int )); + #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 551327254f..a66bb13972 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.89 2000/09/26 15:27:22 brianp Exp $ */ +/* $Id: context.c,v 1.90 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -29,23 +29,21 @@ #include "all.h" #else #include "glheader.h" -#include "accum.h" -#include "alphabuf.h" +#include "buffers.h" #include "clip.h" #include "colortab.h" #include "context.h" #include "cva.h" -#include "depth.h" #include "dlist.h" #include "eval.h" #include "enums.h" #include "extensions.h" #include "fog.h" #include "get.h" -#include "glapi.h" #include "glapinoop.h" #include "glthread.h" #include "hash.h" +#include "imports.h" #include "light.h" #include "macros.h" #include "matrix.h" @@ -55,31 +53,94 @@ #include "pipeline.h" #include "shade.h" #include "simple_list.h" -#include "stencil.h" #include "stages.h" #include "state.h" #include "translate.h" #include "teximage.h" #include "texobj.h" -#include "texstate.h" #include "texture.h" #include "types.h" #include "varray.h" #include "vb.h" -#include "vbcull.h" #include "vbrender.h" #include "vbxform.h" #include "vertices.h" #include "xform.h" #endif - #if defined(MESA_TRACE) #include "Trace/tr_context.h" #include "Trace/tr_wrapper.h" #endif + +/**********************************************************************/ +/***** OpenGL SI-style interface (new in Mesa 3.5) *****/ +/**********************************************************************/ + +static GLboolean +_mesa_DestroyContext(__GLcontext *gc) +{ + if (gc) { + _mesa_free_context_data(gc); + (*gc->imports.free)(gc, gc); + } + return GL_TRUE; +} + + +/* exported OpenGL SI interface */ +__GLcontext * +__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) +{ + GLcontext *ctx; + + ctx = (GLcontext *) (*imports->calloc)(0, 1, sizeof(GLcontext)); + if (ctx == NULL) { + return NULL; + } + ctx->imports = *imports; + + _mesa_initialize_visual(&ctx->Visual, + modes->rgbMode, + modes->doubleBufferMode, + modes->stereoMode, + modes->redBits, + modes->greenBits, + modes->blueBits, + modes->alphaBits, + modes->indexBits, + modes->depthBits, + modes->stencilBits, + modes->accumRedBits, + modes->accumGreenBits, + modes->accumBlueBits, + modes->accumAlphaBits, + 0); + + _mesa_initialize_context(ctx, &ctx->Visual, NULL, imports->wscx, GL_FALSE); + + ctx->exports.destroyContext = _mesa_DestroyContext; + + return ctx; +} + + +/* exported OpenGL SI interface */ +void +__glCoreNopDispatch(void) +{ +#if 0 + /* SI */ + __gl_dispatch = __glNopDispatchState; +#else + /* Mesa */ + _glapi_set_dispatch(NULL); +#endif +} + + /**********************************************************************/ /***** Context and Thread management *****/ /**********************************************************************/ @@ -138,7 +199,7 @@ _mesa_create_visual( GLboolean rgbFlag, indexBits, depthBits, stencilBits, accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits, - numSamples )) { + numSamples)) { FREE(vis); return NULL; } @@ -238,29 +299,6 @@ _mesa_initialize_visual( GLvisual *vis, } -/* This function should no longer be used. Use _mesa_create_visual() instead */ -GLvisual * -gl_create_visual( GLboolean rgbFlag, - GLboolean alphaFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint depthBits, - GLint stencilBits, - GLint accumBits, - GLint indexBits, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits ) -{ - (void) alphaFlag; - return _mesa_create_visual(rgbFlag, dbFlag, stereoFlag, - redBits, greenBits, blueBits, alphaBits, - indexBits, depthBits, stencilBits, - accumBits, accumBits, accumBits, accumBits, 0); -} - - void _mesa_destroy_visual( GLvisual *vis ) { @@ -268,15 +306,6 @@ _mesa_destroy_visual( GLvisual *vis ) } -/* obsolete */ -void -gl_destroy_visual( GLvisual *vis ) -{ - _mesa_destroy_visual(vis); -} - - - /**********************************************************************/ /***** GL Framebuffer allocation/destruction *****/ /**********************************************************************/ @@ -295,11 +324,11 @@ gl_destroy_visual( GLvisual *vis ) * Return: pointer to new GLframebuffer struct or NULL if error. */ GLframebuffer * -gl_create_framebuffer( GLvisual *visual, - GLboolean softwareDepth, - GLboolean softwareStencil, - GLboolean softwareAccum, - GLboolean softwareAlpha ) +_mesa_create_framebuffer( GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ) { GLframebuffer *buffer = CALLOC_STRUCT(gl_frame_buffer); assert(visual); @@ -314,7 +343,7 @@ gl_create_framebuffer( GLvisual *visual, /* * Initialize a GLframebuffer object. - * Input: See gl_create_framebuffer() above. + * Input: See _mesa_create_framebuffer() above. */ void _mesa_initialize_framebuffer( GLframebuffer *buffer, @@ -357,7 +386,7 @@ _mesa_initialize_framebuffer( GLframebuffer *buffer, * Free a framebuffer struct and its buffers. */ void -gl_destroy_framebuffer( GLframebuffer *buffer ) +_mesa_destroy_framebuffer( GLframebuffer *buffer ) { if (buffer) { if (buffer->DepthBuffer) { @@ -969,8 +998,6 @@ init_attrib_groups( GLcontext *ctx ) ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; - - /* Pipeline */ gl_pipeline_init( ctx ); gl_cva_init( ctx ); @@ -1179,8 +1206,8 @@ init_attrib_groups( GLcontext *ctx ) #define Sz 10 #define Tz 14 - ctx->Viewport.WindowMap.m[Sz] = 0.5 * ctx->Visual->DepthMaxF; - ctx->Viewport.WindowMap.m[Tz] = 0.5 * ctx->Visual->DepthMaxF; + ctx->Viewport.WindowMap.m[Sz] = 0.5 * ctx->Visual.DepthMaxF; + ctx->Viewport.WindowMap.m[Tz] = 0.5 * ctx->Visual.DepthMaxF; #undef Sz #undef Tz @@ -1379,7 +1406,6 @@ alloc_proxy_textures( GLcontext *ctx ) } - /* * Initialize a GLcontext struct. This includes allocating all the * other structs and arrays which hang off of the context by pointers. @@ -1398,8 +1424,16 @@ _mesa_initialize_context( GLcontext *ctx, /* misc one-time initializations */ one_time_init(); + /** + ** OpenGL SI stuff + **/ + if (!ctx->imports.malloc) { + _mesa_InitDefaultImports(&ctx->imports, driver_ctx, NULL); + } + /* exports are setup by the device driver */ + ctx->DriverCtx = driver_ctx; - ctx->Visual = visual; + ctx->Visual = *visual; ctx->DrawBuffer = NULL; ctx->ReadBuffer = NULL; @@ -1533,13 +1567,13 @@ _mesa_initialize_context( GLcontext *ctx, * Input: visual - a GLvisual pointer * sharelist - another context to share display lists with or NULL * driver_ctx - pointer to device driver's context state struct - * Return: pointer to a new gl_context struct or NULL if error. + * Return: pointer to a new __GLcontextRec or NULL if error. */ GLcontext * -gl_create_context( GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct ) +_mesa_create_context( GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct ) { GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) ); if (!ctx) { @@ -1562,14 +1596,14 @@ gl_create_context( GLvisual *visual, * But don't free() the GLcontext struct itself! */ void -gl_free_context_data( GLcontext *ctx ) +_mesa_free_context_data( GLcontext *ctx ) { struct gl_shine_tab *s, *tmps; GLuint i, j; /* if we're destroying the current context, unbind it first */ - if (ctx == gl_get_current_context()) { - gl_make_current(NULL, NULL); + if (ctx == _mesa_get_current_context()) { + _mesa_make_current(NULL, NULL); } gl_matrix_dtr( &ctx->ModelView ); @@ -1675,10 +1709,10 @@ gl_free_context_data( GLcontext *ctx ) * Destroy a GLcontext structure. */ void -gl_destroy_context( GLcontext *ctx ) +_mesa_destroy_context( GLcontext *ctx ) { if (ctx) { - gl_free_context_data(ctx); + _mesa_free_context_data(ctx); FREE( (void *) ctx ); } } @@ -1690,7 +1724,7 @@ gl_destroy_context( GLcontext *ctx ) * initialized. Currently just reads the config file. */ void -gl_context_initialize( GLcontext *ctx ) +_mesa_context_initialize( GLcontext *ctx ) { gl_read_config_file( ctx ); } @@ -1704,7 +1738,7 @@ gl_context_initialize( GLcontext *ctx ) * mask - bitwise OR of GL_*_BIT flags */ void -gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) +_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) { if (mask & GL_ACCUM_BUFFER_BIT) { MEMCPY( &dst->Accum, &src->Accum, sizeof(struct gl_accum_attrib) ); @@ -1779,9 +1813,10 @@ gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) /* * Set the current context, binding the given frame buffer to the context. */ -void gl_make_current( GLcontext *newCtx, GLframebuffer *buffer ) +void +_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer ) { - gl_make_current2( newCtx, buffer, buffer ); + _mesa_make_current2( newCtx, buffer, buffer ); } @@ -1789,8 +1824,9 @@ void gl_make_current( GLcontext *newCtx, GLframebuffer *buffer ) * Bind the given context to the given draw-buffer and read-buffer * and make it the current context for this thread. */ -void gl_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ) +void +_mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ) { #if 0 GLcontext *oldCtx = gl_get_context(); @@ -1798,7 +1834,7 @@ void gl_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, /* Flush the old context */ if (oldCtx) { - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(oldCtx, "gl_make_current"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(oldCtx, "_mesa_make_current"); /* unbind frame buffers from context */ if (oldCtx->DrawBuffer) { @@ -1816,7 +1852,7 @@ void gl_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, _glapi_check_multithread(); _glapi_set_context((void *) newCtx); - ASSERT(gl_get_current_context() == newCtx); + ASSERT(_mesa_get_current_context() == newCtx); if (newCtx) { SET_IMMEDIATE(newCtx, newCtx->input); _glapi_set_dispatch(newCtx->CurrentDispatch); @@ -1825,7 +1861,7 @@ void gl_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, _glapi_set_dispatch(NULL); /* none current */ } - if (MESA_VERBOSE) fprintf(stderr, "gl_make_current()\n"); + if (MESA_VERBOSE) fprintf(stderr, "_mesa_make_current()\n"); if (newCtx && drawBuffer && readBuffer) { /* TODO: check if newCtx and buffer's visual match??? */ @@ -1868,7 +1904,8 @@ void gl_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, * This isn't the fastest way to get the current context. * If you need speed, see the GET_CURRENT_CONTEXT() macro in context.h */ -GLcontext *gl_get_current_context( void ) +GLcontext * +_mesa_get_current_context( void ) { return (GLcontext *) _glapi_get_context(); } @@ -1923,23 +1960,10 @@ void gl_problem( const GLcontext *ctx, const char *s ) * something illogical or if there's likely a bug in their program * (like enabled depth testing without a depth buffer). */ -void gl_warning( const GLcontext *ctx, const char *s ) +void +_mesa_warning( const GLcontext *ctx, const char *s ) { - GLboolean debug; -#ifdef DEBUG - debug = GL_TRUE; -#else - if (getenv("MESA_DEBUG")) { - debug = GL_TRUE; - } - else { - debug = GL_FALSE; - } -#endif - if (debug) { - fprintf( stderr, "Mesa warning: %s\n", s ); - } - (void) ctx; + (*ctx->imports.warning)((__GLcontext *) ctx, (char *) s); } @@ -1947,7 +1971,8 @@ void gl_warning( const GLcontext *ctx, const char *s ) /* * Compile an error into current display list. */ -void gl_compile_error( GLcontext *ctx, GLenum error, const char *s ) +void +_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ) { if (ctx->CompileFlag) gl_save_error( ctx, error, s ); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 284f15e078..8345f9e70f 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -1,4 +1,4 @@ -/* $Id: context.h,v 1.18 2000/05/24 15:04:45 brianp Exp $ */ +/* $Id: context.h,v 1.19 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -92,27 +92,9 @@ _mesa_initialize_visual( GLvisual *v, GLint accumAlphaBits, GLint numSamples ); -/* this function is obsolete */ -extern GLvisual * -gl_create_visual( GLboolean rgbFlag, - GLboolean alphaFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint depthBits, - GLint stencilBits, - GLint accumBits, - GLint indexBits, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits ); - - extern void _mesa_destroy_visual( GLvisual *vis ); -/*obsolete */ extern void gl_destroy_visual( GLvisual *vis ); - /* @@ -121,11 +103,11 @@ _mesa_destroy_visual( GLvisual *vis ); * single entity. */ extern GLframebuffer * -gl_create_framebuffer( GLvisual *visual, - GLboolean softwareDepth, - GLboolean softwareStencil, - GLboolean softwareAccum, - GLboolean softwareAlpha ); +_mesa_create_framebuffer( GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ); extern void _mesa_initialize_framebuffer( GLframebuffer *fb, @@ -136,7 +118,7 @@ _mesa_initialize_framebuffer( GLframebuffer *fb, GLboolean softwareAlpha ); extern void -gl_destroy_framebuffer( GLframebuffer *buffer ); +_mesa_destroy_framebuffer( GLframebuffer *buffer ); @@ -145,10 +127,10 @@ gl_destroy_framebuffer( GLframebuffer *buffer ); * contains the rendering state. */ extern GLcontext * -gl_create_context( GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct); +_mesa_create_context( GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct); extern GLboolean _mesa_initialize_context( GLcontext *ctx, @@ -158,31 +140,31 @@ _mesa_initialize_context( GLcontext *ctx, GLboolean direct ); extern void -gl_free_context_data( GLcontext *ctx ); +_mesa_free_context_data( GLcontext *ctx ); extern void -gl_destroy_context( GLcontext *ctx ); +_mesa_destroy_context( GLcontext *ctx ); extern void -gl_context_initialize( GLcontext *ctx ); +_mesa_context_initialize( GLcontext *ctx ); extern void -gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); +_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); extern void -gl_make_current( GLcontext *ctx, GLframebuffer *buffer ); +_mesa_make_current( GLcontext *ctx, GLframebuffer *buffer ); extern void -gl_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer, +_mesa_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ); extern GLcontext * -gl_get_current_context(void); +_mesa_get_current_context(void); @@ -235,13 +217,13 @@ extern void gl_problem( const GLcontext *ctx, const char *s ); extern void -gl_warning( const GLcontext *ctx, const char *s ); +_mesa_warning( const GLcontext *ctx, const char *s ); extern void gl_error( GLcontext *ctx, GLenum error, const char *s ); extern void -gl_compile_error( GLcontext *ctx, GLenum error, const char *s ); +_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index fc37c29c1c..5f113447e7 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -1,4 +1,4 @@ -/* $Id: depth.c,v 1.18 2000/09/08 21:28:04 brianp Exp $ */ +/* $Id: depth.c,v 1.19 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -134,7 +134,7 @@ _mesa_DepthMask( GLboolean flag ) GLvoid * _mesa_zbuffer_address(GLcontext *ctx, GLint x, GLint y) { - if (ctx->Visual->DepthBits <= 16) + if (ctx->Visual.DepthBits <= 16) return (GLushort *) ctx->DrawBuffer->DepthBuffer + ctx->DrawBuffer->Width * y + x; else return (GLuint *) ctx->DrawBuffer->DepthBuffer + ctx->DrawBuffer->Width * y + x; @@ -641,7 +641,7 @@ _mesa_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y, } else { /* software depth buffer */ - if (ctx->Visual->DepthBits <= 16) { + if (ctx->Visual.DepthBits <= 16) { GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, x, y); GLuint passed = depth_test_span16(ctx, n, x, y, zptr, z, mask); return passed; @@ -1401,7 +1401,7 @@ _mesa_depth_test_pixels( GLcontext *ctx, } else { /* software depth testing */ - if (ctx->Visual->DepthBits <= 16) + if (ctx->Visual.DepthBits <= 16) software_depth_test_pixels16(ctx, n, x, y, z, mask); else software_depth_test_pixels32(ctx, n, x, y, z, mask); @@ -1456,7 +1456,7 @@ _mesa_read_depth_span( GLcontext *ctx, if (ctx->DrawBuffer->DepthBuffer) { /* read from software depth buffer */ - if (ctx->Visual->DepthBits <= 16) { + if (ctx->Visual.DepthBits <= 16) { const GLushort *zptr = Z_ADDRESS16( ctx, x, y ); GLuint i; for (i = 0; i < n; i++) { @@ -1496,7 +1496,7 @@ void _mesa_read_depth_span_float( GLcontext *ctx, GLint n, GLint x, GLint y, GLfloat depth[] ) { - const GLfloat scale = 1.0F / ctx->Visual->DepthMaxF; + const GLfloat scale = 1.0F / ctx->Visual.DepthMaxF; if (y < 0 || y >= ctx->DrawBuffer->Height || x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) { @@ -1528,7 +1528,7 @@ _mesa_read_depth_span_float( GLcontext *ctx, if (ctx->DrawBuffer->DepthBuffer) { /* read from software depth buffer */ - if (ctx->Visual->DepthBits <= 16) { + if (ctx->Visual.DepthBits <= 16) { const GLushort *zptr = Z_ADDRESS16( ctx, x, y ); GLuint i; for (i = 0; i < n; i++) { @@ -1585,7 +1585,7 @@ _mesa_alloc_depth_buffer( GLcontext *ctx ) } /* allocate new depth buffer, but don't initialize it */ - if (ctx->Visual->DepthBits <= 16) + if (ctx->Visual.DepthBits <= 16) bytesPerValue = sizeof(GLushort); else bytesPerValue = sizeof(GLuint); @@ -1614,7 +1614,7 @@ _mesa_alloc_depth_buffer( GLcontext *ctx ) void _mesa_clear_depth_buffer( GLcontext *ctx ) { - if (ctx->Visual->DepthBits == 0 + if (ctx->Visual.DepthBits == 0 || !ctx->DrawBuffer->DepthBuffer || !ctx->Depth.Mask) { /* no depth buffer, or writing to it is disabled */ @@ -1627,8 +1627,8 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) if (ctx->Scissor.Enabled) { /* only clear scissor region */ - if (ctx->Visual->DepthBits <= 16) { - const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax); + if (ctx->Visual.DepthBits <= 16) { + const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual.DepthMax); const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin; const GLint width = ctx->DrawBuffer->Width; GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer @@ -1642,7 +1642,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) } } else { - const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax); + const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual.DepthMax); const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin; const GLint width = ctx->DrawBuffer->Width; GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer @@ -1658,8 +1658,8 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) } else { /* clear whole buffer */ - if (ctx->Visual->DepthBits <= 16) { - const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax); + if (ctx->Visual.DepthBits <= 16) { + const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual.DepthMax); if ((clearValue & 0xff) == (clearValue >> 8)) { if (clearValue == 0) { BZERO(ctx->DrawBuffer->DepthBuffer, @@ -1694,7 +1694,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) } else { /* >16 bit depth buffer */ - const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax); + const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual.DepthMax); if (clearValue == 0) { BZERO(ctx->DrawBuffer->DepthBuffer, ctx->DrawBuffer->Width*ctx->DrawBuffer->Height*sizeof(GLuint)); diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index e96ed862ac..bb69c189c9 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.45 2000/08/23 14:33:04 brianp Exp $ */ +/* $Id: dlist.c,v 1.46 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2552,7 +2552,7 @@ static void save_PolygonOffset( GLfloat factor, GLfloat units ) static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { GET_CURRENT_CONTEXT(ctx); - save_PolygonOffset(factor, ctx->Visual->DepthMaxF * bias); + save_PolygonOffset(factor, ctx->Visual.DepthMaxF * bias); } diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index bfc4a59aa4..52e27fe5da 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.34 2000/09/12 21:09:24 brianp Exp $ */ +/* $Id: drawpix.c,v 1.35 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -202,7 +202,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, } else { /* setup array of fragment Z value to pass to zoom function */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual.DepthMaxF); GLint i; ASSERT(drawWidth < MAX_WIDTH); for (i=0; iVisual->RGBAflag) { + if (ctx->Visual.RGBAflag) { GLubyte *src = (GLubyte *) pixels + (skipRows * rowLength + skipPixels) * 4; if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { @@ -259,7 +259,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, return GL_TRUE; } else if (format==GL_RGB && type==GL_UNSIGNED_BYTE) { - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { GLubyte *src = (GLubyte *) pixels + (skipRows * rowLength + skipPixels) * 3; if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { @@ -295,7 +295,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, return GL_TRUE; } else if (format==GL_LUMINANCE && type==GL_UNSIGNED_BYTE) { - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { GLubyte *src = (GLubyte *) pixels + (skipRows * rowLength + skipPixels); if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { @@ -353,7 +353,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, return GL_TRUE; } else if (format==GL_LUMINANCE_ALPHA && type==GL_UNSIGNED_BYTE) { - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { GLubyte *src = (GLubyte *) pixels + (skipRows * rowLength + skipPixels)*2; if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { @@ -418,7 +418,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, } else if (format==GL_COLOR_INDEX && type==GL_UNSIGNED_BYTE) { GLubyte *src = (GLubyte *) pixels + skipRows * rowLength + skipPixels; - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { /* convert CI data to RGBA */ if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { /* no zooming */ @@ -510,7 +510,7 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, /* Fragment depth values */ if (ctx->Depth.Test || ctx->Fog.Enabled) { - GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); + GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual.DepthMaxF); GLint i; for (i = 0; i < drawWidth; i++) { zspan[i] = zval; @@ -620,7 +620,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, } /* Colors or indexes */ - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0F); GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0F); GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0F); @@ -641,7 +641,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, } if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort) - && !bias_or_scale && !zoom && ctx->Visual->RGBAflag) { + && !bias_or_scale && !zoom && ctx->Visual.RGBAflag) { /* Special case: directly write 16-bit depth values */ GLint row; for (row = 0; row < height; row++, y++) { @@ -654,8 +654,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP ); } } - else if (type==GL_UNSIGNED_INT && ctx->Visual->DepthBits == 32 - && !bias_or_scale && !zoom && ctx->Visual->RGBAflag) { + else if (type==GL_UNSIGNED_INT && ctx->Visual.DepthBits == 32 + && !bias_or_scale && !zoom && ctx->Visual.RGBAflag) { /* Special case: directly write 32-bit depth values */ GLint row; for (row = 0; row < height; row++, y++) { @@ -673,7 +673,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); _mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src, &ctx->Unpack, ctx->ImageTransferState ); - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { if (zoom) { gl_write_zoomed_rgba_span(ctx, width, x, y, zspan, (const GLubyte (*)[4])rgba, desty); @@ -725,7 +725,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, /* Fragment depth values */ if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual.DepthMaxF); GLint i; for (i=0;iVisual->RGBAflag) + if (ctx->Visual.RGBAflag) draw_rgba_pixels(ctx, x,y, width, height, format, type, pixels); else draw_index_pixels(ctx, x, y, width, height, type, pixels); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 731bbe72dd..67cf170689 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.23 2000/08/30 18:21:06 brianp Exp $ */ +/* $Id: enable.c,v 1.24 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -128,8 +128,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; case GL_DEPTH_TEST: - if (state && ctx->Visual->DepthBits==0) { - gl_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); + if (state && ctx->Visual.DepthBits==0) { + _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); return; } if (ctx->Depth.Test!=state) { @@ -342,8 +342,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->Texture.SharedPalette = state; break; case GL_STENCIL_TEST: - if (state && ctx->Visual->StencilBits==0) { - gl_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); + if (state && ctx->Visual.StencilBits==0) { + _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); return; } if (ctx->Stencil.Enabled!=state) { @@ -353,7 +353,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; case GL_TEXTURE_1D: - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { const GLuint curr = ctx->Texture.CurrentUnit; const GLuint flag = TEXTURE0_1D << (curr * 4); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; @@ -369,7 +369,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; case GL_TEXTURE_2D: - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { const GLuint curr = ctx->Texture.CurrentUnit; const GLuint flag = TEXTURE0_2D << (curr * 4); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; @@ -385,7 +385,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; case GL_TEXTURE_3D: - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { const GLuint curr = ctx->Texture.CurrentUnit; const GLuint flag = TEXTURE0_3D << (curr * 4); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; @@ -524,7 +524,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: if (ctx->Extensions.HaveTextureCubeMap) { - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { const GLuint curr = ctx->Texture.CurrentUnit; const GLuint flag = TEXTURE0_CUBE << (curr * 4); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index af08236989..9f0063476d 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -1,4 +1,4 @@ -/* $Id: feedback.c,v 1.10 2000/05/09 23:54:09 brianp Exp $ */ +/* $Id: feedback.c,v 1.11 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -80,18 +80,18 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) break; case GL_3D_COLOR: ctx->Feedback.Mask = FB_3D - | (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX); + | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX); ctx->Feedback.Type = type; break; case GL_3D_COLOR_TEXTURE: ctx->Feedback.Mask = FB_3D - | (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX) + | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) | FB_TEXTURE; ctx->Feedback.Type = type; break; case GL_4D_COLOR_TEXTURE: ctx->Feedback.Mask = FB_3D | FB_4D - | (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX) + | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) | FB_TEXTURE; ctx->Feedback.Type = type; break; @@ -168,7 +168,7 @@ static void feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv ) win[0] = VB->Win.data[v][0]; win[1] = VB->Win.data[v][1]; - win[2] = VB->Win.data[v][2] / ctx->Visual->DepthMaxF; + win[2] = VB->Win.data[v][2] / ctx->Visual.DepthMaxF; win[3] = 1.0 / VB->Win.data[v][3]; if (ctx->Light.ShadeModel == GL_SMOOTH) @@ -302,7 +302,7 @@ void gl_select_triangle( GLcontext *ctx, const struct vertex_buffer *VB = ctx->VB; if (gl_cull_triangle( ctx, v0, v1, v2, 0 )) { - const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; + const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF; gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); gl_update_hitflag( ctx, VB->Win.data[v2][2] * zs ); @@ -314,7 +314,7 @@ void gl_select_line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) { const struct vertex_buffer *VB = ctx->VB; - const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; + const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF; gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); } @@ -323,7 +323,7 @@ void gl_select_line( GLcontext *ctx, void gl_select_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; - const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; + const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF; GLuint i; for (i=first;i<=last;i++) { @@ -479,7 +479,7 @@ _mesa_RenderMode( GLenum mode ) if (ctx->Select.BufferCount > ctx->Select.BufferSize) { /* overflow */ #ifdef DEBUG - gl_warning(ctx, "Feedback buffer overflow"); + _mesa_warning(ctx, "Feedback buffer overflow"); #endif result = -1; } diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index 3479b3bd00..d547bf747f 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -1,4 +1,4 @@ -/* $Id: fog.c,v 1.19 2000/07/07 15:10:35 keithw Exp $ */ +/* $Id: fog.c,v 1.20 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -183,7 +183,7 @@ _mesa_fog_vertices( struct vertex_buffer *VB ) GLcontext *ctx = VB->ctx; GLuint i = VB->CullMode & 1; - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { /* Fog RGB colors */ if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { fog_rgba_tab[i]( VB, 0, VERT_FACE_FRONT ); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 69deced915..d10beda778 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.33 2000/09/15 19:57:51 brianp Exp $ */ +/* $Id: get.c,v 1.34 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -104,16 +104,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) switch (pname) { case GL_ACCUM_RED_BITS: - *params = INT_TO_BOOL(ctx->Visual->AccumRedBits); + *params = INT_TO_BOOL(ctx->Visual.AccumRedBits); break; case GL_ACCUM_GREEN_BITS: - *params = INT_TO_BOOL(ctx->Visual->AccumGreenBits); + *params = INT_TO_BOOL(ctx->Visual.AccumGreenBits); break; case GL_ACCUM_BLUE_BITS: - *params = INT_TO_BOOL(ctx->Visual->AccumBlueBits); + *params = INT_TO_BOOL(ctx->Visual.AccumBlueBits); break; case GL_ACCUM_ALPHA_BITS: - *params = INT_TO_BOOL(ctx->Visual->AccumAlphaBits); + *params = INT_TO_BOOL(ctx->Visual.AccumAlphaBits); break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]); @@ -125,7 +125,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = FLOAT_TO_BOOL(ctx->Pixel.AlphaBias); break; case GL_ALPHA_BITS: - *params = INT_TO_BOOL(ctx->Visual->AlphaBits); + *params = INT_TO_BOOL(ctx->Visual.AlphaBits); break; case GL_ALPHA_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.AlphaScale); @@ -182,7 +182,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = FLOAT_TO_BOOL(ctx->Pixel.BlueBias); break; case GL_BLUE_BITS: - *params = INT_TO_BOOL( ctx->Visual->BlueBits ); + *params = INT_TO_BOOL( ctx->Visual.BlueBits ); break; case GL_BLUE_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.BlueScale); @@ -276,7 +276,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = FLOAT_TO_BOOL(ctx->Pixel.DepthBias); break; case GL_DEPTH_BITS: - *params = INT_TO_BOOL(ctx->Visual->DepthBits); + *params = INT_TO_BOOL(ctx->Visual.DepthBits); break; case GL_DEPTH_CLEAR_VALUE: *params = FLOAT_TO_BOOL(ctx->Depth.Clear); @@ -301,7 +301,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ctx->Color.DitherFlag; break; case GL_DOUBLEBUFFER: - *params = ctx->Visual->DBflag; + *params = ctx->Visual.DBflag; break; case GL_DRAW_BUFFER: *params = ENUM_TO_BOOL(ctx->Color.DrawBuffer); @@ -349,7 +349,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = FLOAT_TO_BOOL(ctx->Pixel.GreenBias); break; case GL_GREEN_BITS: - *params = INT_TO_BOOL( ctx->Visual->GreenBits ); + *params = INT_TO_BOOL( ctx->Visual.GreenBits ); break; case GL_GREEN_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); @@ -364,13 +364,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) } break; case GL_INDEX_BITS: - *params = INT_TO_BOOL( ctx->Visual->IndexBits ); + *params = INT_TO_BOOL( ctx->Visual.IndexBits ); break; case GL_INDEX_CLEAR_VALUE: *params = INT_TO_BOOL(ctx->Color.ClearIndex); break; case GL_INDEX_MODE: - *params = ctx->Visual->RGBAflag ? GL_FALSE : GL_TRUE; + *params = ctx->Visual.RGBAflag ? GL_FALSE : GL_TRUE; break; case GL_INDEX_OFFSET: *params = INT_TO_BOOL(ctx->Pixel.IndexOffset); @@ -729,7 +729,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = FLOAT_TO_BOOL(ctx->Pixel.RedBias); break; case GL_RED_BITS: - *params = INT_TO_BOOL( ctx->Visual->RedBits ); + *params = INT_TO_BOOL( ctx->Visual.RedBits ); break; case GL_RED_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.RedScale); @@ -738,7 +738,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ENUM_TO_BOOL(ctx->RenderMode); break; case GL_RGBA_MODE: - *params = ctx->Visual->RGBAflag; + *params = ctx->Visual.RGBAflag; break; case GL_SCISSOR_BOX: params[0] = INT_TO_BOOL(ctx->Scissor.X); @@ -759,7 +759,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ctx->Texture.SharedPalette; break; case GL_STENCIL_BITS: - *params = INT_TO_BOOL(ctx->Visual->StencilBits); + *params = INT_TO_BOOL(ctx->Visual.StencilBits); break; case GL_STENCIL_CLEAR_VALUE: *params = INT_TO_BOOL(ctx->Stencil.Clear); @@ -789,7 +789,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Stencil.WriteMask); break; case GL_STEREO: - *params = ctx->Visual->StereoFlag; + *params = ctx->Visual.StereoFlag; break; case GL_SUBPIXEL_BITS: *params = INT_TO_BOOL(ctx->Const.SubPixelBits); @@ -1259,16 +1259,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) switch (pname) { case GL_ACCUM_RED_BITS: - *params = (GLdouble) ctx->Visual->AccumRedBits; + *params = (GLdouble) ctx->Visual.AccumRedBits; break; case GL_ACCUM_GREEN_BITS: - *params = (GLdouble) ctx->Visual->AccumGreenBits; + *params = (GLdouble) ctx->Visual.AccumGreenBits; break; case GL_ACCUM_BLUE_BITS: - *params = (GLdouble) ctx->Visual->AccumBlueBits; + *params = (GLdouble) ctx->Visual.AccumBlueBits; break; case GL_ACCUM_ALPHA_BITS: - *params = (GLdouble) ctx->Visual->AccumAlphaBits; + *params = (GLdouble) ctx->Visual.AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = (GLdouble) ctx->Accum.ClearColor[0]; @@ -1280,7 +1280,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.AlphaBias; break; case GL_ALPHA_BITS: - *params = (GLdouble) ctx->Visual->AlphaBits; + *params = (GLdouble) ctx->Visual.AlphaBits; break; case GL_ALPHA_SCALE: *params = (GLdouble) ctx->Pixel.AlphaScale; @@ -1337,7 +1337,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.BlueBias; break; case GL_BLUE_BITS: - *params = (GLdouble) ctx->Visual->BlueBits; + *params = (GLdouble) ctx->Visual.BlueBits; break; case GL_BLUE_SCALE: *params = (GLdouble) ctx->Pixel.BlueScale; @@ -1431,7 +1431,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.DepthBias; break; case GL_DEPTH_BITS: - *params = (GLdouble) ctx->Visual->DepthBits; + *params = (GLdouble) ctx->Visual.DepthBits; break; case GL_DEPTH_CLEAR_VALUE: *params = (GLdouble) ctx->Depth.Clear; @@ -1456,7 +1456,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Color.DitherFlag; break; case GL_DOUBLEBUFFER: - *params = (GLdouble) ctx->Visual->DBflag; + *params = (GLdouble) ctx->Visual.DBflag; break; case GL_DRAW_BUFFER: *params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer); @@ -1504,7 +1504,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.GreenBias; break; case GL_GREEN_BITS: - *params = (GLdouble) ctx->Visual->GreenBits; + *params = (GLdouble) ctx->Visual.GreenBits; break; case GL_GREEN_SCALE: *params = (GLdouble) ctx->Pixel.GreenScale; @@ -1519,13 +1519,13 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) } break; case GL_INDEX_BITS: - *params = (GLdouble) ctx->Visual->IndexBits; + *params = (GLdouble) ctx->Visual.IndexBits; break; case GL_INDEX_CLEAR_VALUE: *params = (GLdouble) ctx->Color.ClearIndex; break; case GL_INDEX_MODE: - *params = ctx->Visual->RGBAflag ? 0.0 : 1.0; + *params = ctx->Visual.RGBAflag ? 0.0 : 1.0; break; case GL_INDEX_OFFSET: *params = (GLdouble) ctx->Pixel.IndexOffset; @@ -1884,7 +1884,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.RedBias; break; case GL_RED_BITS: - *params = (GLdouble) ctx->Visual->RedBits; + *params = (GLdouble) ctx->Visual.RedBits; break; case GL_RED_SCALE: *params = (GLdouble) ctx->Pixel.RedScale; @@ -1893,7 +1893,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = ENUM_TO_DOUBLE(ctx->RenderMode); break; case GL_RGBA_MODE: - *params = (GLdouble) ctx->Visual->RGBAflag; + *params = (GLdouble) ctx->Visual.RGBAflag; break; case GL_SCISSOR_BOX: params[0] = (GLdouble) ctx->Scissor.X; @@ -1914,7 +1914,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Texture.SharedPalette; break; case GL_STENCIL_BITS: - *params = (GLdouble) ctx->Visual->StencilBits; + *params = (GLdouble) ctx->Visual.StencilBits; break; case GL_STENCIL_CLEAR_VALUE: *params = (GLdouble) ctx->Stencil.Clear; @@ -1944,7 +1944,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Stencil.WriteMask; break; case GL_STEREO: - *params = (GLdouble) ctx->Visual->StereoFlag; + *params = (GLdouble) ctx->Visual.StereoFlag; break; case GL_SUBPIXEL_BITS: *params = (GLdouble) ctx->Const.SubPixelBits; @@ -2414,16 +2414,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) switch (pname) { case GL_ACCUM_RED_BITS: - *params = (GLfloat) ctx->Visual->AccumRedBits; + *params = (GLfloat) ctx->Visual.AccumRedBits; break; case GL_ACCUM_GREEN_BITS: - *params = (GLfloat) ctx->Visual->AccumGreenBits; + *params = (GLfloat) ctx->Visual.AccumGreenBits; break; case GL_ACCUM_BLUE_BITS: - *params = (GLfloat) ctx->Visual->AccumBlueBits; + *params = (GLfloat) ctx->Visual.AccumBlueBits; break; case GL_ACCUM_ALPHA_BITS: - *params = (GLfloat) ctx->Visual->AccumAlphaBits; + *params = (GLfloat) ctx->Visual.AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = ctx->Accum.ClearColor[0]; @@ -2435,7 +2435,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ctx->Pixel.AlphaBias; break; case GL_ALPHA_BITS: - *params = (GLfloat) ctx->Visual->AlphaBits; + *params = (GLfloat) ctx->Visual.AlphaBits; break; case GL_ALPHA_SCALE: *params = ctx->Pixel.AlphaScale; @@ -2492,7 +2492,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ctx->Pixel.BlueBias; break; case GL_BLUE_BITS: - *params = (GLfloat) ctx->Visual->BlueBits; + *params = (GLfloat) ctx->Visual.BlueBits; break; case GL_BLUE_SCALE: *params = ctx->Pixel.BlueScale; @@ -2583,7 +2583,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Pixel.DepthBias; break; case GL_DEPTH_BITS: - *params = (GLfloat) ctx->Visual->DepthBits; + *params = (GLfloat) ctx->Visual.DepthBits; break; case GL_DEPTH_CLEAR_VALUE: *params = (GLfloat) ctx->Depth.Clear; @@ -2608,7 +2608,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Color.DitherFlag; break; case GL_DOUBLEBUFFER: - *params = (GLfloat) ctx->Visual->DBflag; + *params = (GLfloat) ctx->Visual.DBflag; break; case GL_DRAW_BUFFER: *params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer); @@ -2656,7 +2656,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Pixel.GreenBias; break; case GL_GREEN_BITS: - *params = (GLfloat) ctx->Visual->GreenBits; + *params = (GLfloat) ctx->Visual.GreenBits; break; case GL_GREEN_SCALE: *params = (GLfloat) ctx->Pixel.GreenScale; @@ -2671,13 +2671,13 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) } break; case GL_INDEX_BITS: - *params = (GLfloat) ctx->Visual->IndexBits; + *params = (GLfloat) ctx->Visual.IndexBits; break; case GL_INDEX_CLEAR_VALUE: *params = (GLfloat) ctx->Color.ClearIndex; break; case GL_INDEX_MODE: - *params = ctx->Visual->RGBAflag ? 0.0F : 1.0F; + *params = ctx->Visual.RGBAflag ? 0.0F : 1.0F; break; case GL_INDEX_OFFSET: *params = (GLfloat) ctx->Pixel.IndexOffset; @@ -3038,7 +3038,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ctx->Pixel.RedBias; break; case GL_RED_BITS: - *params = (GLfloat) ctx->Visual->RedBits; + *params = (GLfloat) ctx->Visual.RedBits; break; case GL_RED_SCALE: *params = ctx->Pixel.RedScale; @@ -3047,7 +3047,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ENUM_TO_FLOAT(ctx->RenderMode); break; case GL_RGBA_MODE: - *params = (GLfloat) ctx->Visual->RGBAflag; + *params = (GLfloat) ctx->Visual.RGBAflag; break; case GL_SCISSOR_BOX: params[0] = (GLfloat) ctx->Scissor.X; @@ -3068,7 +3068,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Texture.SharedPalette; break; case GL_STENCIL_BITS: - *params = (GLfloat) ctx->Visual->StencilBits; + *params = (GLfloat) ctx->Visual.StencilBits; break; case GL_STENCIL_CLEAR_VALUE: *params = (GLfloat) ctx->Stencil.Clear; @@ -3098,7 +3098,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Stencil.WriteMask; break; case GL_STEREO: - *params = (GLfloat) ctx->Visual->StereoFlag; + *params = (GLfloat) ctx->Visual.StereoFlag; break; case GL_SUBPIXEL_BITS: *params = (GLfloat) ctx->Const.SubPixelBits; @@ -3541,16 +3541,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) switch (pname) { case GL_ACCUM_RED_BITS: - *params = (GLint) ctx->Visual->AccumRedBits; + *params = (GLint) ctx->Visual.AccumRedBits; break; case GL_ACCUM_GREEN_BITS: - *params = (GLint) ctx->Visual->AccumGreenBits; + *params = (GLint) ctx->Visual.AccumGreenBits; break; case GL_ACCUM_BLUE_BITS: - *params = (GLint) ctx->Visual->AccumBlueBits; + *params = (GLint) ctx->Visual.AccumBlueBits; break; case GL_ACCUM_ALPHA_BITS: - *params = (GLint) ctx->Visual->AccumAlphaBits; + *params = (GLint) ctx->Visual.AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] ); @@ -3562,7 +3562,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Pixel.AlphaBias; break; case GL_ALPHA_BITS: - *params = ctx->Visual->AlphaBits; + *params = ctx->Visual.AlphaBits; break; case GL_ALPHA_SCALE: *params = (GLint) ctx->Pixel.AlphaScale; @@ -3619,7 +3619,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Pixel.BlueBias; break; case GL_BLUE_BITS: - *params = (GLint) ctx->Visual->BlueBits; + *params = (GLint) ctx->Visual.BlueBits; break; case GL_BLUE_SCALE: *params = (GLint) ctx->Pixel.BlueScale; @@ -3714,7 +3714,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Pixel.DepthBias; break; case GL_DEPTH_BITS: - *params = ctx->Visual->DepthBits; + *params = ctx->Visual.DepthBits; break; case GL_DEPTH_CLEAR_VALUE: *params = (GLint) ctx->Depth.Clear; @@ -3739,7 +3739,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Color.DitherFlag; break; case GL_DOUBLEBUFFER: - *params = (GLint) ctx->Visual->DBflag; + *params = (GLint) ctx->Visual.DBflag; break; case GL_DRAW_BUFFER: *params = (GLint) ctx->Color.DrawBuffer; @@ -3787,7 +3787,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Pixel.GreenBias; break; case GL_GREEN_BITS: - *params = (GLint) ctx->Visual->GreenBits; + *params = (GLint) ctx->Visual.GreenBits; break; case GL_GREEN_SCALE: *params = (GLint) ctx->Pixel.GreenScale; @@ -3802,13 +3802,13 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) } break; case GL_INDEX_BITS: - *params = (GLint) ctx->Visual->IndexBits; + *params = (GLint) ctx->Visual.IndexBits; break; case GL_INDEX_CLEAR_VALUE: *params = (GLint) ctx->Color.ClearIndex; break; case GL_INDEX_MODE: - *params = ctx->Visual->RGBAflag ? 0 : 1; + *params = ctx->Visual.RGBAflag ? 0 : 1; break; case GL_INDEX_OFFSET: *params = ctx->Pixel.IndexOffset; @@ -4167,7 +4167,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Pixel.RedBias; break; case GL_RED_BITS: - *params = (GLint) ctx->Visual->RedBits; + *params = (GLint) ctx->Visual.RedBits; break; case GL_RED_SCALE: *params = (GLint) ctx->Pixel.RedScale; @@ -4176,7 +4176,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->RenderMode; break; case GL_RGBA_MODE: - *params = (GLint) ctx->Visual->RGBAflag; + *params = (GLint) ctx->Visual.RGBAflag; break; case GL_SCISSOR_BOX: params[0] = (GLint) ctx->Scissor.X; @@ -4197,7 +4197,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Texture.SharedPalette; break; case GL_STENCIL_BITS: - *params = ctx->Visual->StencilBits; + *params = ctx->Visual.StencilBits; break; case GL_STENCIL_CLEAR_VALUE: *params = (GLint) ctx->Stencil.Clear; @@ -4227,7 +4227,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Stencil.WriteMask; break; case GL_STEREO: - *params = (GLint) ctx->Visual->StereoFlag; + *params = (GLint) ctx->Visual.StereoFlag; break; case GL_SUBPIXEL_BITS: *params = ctx->Const.SubPixelBits; diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index ab5cb2e477..f98e9885bb 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -1,4 +1,4 @@ -/* $Id: glheader.h,v 1.14 2000/09/15 15:42:45 brianp Exp $ */ +/* $Id: glheader.h,v 1.15 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -174,6 +174,12 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC #include "GL/glext.h" +#ifndef CAPI +#define CAPI +#endif +#include "glcore.h" + + /* Disable unreachable code warnings for Watcom C++ */ #ifdef __WATCOMC__ diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 2d4f3014e2..99cbcfa862 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.41 2000/09/14 23:13:51 brianp Exp $ */ +/* $Id: image.c,v 1.42 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2301,7 +2301,7 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, srcType == GL_UNSIGNED_INT_2_10_10_10_REV); /* this is intended for RGBA mode only */ - assert(ctx->Visual->RGBAflag); + assert(ctx->Visual.RGBAflag); /* Try simple cases first */ if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE) { @@ -2608,7 +2608,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, srcType == GL_UNSIGNED_INT_2_10_10_10_REV); /* this is intended for RGBA mode only */ - assert(ctx->Visual->RGBAflag); + assert(ctx->Visual.RGBAflag); /* general solution, no special cases, yet */ { @@ -3103,7 +3103,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest, /* clamp depth values to [0,1] and convert from floats to integers */ { - const GLfloat zs = ctx->Visual->DepthMaxF; + const GLfloat zs = ctx->Visual.DepthMaxF; GLuint i; for (i = 0; i < n; i++) { dest[i] = (GLdepth) (CLAMP(depth[i], 0.0F, 1.0F) * zs); diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c new file mode 100644 index 0000000000..c8f50dc12f --- /dev/null +++ b/src/mesa/main/imports.c @@ -0,0 +1,163 @@ +/* $Id: imports.c,v 1.1 2000/09/26 20:53:53 brianp Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * Imports are functions which the device driver or window system or + * operating system provides to the core renderer. The core renderer (Mesa) + * will call these functions in order to do memory allocation, simple I/O, + * etc. + * + * Some drivers will need to implement these functions themselves but + * many (most?) Mesa drivers will be fine using these. + * + * A server-side GL renderer will likely not use these functions since + * the renderer should use the XFree86-wrapped system calls. + */ + + +#include "glheader.h" +#include "imports.h" +#include "mem.h" + + +static void * +_mesa_Malloc(__GLcontext *gc, size_t size) +{ + return MALLOC(size); +} + +static void * +_mesa_Calloc(__GLcontext *gc, size_t numElem, size_t elemSize) +{ + return CALLOC(numElem * elemSize); +} + +static void * +_mesa_Realloc(__GLcontext *gc, void *oldAddr, size_t newSize) +{ + return realloc(oldAddr, newSize); +} + +static void +_mesa_Free(__GLcontext *gc, void *addr) +{ + FREE(addr); +} + +static void +_mesa_warning(__GLcontext *gc, char *str) +{ + GLboolean debug; +#ifdef DEBUG + debug = GL_TRUE; +#else + if (gc->imports.getenv("MESA_DEBUG")) { + debug = GL_TRUE; + } + else { + debug = GL_FALSE; + } +#endif + if (debug) { + fprintf(stderr, "Mesa warning: %s\n", str); + } +} + +static void +_mesa_fatal(__GLcontext *gc, char *str) +{ + fprintf(stderr, "%s\n", str); + abort(); +} + +static char * +_mesa_getenv(__GLcontext *gc, const char *var) +{ + (void) gc; + return getenv(var); +} + +static int +_mesa_atoi(__GLcontext *gc, const char *str) +{ + (void) gc; + return atoi(str); +} + +static int +_mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) +{ + /* XXX fix this */ + return sprintf(str, fmt); +} + +static void * +_mesa_fopen(__GLcontext *gc, const char *path, const char *mode) +{ + return fopen(path, mode); +} + +static int +_mesa_fclose(__GLcontext *gc, void *stream) +{ + return fclose(stream); +} + +static int +_mesa_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) +{ + /* XXX fix this */ + return fprintf(stream, fmt); +} + +/* XXX this really is driver-specific and can't be here */ +static __GLdrawablePrivate * +_mesa_GetDrawablePrivate(__GLcontext *gc) +{ + return NULL; +} + + +void +_mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other) +{ + imports->malloc = _mesa_Malloc; + imports->calloc = _mesa_Calloc; + imports->realloc = _mesa_Realloc; + imports->free = _mesa_Free; + imports->warning = _mesa_warning; + imports->fatal = _mesa_fatal; + imports->getenv = _mesa_getenv; + imports->atoi = _mesa_atoi; + imports->sprintf = _mesa_sprintf; + imports->fopen = _mesa_fopen; + imports->fclose = _mesa_fclose; + imports->fprintf = _mesa_fprintf; + imports->getDrawablePrivate = _mesa_GetDrawablePrivate; + imports->wscx = driverCtx; + imports->other = other; +} diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h new file mode 100644 index 0000000000..6153ce117d --- /dev/null +++ b/src/mesa/main/imports.h @@ -0,0 +1,39 @@ +/* $Id: imports.h,v 1.1 2000/09/26 20:53:53 brianp Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef IMPORTS_H +#define IMPORTS_H + + +#include "glheader.h" + + +extern void +_mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other); + + +#endif diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index eb5c83135e..e9e19f9d53 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,4 +1,4 @@ -/* $Id: light.c,v 1.16 2000/07/18 16:55:56 brianp Exp $ */ +/* $Id: light.c,v 1.17 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1268,7 +1268,7 @@ gl_update_lighting( GLcontext *ctx ) /* Precompute some shading values. */ - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { GLuint sides = ((ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) ? 2 : 1); GLuint side; for (side=0; side < sides; side++) { diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index 991cbd0668..191110e3f8 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -1,4 +1,4 @@ -/* $Id: lines.c,v 1.12 2000/07/14 14:04:07 brianp Exp $ */ +/* $Id: lines.c,v 1.13 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1070,7 +1070,7 @@ _mesa_print_line_function(GLcontext *ctx) */ void gl_set_line_function( GLcontext *ctx ) { - GLboolean rgbmode = ctx->Visual->RGBAflag; + GLboolean rgbmode = ctx->Visual.RGBAflag; /* TODO: antialiased lines */ if (ctx->RenderMode==GL_RENDER) { diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 52c48dd32b..2d9d857a2f 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.20 2000/09/17 21:56:07 brianp Exp $ */ +/* $Id: matrix.c,v 1.21 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1559,8 +1559,8 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) ctx->Viewport.WindowMap.m[MAT_TX] = ctx->Viewport.WindowMap.m[MAT_SX] + x; ctx->Viewport.WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F; ctx->Viewport.WindowMap.m[MAT_TY] = ctx->Viewport.WindowMap.m[MAT_SY] + y; - ctx->Viewport.WindowMap.m[MAT_SZ] = 0.5 * ctx->Visual->DepthMaxF; - ctx->Viewport.WindowMap.m[MAT_TZ] = 0.5 * ctx->Visual->DepthMaxF; + ctx->Viewport.WindowMap.m[MAT_SZ] = 0.5 * ctx->Visual.DepthMaxF; + ctx->Viewport.WindowMap.m[MAT_TZ] = 0.5 * ctx->Visual.DepthMaxF; ctx->Viewport.WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT; @@ -1617,8 +1617,8 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval ) ctx->Viewport.Near = n; ctx->Viewport.Far = f; - ctx->Viewport.WindowMap.m[MAT_SZ] = ctx->Visual->DepthMaxF * ((f - n) / 2.0); - ctx->Viewport.WindowMap.m[MAT_TZ] = ctx->Visual->DepthMaxF * ((f - n) / 2.0 + n); + ctx->Viewport.WindowMap.m[MAT_SZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0); + ctx->Viewport.WindowMap.m[MAT_TZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0 + n); ctx->ModelProjectWinMatrixUptodate = GL_FALSE; diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 519e1d96f0..b8682be1e4 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -1,4 +1,4 @@ -/* $Id: points.c,v 1.12 2000/08/16 17:26:06 brianp Exp $ */ +/* $Id: points.c,v 1.13 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1332,7 +1332,7 @@ _mesa_print_points_function(GLcontext *ctx) */ void gl_set_point_function( GLcontext *ctx ) { - GLboolean rgbmode = ctx->Visual->RGBAflag; + GLboolean rgbmode = ctx->Visual.RGBAflag; if (ctx->RenderMode==GL_RENDER) { if (ctx->NoRaster) { diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index 13f0a50c86..5ca3ffbc94 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -1,8 +1,8 @@ -/* $Id: polygon.c,v 1.11 2000/03/13 18:32:37 brianp Exp $ */ +/* $Id: polygon.c,v 1.12 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.3 + * Version: 3.5 * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * @@ -187,5 +187,5 @@ _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffsetEXT"); - _mesa_PolygonOffset(factor, bias * ctx->Visual->DepthMaxF ); + _mesa_PolygonOffset(factor, bias * ctx->Visual.DepthMaxF ); } diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 722431a948..da0ccee7e9 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,8 +1,8 @@ -/* $Id: rastpos.c,v 1.6 2000/03/03 17:47:39 brianp Exp $ */ +/* $Id: rastpos.c,v 1.7 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.3 + * Version: 3.5 * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * @@ -90,7 +90,7 @@ static void raster_pos4f( GLcontext *ctx, } else { /* use current color or index */ - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor, ctx->Current.ByteColor); } @@ -132,7 +132,7 @@ static void raster_pos4f( GLcontext *ctx, ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport.WindowMap.m[MAT_SY] + ctx->Viewport.WindowMap.m[MAT_TY]); ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport.WindowMap.m[MAT_SZ] + - ctx->Viewport.WindowMap.m[MAT_TZ]) / ctx->Visual->DepthMaxF; + ctx->Viewport.WindowMap.m[MAT_TZ]) / ctx->Visual.DepthMaxF; ctx->Current.RasterPos[3] = clip[3]; ctx->Current.RasterPosValid = GL_TRUE; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index dcc3bd1b6e..3578d28f89 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.27 2000/09/08 22:07:29 brianp Exp $ */ +/* $Id: state.c,v 1.28 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -705,7 +705,7 @@ static void update_rasterflags( GLcontext *ctx ) if (ctx->FogMode == FOG_FRAGMENT) ctx->RasterMask |= FOG_BIT; if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT; if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT; - if (ctx->Visual->RGBAflag) { + if (ctx->Visual.RGBAflag) { const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); if (colorMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT; if (ctx->Color.ColorLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT; @@ -746,12 +746,12 @@ static void update_rasterflags( GLcontext *ctx ) ctx->RasterMask |= MULTI_DRAW_BIT; ctx->TriangleCaps |= DD_MULTIDRAW; } - else if (ctx->Visual->RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) { + else if (ctx->Visual.RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) { /* all RGBA channels disabled */ ctx->RasterMask |= MULTI_DRAW_BIT; ctx->TriangleCaps |= DD_MULTIDRAW; } - else if (!ctx->Visual->RGBAflag && ctx->Color.IndexMask==0) { + else if (!ctx->Visual.RGBAflag && ctx->Color.IndexMask==0) { /* all color index bits disabled */ ctx->RasterMask |= MULTI_DRAW_BIT; ctx->TriangleCaps |= DD_MULTIDRAW; diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index f9cd4909df..bc14fed08d 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,4 +1,4 @@ -/* $Id: stencil.c,v 1.18 2000/09/08 21:28:04 brianp Exp $ */ +/* $Id: stencil.c,v 1.19 2000/09/26 20:53:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1268,7 +1268,7 @@ _mesa_alloc_stencil_buffer( GLcontext *ctx ) static void clear_software_stencil_buffer( GLcontext *ctx ) { - if (ctx->Visual->StencilBits==0 || !ctx->DrawBuffer->Stencil) { + if (ctx->Visual.StencilBits==0 || !ctx->DrawBuffer->Stencil) { /* no stencil buffer */ return; } -- cgit v1.2.3