diff options
Diffstat (limited to 'src/mesa/main')
49 files changed, 610 insertions, 508 deletions
diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index 2d714c20c80..4e44c4fd480 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.70 2002/10/16 17:57:03 brianp Exp $ +# $Id: Makefile.X11,v 1.71 2002/10/24 23:57:19 brianp Exp $ # Mesa 3-D graphics library # Version: 4.1 @@ -55,7 +55,6 @@ CORE_SOURCES = \ light.c \ lines.c \ matrix.c \ - mem.c \ mmath.c \ pixel.c \ points.c \ diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index d190508a615..7f0145d0be1 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -1,10 +1,10 @@ -/* $Id: accum.c,v 1.38 2001/09/14 21:36:43 brianp Exp $ */ +/* $Id: accum.c,v 1.39 2002/10/24 23:57:19 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,20 +24,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "accum.h" #include "context.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "state.h" #include "mtypes.h" -#endif - - void diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 0a39ecdefb9..5d8609b9104 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1,4 +1,4 @@ -/* $Id: api_arrayelt.c,v 1.9 2002/06/15 02:38:15 brianp Exp $ */ +/* $Id: api_arrayelt.c,v 1.10 2002/10/24 23:57:19 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -32,7 +32,7 @@ #include "api_arrayelt.h" #include "context.h" #include "glapi.h" -#include "mem.h" +#include "imports.h" #include "macros.h" #include "mtypes.h" diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index c3aba1ad8b7..33e3ea140fa 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -1,4 +1,4 @@ -/* $Id: api_validate.c,v 1.6 2002/04/21 21:04:46 brianp Exp $ */ +/* $Id: api_validate.c,v 1.7 2002/10/24 23:57:19 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -27,6 +27,7 @@ #include "glheader.h" #include "api_validate.h" #include "context.h" +#include "imports.h" #include "mtypes.h" #include "state.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 32a87f33ce3..aabea8c066a 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.74 2002/10/17 22:26:06 kschultz Exp $ */ +/* $Id: attrib.c,v 1.75 2002/10/24 23:57:19 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,11 +24,8 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "accum.h" #include "attrib.h" #include "blend.h" @@ -43,7 +40,6 @@ #include "light.h" #include "lines.h" #include "matrix.h" -#include "mem.h" #include "points.h" #include "polygon.h" #include "simple_list.h" @@ -52,9 +48,6 @@ #include "texstate.h" #include "mtypes.h" #include "math/m_xform.h" -#endif - - /* diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 98385e0a70a..0b1f86e3e69 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1,4 +1,4 @@ -/* $Id: blend.c,v 1.37 2002/10/04 19:10:07 brianp Exp $ */ +/* $Id: blend.c,v 1.38 2002/10/24 23:57:19 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "blend.h" #include "colormac.h" @@ -35,7 +32,6 @@ #include "enums.h" #include "macros.h" #include "mtypes.h" -#endif void diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index efb35531680..14994c61f73 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -1,4 +1,4 @@ -/* $Id: buffers.c,v 1.41 2002/10/11 17:41:03 brianp Exp $ */ +/* $Id: buffers.c,v 1.42 2002/10/24 23:57:19 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,10 +25,8 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "accum.h" #include "buffers.h" #include "colormac.h" @@ -36,11 +34,9 @@ #include "depth.h" #include "enums.h" #include "macros.h" -#include "mem.h" #include "stencil.h" #include "state.h" #include "mtypes.h" -#endif diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c index 168ae350b27..79565a0fb31 100644 --- a/src/mesa/main/clip.c +++ b/src/mesa/main/clip.c @@ -1,4 +1,4 @@ -/* $Id: clip.c,v 1.25 2002/03/29 17:29:12 brianp Exp $ */ +/* $Id: clip.c,v 1.26 2002/10/24 23:57:19 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "clip.h" #include "context.h" @@ -37,7 +34,6 @@ #include "math/m_xform.h" #include "math/m_matrix.h" -#endif diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 88963dccc68..fb5c94259dd 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1,4 +1,4 @@ -/* $Id: colortab.c,v 1.45 2002/07/09 01:22:50 brianp Exp $ */ +/* $Id: colortab.c,v 1.46 2002/10/24 23:57:19 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,19 +25,14 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colortab.h" #include "context.h" #include "image.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "state.h" -#endif - /* diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4bd36bbcded..fef403671ec 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.185 2002/10/16 17:57:51 brianp Exp $ */ +/* $Id: context.c,v 1.186 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,10 +25,8 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "buffers.h" #include "clip.h" #include "colortab.h" @@ -43,7 +41,6 @@ #include "hash.h" #include "light.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "simple_list.h" #include "state.h" @@ -58,7 +55,7 @@ #include "math/m_matrix.h" #include "math/m_xform.h" #include "math/mathmod.h" -#endif + #if defined(MESA_TRACE) #include "Trace/tr_context.h" @@ -94,7 +91,7 @@ _mesa_destroyContext(__GLcontext *gc) { if (gc) { _mesa_free_context_data(gc); - (*gc->imports.free)(gc, gc); + _mesa_free(gc); } return GL_TRUE; } @@ -240,9 +237,8 @@ __glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) return NULL; } + _mesa_initialize_context(ctx, modes, NULL, imports, GL_FALSE); ctx->imports = *imports; - _mesa_init_default_exports(&(ctx->exports)); - _mesa_initialize_context(ctx, modes, NULL, imports); return ctx; } @@ -561,7 +557,7 @@ one_time_init( GLcontext *ctx ) #ifdef USE_SPARC_ASM _mesa_init_sparc_glapi_relocs(); #endif - if ((*ctx->imports.getenv)(ctx, "MESA_DEBUG")) { + if (_mesa_getenv("MESA_DEBUG")) { _glapi_noop_enable_warnings(GL_TRUE); #ifndef GLX_DIRECT_RENDERING /* libGL from before 2002/06/28 don't have this function. Someday, @@ -1477,13 +1473,13 @@ init_attrib_groups( GLcontext *ctx ) ctx->_Facing = 0; /* For debug/development only */ - ctx->NoRaster = (*ctx->imports.getenv)(ctx, "MESA_NO_RASTER") ? GL_TRUE : GL_FALSE; + ctx->NoRaster = _mesa_getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE; ctx->FirstTimeCurrent = GL_TRUE; /* Dither disable */ - ctx->NoDither = (*ctx->imports.getenv)(ctx, "MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; + ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; if (ctx->NoDither) { - if ((*ctx->imports.getenv)(ctx, "MESA_DEBUG")) { + if (_mesa_getenv("MESA_DEBUG")) { _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); } ctx->Color.DitherFlag = GL_FALSE; @@ -1592,36 +1588,36 @@ alloc_proxy_textures( GLcontext *ctx ) static void add_debug_flags( const char *debug ) { #ifdef MESA_DEBUG - if (strstr(debug, "varray")) + if (_mesa_strstr(debug, "varray")) MESA_VERBOSE |= VERBOSE_VARRAY; - if (strstr(debug, "tex")) + if (_mesa_strstr(debug, "tex")) MESA_VERBOSE |= VERBOSE_TEXTURE; - if (strstr(debug, "imm")) + if (_mesa_strstr(debug, "imm")) MESA_VERBOSE |= VERBOSE_IMMEDIATE; - if (strstr(debug, "pipe")) + if (_mesa_strstr(debug, "pipe")) MESA_VERBOSE |= VERBOSE_PIPELINE; - if (strstr(debug, "driver")) + if (_mesa_strstr(debug, "driver")) MESA_VERBOSE |= VERBOSE_DRIVER; - if (strstr(debug, "state")) + if (_mesa_strstr(debug, "state")) MESA_VERBOSE |= VERBOSE_STATE; - if (strstr(debug, "api")) + if (_mesa_strstr(debug, "api")) MESA_VERBOSE |= VERBOSE_API; - if (strstr(debug, "list")) + if (_mesa_strstr(debug, "list")) MESA_VERBOSE |= VERBOSE_DISPLAY_LIST; - if (strstr(debug, "lighting")) + if (_mesa_strstr(debug, "lighting")) MESA_VERBOSE |= VERBOSE_LIGHTING; /* Debug flag: */ - if (strstr(debug, "flush")) + if (_mesa_strstr(debug, "flush")) MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; #endif } @@ -1635,16 +1631,18 @@ GLboolean _mesa_initialize_context( GLcontext *ctx, const GLvisual *visual, GLcontext *share_list, - const __GLimports *imports ) + void *driver_ctx, + GLboolean direct ) { GLuint dispatchSize; const char *c; - ASSERT(imports); - ASSERT(imports->other); /* other points to the device driver's context */ + ASSERT(driver_ctx); - /* assing imports */ - ctx->imports = *imports; + /* If the driver wants core Mesa to use special imports, it'll have to + * override these defaults. + */ + _mesa_init_default_imports( &(ctx->imports), driver_ctx ); /* initialize the exports (Mesa functions called by the window system) */ _mesa_init_default_exports( &(ctx->exports) ); @@ -1652,17 +1650,7 @@ _mesa_initialize_context( GLcontext *ctx, /* misc one-time initializations */ one_time_init(ctx); -#if 0 - /** - ** OpenGL SI stuff - **/ - if (!ctx->imports.malloc) { - _mesa_init_default_imports(&ctx->imports, driver_ctx); - } - /* exports are setup by the device driver */ -#endif - - ctx->DriverCtx = imports->other; + ctx->DriverCtx = driver_ctx; ctx->Visual = *visual; ctx->DrawBuffer = NULL; ctx->ReadBuffer = NULL; @@ -1860,11 +1848,11 @@ _mesa_initialize_context( GLcontext *ctx, } ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ - c = (*ctx->imports.getenv)(ctx, "MESA_DEBUG"); + c = _mesa_getenv("MESA_DEBUG"); if (c) add_debug_flags(c); - c = (*ctx->imports.getenv)(ctx, "MESA_VERBOSE"); + c = _mesa_getenv("MESA_VERBOSE"); if (c) add_debug_flags(c); @@ -1877,29 +1865,31 @@ _mesa_initialize_context( GLcontext *ctx, * Allocate and initialize a GLcontext structure. * Input: visual - a GLvisual pointer (we copy the struct contents) * sharelist - another context to share display lists with or NULL - * imports - points to a fully-initialized __GLimports object. + * driver_ctx - pointer to device driver's context state struct + * direct - direct rendering? * Return: pointer to a new __GLcontextRec or NULL if error. */ GLcontext * _mesa_create_context( const GLvisual *visual, GLcontext *share_list, - const __GLimports *imports ) + void *driver_ctx, + GLboolean direct ) + { GLcontext *ctx; ASSERT(visual); - ASSERT(imports); - ASSERT(imports->calloc); + ASSERT(driver_ctx); - ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext)); + ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); if (!ctx) return NULL; - if (_mesa_initialize_context(ctx, visual, share_list, imports)) { + if (_mesa_initialize_context(ctx, visual, share_list, driver_ctx, direct)) { return ctx; } else { - (*imports->free)(NULL, ctx); + _mesa_free(ctx); return NULL; } } @@ -2281,7 +2271,7 @@ _mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, * information. */ if (newCtx->FirstTimeCurrent) { - if ((*newCtx->imports.getenv)(newCtx, "MESA_INFO")) { + if (_mesa_getenv("MESA_INFO")) { print_info(); } newCtx->FirstTimeCurrent = GL_FALSE; diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 937b9c59a3d..8b1de0a53aa 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -1,4 +1,4 @@ -/* $Id: context.h,v 1.34 2002/10/14 17:08:21 brianp Exp $ */ +/* $Id: context.h,v 1.35 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,7 +31,6 @@ #include "glapi.h" #include "mtypes.h" -#include "imports.h" /* @@ -128,13 +127,15 @@ _mesa_destroy_framebuffer( GLframebuffer *buffer ); extern GLcontext * _mesa_create_context( const GLvisual *visual, GLcontext *share_list, - const __GLimports *imports ); + void *driver_ctx, + GLboolean direct ); extern GLboolean _mesa_initialize_context( GLcontext *ctx, const GLvisual *visual, GLcontext *share_list, - const __GLimports *imports ); + void *driver_ctx, + GLboolean direct ); extern void _mesa_free_context_data( GLcontext *ctx ); diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index ce01a121871..a5e71b8cbdc 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -1,8 +1,8 @@ -/* $Id: convolve.c,v 1.27 2002/07/09 01:22:50 brianp Exp $ */ +/* $Id: convolve.c,v 1.28 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -33,9 +33,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "convolve.h" @@ -43,7 +40,6 @@ #include "image.h" #include "mtypes.h" #include "state.h" -#endif /* diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 039f7a01a7b..2be25feb5a0 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -1,4 +1,4 @@ -/* $Id: debug.c,v 1.13 2002/06/29 19:48:15 brianp Exp $ */ +/* $Id: debug.c,v 1.14 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -26,9 +26,12 @@ #include "mtypes.h" #include "context.h" +#include "imports.h" #include "debug.h" -void _mesa_print_state( const char *msg, GLuint state ) + +void +_mesa_print_state( const char *msg, GLuint state ) { _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", @@ -62,7 +65,8 @@ void _mesa_print_state( const char *msg, GLuint state ) -void _mesa_print_tri_caps( const char *name, GLuint flags ) +void +_mesa_print_tri_caps( const char *name, GLuint flags ) { _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 1ae912529bb..8383bcc6085 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -1,4 +1,4 @@ -/* $Id: depth.c,v 1.30 2002/06/15 02:38:15 brianp Exp $ */ +/* $Id: depth.c,v 1.31 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,18 +25,13 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "context.h" #include "enums.h" #include "depth.h" #include "macros.h" -#include "mem.h" #include "mtypes.h" -#endif - /**********************************************************************/ diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index 463bdb70d04..91155bc2c60 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -1,4 +1,4 @@ -/* $Id: dispatch.c,v 1.27 2002/06/29 19:48:15 brianp Exp $ */ +/* $Id: dispatch.c,v 1.28 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -36,14 +36,11 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "glapi.h" #include "glapitable.h" #include "glthread.h" -#endif + #if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM)) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index f8c21d97db8..5df4f6e2c89 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.98 2002/10/16 17:57:51 brianp Exp $ */ +/* $Id: dlist.c,v 1.99 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,11 +24,8 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "api_loopback.h" #include "attrib.h" #include "blend.h" @@ -55,7 +52,6 @@ #include "dlist.h" #include "macros.h" #include "matrix.h" -#include "mem.h" #include "pixel.h" #include "points.h" #include "polygon.h" @@ -72,8 +68,6 @@ #include "math/m_matrix.h" #include "math/m_xform.h" -#endif - /* @@ -4880,8 +4874,8 @@ execute_list( GLcontext *ctx, GLuint list ) default: { char msg[1000]; - _mesa_sprintf( ctx, msg, "Error in execute_list: opcode=%d", (int) opcode); - _mesa_problem( ctx, msg ); + _mesa_sprintf(msg, "Error in execute_list: opcode=%d", (int) opcode); + _mesa_problem(ctx, msg); } done = GL_TRUE; } @@ -6275,13 +6269,13 @@ static void print_list( GLcontext *ctx, GLuint list ) GLboolean done; if (!glIsList(list)) { - _mesa_printf(ctx, "%u is not a display list ID\n", list); + _mesa_printf("%u is not a display list ID\n", list); return; } n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); - _mesa_printf(ctx, "START-LIST %u, address %p\n", list, (void*)n ); + _mesa_printf("START-LIST %u, address %p\n", list, (void*)n ); done = n ? GL_FALSE : GL_TRUE; while (!done) { @@ -6295,136 +6289,136 @@ static void print_list( GLcontext *ctx, GLuint list ) else { switch (opcode) { case OPCODE_ACCUM: - _mesa_printf(ctx, "accum %s %g\n", enum_string(n[1].e), n[2].f ); + _mesa_printf("accum %s %g\n", enum_string(n[1].e), n[2].f ); break; case OPCODE_BITMAP: - _mesa_printf(ctx, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, + _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data ); break; case OPCODE_CALL_LIST: - _mesa_printf(ctx, "CallList %d\n", (int) n[1].ui ); + _mesa_printf("CallList %d\n", (int) n[1].ui ); break; case OPCODE_CALL_LIST_OFFSET: - _mesa_printf(ctx, "CallList %d + offset %u = %u\n", (int) n[1].ui, + _mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui, ctx->List.ListBase, ctx->List.ListBase + n[1].ui ); break; case OPCODE_COLOR_TABLE_PARAMETER_FV: - _mesa_printf(ctx, "ColorTableParameterfv %s %s %f %f %f %f\n", + _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n", enum_string(n[1].e), enum_string(n[2].e), n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_COLOR_TABLE_PARAMETER_IV: - _mesa_printf(ctx, "ColorTableParameteriv %s %s %d %d %d %d\n", + _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n", enum_string(n[1].e), enum_string(n[2].e), n[3].i, n[4].i, n[5].i, n[6].i); break; case OPCODE_DISABLE: - _mesa_printf(ctx, "Disable %s\n", enum_string(n[1].e)); + _mesa_printf("Disable %s\n", enum_string(n[1].e)); break; case OPCODE_ENABLE: - _mesa_printf(ctx, "Enable %s\n", enum_string(n[1].e)); + _mesa_printf("Enable %s\n", enum_string(n[1].e)); break; case OPCODE_FRUSTUM: - _mesa_printf(ctx, "Frustum %g %g %g %g %g %g\n", + _mesa_printf("Frustum %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); break; case OPCODE_LINE_STIPPLE: - _mesa_printf(ctx, "LineStipple %d %x\n", n[1].i, (int) n[2].us ); + _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us ); break; case OPCODE_LOAD_IDENTITY: - _mesa_printf(ctx, "LoadIdentity\n"); + _mesa_printf("LoadIdentity\n"); break; case OPCODE_LOAD_MATRIX: - _mesa_printf(ctx, "LoadMatrix\n"); - _mesa_printf(ctx, " %8f %8f %8f %8f\n", + _mesa_printf("LoadMatrix\n"); + _mesa_printf(" %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - _mesa_printf(ctx, " %8f %8f %8f %8f\n", + _mesa_printf(" %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - _mesa_printf(ctx, " %8f %8f %8f %8f\n", + _mesa_printf(" %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - _mesa_printf(ctx, " %8f %8f %8f %8f\n", + _mesa_printf(" %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_MULT_MATRIX: - _mesa_printf(ctx, "MultMatrix (or Rotate)\n"); - _mesa_printf(ctx, " %8f %8f %8f %8f\n", + _mesa_printf("MultMatrix (or Rotate)\n"); + _mesa_printf(" %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - _mesa_printf(ctx, " %8f %8f %8f %8f\n", + _mesa_printf(" %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - _mesa_printf(ctx, " %8f %8f %8f %8f\n", + _mesa_printf(" %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - _mesa_printf(ctx, " %8f %8f %8f %8f\n", + _mesa_printf(" %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_ORTHO: - _mesa_printf(ctx, "Ortho %g %g %g %g %g %g\n", + _mesa_printf("Ortho %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); break; case OPCODE_POP_ATTRIB: - _mesa_printf(ctx, "PopAttrib\n"); + _mesa_printf("PopAttrib\n"); break; case OPCODE_POP_MATRIX: - _mesa_printf(ctx, "PopMatrix\n"); + _mesa_printf("PopMatrix\n"); break; case OPCODE_POP_NAME: - _mesa_printf(ctx, "PopName\n"); + _mesa_printf("PopName\n"); break; case OPCODE_PUSH_ATTRIB: - _mesa_printf(ctx, "PushAttrib %x\n", n[1].bf ); + _mesa_printf("PushAttrib %x\n", n[1].bf ); break; case OPCODE_PUSH_MATRIX: - _mesa_printf(ctx, "PushMatrix\n"); + _mesa_printf("PushMatrix\n"); break; case OPCODE_PUSH_NAME: - _mesa_printf(ctx, "PushName %d\n", (int) n[1].ui ); + _mesa_printf("PushName %d\n", (int) n[1].ui ); break; case OPCODE_RASTER_POS: - _mesa_printf(ctx, "RasterPos %g %g %g %g\n", + _mesa_printf("RasterPos %g %g %g %g\n", n[1].f, n[2].f,n[3].f,n[4].f); break; case OPCODE_ROTATE: - _mesa_printf(ctx, "Rotate %g %g %g %g\n", + _mesa_printf("Rotate %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f ); break; case OPCODE_SCALE: - _mesa_printf(ctx, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f ); + _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f ); break; case OPCODE_TRANSLATE: - _mesa_printf(ctx, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f ); + _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f ); break; case OPCODE_BIND_TEXTURE: - _mesa_printf(ctx, "BindTexture %s %d\n", + _mesa_printf("BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); break; case OPCODE_SHADE_MODEL: - _mesa_printf(ctx, "ShadeModel %s\n", + _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); break; case OPCODE_MAP1: - _mesa_printf(ctx, "Map1 %s %.3f %.3f %d %d\n", + _mesa_printf("Map1 %s %.3f %.3f %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].i, n[5].i); break; case OPCODE_MAP2: - _mesa_printf(ctx, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", + _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].f, n[5].f, n[6].i, n[7].i, n[8].i, n[9].i); break; case OPCODE_MAPGRID1: - _mesa_printf(ctx, "MapGrid1 %d %.3f %.3f\n", + _mesa_printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_MAPGRID2: - _mesa_printf(ctx, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", + _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f); break; case OPCODE_EVALMESH1: - _mesa_printf(ctx, "EvalMesh1 %d %d\n", n[1].i, n[2].i); + _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); break; case OPCODE_EVALMESH2: - _mesa_printf(ctx, "EvalMesh2 %d %d %d %d\n", + _mesa_printf("EvalMesh2 %d %d %d %d\n", n[1].i, n[2].i, n[3].i, n[4].i); break; @@ -6432,27 +6426,25 @@ static void print_list( GLcontext *ctx, GLuint list ) * meta opcodes/commands */ case OPCODE_ERROR: - _mesa_printf(ctx, "Error: %s %s\n", + _mesa_printf("Error: %s %s\n", enum_string(n[1].e), (const char *)n[2].data ); break; case OPCODE_CONTINUE: - _mesa_printf(ctx, "DISPLAY-LIST-CONTINUE\n"); + _mesa_printf("DISPLAY-LIST-CONTINUE\n"); n = (Node *) n[1].next; break; case OPCODE_END_OF_LIST: - _mesa_printf(ctx, "END-LIST %u\n", list); + _mesa_printf("END-LIST %u\n", list); done = GL_TRUE; break; default: if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { - _mesa_printf(ctx, - "ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", - opcode, (void*) n); + _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", + opcode, (void*) n); return; } else { - _mesa_printf(ctx, "command %d, %u operands\n", - opcode, InstSize[opcode]); + _mesa_printf("command %d, %u operands\n", opcode, InstSize[opcode]); } } /* increment n to point to next compiled command */ diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 663bef47e28..1dbeefa23b2 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.62 2002/08/21 16:39:39 brianp Exp $ */ +/* $Id: drawpix.c,v 1.63 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,22 +24,16 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colormac.h" #include "context.h" #include "drawpix.h" #include "feedback.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "state.h" #include "mtypes.h" -#endif - /* diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 8f45a6706a7..744668fd293 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.70 2002/10/16 17:57:51 brianp Exp $ */ +/* $Id: enable.c,v 1.71 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "enable.h" @@ -39,7 +36,7 @@ #include "enums.h" #include "math/m_matrix.h" #include "math/m_xform.h" -#endif + #define CHECK_EXTENSION(EXTNAME, CAP) \ diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 93abf2ab5f8..f7a3e439ab8 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -1,4 +1,4 @@ -/* $Id: enums.c,v 1.21 2002/06/29 19:48:15 brianp Exp $ */ +/* $Id: enums.c,v 1.22 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -28,14 +28,9 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "enums.h" #include "imports.h" -#include "mem.h" -#endif typedef struct { @@ -929,7 +924,7 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } else { /* this isn't re-entrant safe, no big deal here */ - _mesa_sprintf(NULL, token_tmp, "0x%x", nr); + _mesa_sprintf(token_tmp, "0x%x", nr); return token_tmp; } } diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 2b02f9118b8..30767a6277e 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -1,4 +1,4 @@ -/* $Id: eval.c,v 1.23 2002/01/05 21:58:42 brianp Exp $ */ +/* $Id: eval.c,v 1.24 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -38,18 +38,14 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colormac.h" #include "context.h" #include "eval.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "mtypes.h" -#endif /* diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index f37c07d33dc..88868b9633f 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.83 2002/10/21 15:52:34 brianp Exp $ */ +/* $Id: extensions.c,v 1.84 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,17 +24,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "context.h" #include "extensions.h" -#include "mem.h" #include "simple_list.h" #include "mtypes.h" -#endif #define MAX_EXT_NAMELEN 80 diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index aead5bc65c5..330fd7d2be2 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -1,4 +1,4 @@ -/* $Id: feedback.c,v 1.26 2002/06/15 02:54:01 brianp Exp $ */ +/* $Id: feedback.c,v 1.27 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" @@ -36,7 +33,6 @@ #include "macros.h" #include "mmath.h" #include "mtypes.h" -#endif diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index dbb8269bd51..632a8ed32bb 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -1,4 +1,4 @@ -/* $Id: fog.c,v 1.35 2001/05/30 14:43:17 brianp Exp $ */ +/* $Id: fog.c,v 1.36 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,15 +25,11 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" #include "fog.h" #include "mtypes.h" -#endif diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 196740cb2e1..0d3db871dac 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.96 2002/10/16 17:57:52 brianp Exp $ */ +/* $Id: get.c,v 1.97 2002/10/24 23:57:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" @@ -40,7 +37,6 @@ #include "mtypes.h" #include "texcompress.h" #include "math/m_matrix.h" -#endif diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 831c39f8ca2..71df0cbf5bf 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -1,4 +1,4 @@ -/* $Id: hash.c,v 1.13 2002/09/16 17:55:36 brianp Exp $ */ +/* $Id: hash.c,v 1.14 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,16 +24,11 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "glthread.h" #include "hash.h" #include "context.h" -#include "mem.h" -#endif /** diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 57d7eae1fd7..7ccb7be5557 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -1,4 +1,4 @@ -/* $Id: hint.c,v 1.13 2002/06/15 02:54:02 brianp Exp $ */ +/* $Id: hint.c,v 1.14 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,15 +25,11 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "enums.h" #include "context.h" #include "hint.h" -#include "state.h" -#endif +#include "imports.h" diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index f115519dc63..134463956e2 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -1,4 +1,4 @@ -/* $Id: histogram.c,v 1.10 2001/03/12 00:48:38 gareth Exp $ */ +/* $Id: histogram.c,v 1.11 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,16 +25,12 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" #include "image.h" #include "histogram.h" #include "mmath.h" -#endif /* diff --git a/src/mesa/main/histogram.h b/src/mesa/main/histogram.h index 6432d91cf50..3cff4d0db5e 100644 --- a/src/mesa/main/histogram.h +++ b/src/mesa/main/histogram.h @@ -1,10 +1,10 @@ -/* $Id: histogram.h,v 1.3 2001/03/12 00:48:38 gareth Exp $ */ +/* $Id: histogram.h,v 1.4 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -28,14 +28,8 @@ #ifndef HISTOGRAM_H #define HISTOGRAM_H - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "mtypes.h" -#endif - extern void _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index e881b79ca48..3830b0318ee 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.68 2002/09/21 17:34:56 brianp Exp $ */ +/* $Id: image.c,v 1.69 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,22 +24,16 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" #include "image.h" +#include "imports.h" #include "histogram.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "pixel.h" #include "mtypes.h" -#endif - /* diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 290df64cf1e..3b88009edd5 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -1,4 +1,4 @@ -/* $Id: imports.c,v 1.20 2002/10/15 15:36:26 brianp Exp $ */ +/* $Id: imports.c,v 1.21 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -32,12 +32,17 @@ * etc. * * Some drivers will want to override/replace this file with something - * specialized, but most Mesa drivers will be able to call - *_mesa_init_default_imports() and go with what's here. + * specialized, but that'll be rare. * - * Eventually, I'd like to move most of the stuff in glheader.h and mem.[ch] - * into imports.[ch]. Then we'll really have one, single place where - * all OS-related dependencies are isolated. + * Eventually, I want to move roll the glheader.h file into this. + * + * The OpenGL SI's __GLimports structure allows per-context specification of + * replacements for the standard C lib functions. In practice that's probably + * never needed; compile-time replacements are far more likely. + * + * The _mesa_foo() functions defined here don't in general take a context + * parameter. I guess we can change that someday, if need be. + * So for now, the __GLimports stuff really isn't used. */ @@ -45,7 +50,7 @@ #include "mtypes.h" #include "context.h" #include "imports.h" -#include "mem.h" + #define MAXSTRING 4000 /* for vsnprintf() */ @@ -53,136 +58,243 @@ #define vsnprintf _vsnprintf #endif -static void * -_mesa_Malloc(__GLcontext *gc, size_t size) + +/**********************************************************************/ +/* Wrappers for standard C library functions */ +/**********************************************************************/ + + +void * +_mesa_malloc(size_t bytes) { - return MALLOC(size); +#ifdef XFree86LOADER + return xf86malloc(bytes); +#else + return malloc(bytes); +#endif } -static void * -_mesa_Calloc(__GLcontext *gc, size_t numElem, size_t elemSize) + +void * +_mesa_calloc(size_t bytes) { - return CALLOC(numElem * elemSize); +#ifdef XFree86LOADER + return xf86calloc(1, bytes); +#else + return calloc(1, bytes); +#endif } -static void * -_mesa_Realloc(__GLcontext *gc, void *oldAddr, size_t newSize) + +void +_mesa_free(void *ptr) { - return realloc(oldAddr, newSize); +#ifdef XFree86LOADER + xf86free(ptr); +#else + free(ptr); +#endif } -static void -_mesa_Free(__GLcontext *gc, void *addr) + +void * +_mesa_align_malloc(size_t bytes, unsigned long alignment) +{ + unsigned long ptr, buf; + + ASSERT( alignment > 0 ); + + ptr = (unsigned long) _mesa_malloc( bytes + alignment ); + + buf = (ptr + alignment) & ~(unsigned long)(alignment - 1); + *(unsigned long *)(buf - sizeof(void *)) = ptr; + +#ifdef DEBUG + /* mark the non-aligned area */ + while ( ptr < buf - sizeof(void *) ) { + *(unsigned long *)ptr = 0xcdcdcdcd; + ptr += sizeof(unsigned long); + } +#endif + + return (void *)buf; +} + + +void * +_mesa_align_calloc(size_t bytes, unsigned long alignment) { - FREE(addr); + unsigned long ptr, buf; + + ASSERT( alignment > 0 ); + + ptr = (unsigned long) _mesa_calloc( bytes + alignment ); + + buf = (ptr + alignment) & ~(unsigned long)(alignment - 1); + *(unsigned long *)(buf - sizeof(void *)) = ptr; + +#ifdef DEBUG + /* mark the non-aligned area */ + while ( ptr < buf - sizeof(void *) ) { + *(unsigned long *)ptr = 0xcdcdcdcd; + ptr += sizeof(unsigned long); + } +#endif + + return (void *)buf; } -/* Must be before '#undef getenv' for inclusion in XFree86. - */ -char * CAPI -_mesa_getenv(__GLcontext *gc, const char *var) +void +_mesa_align_free(void *ptr) +{ +#if 0 + _mesa_free( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) ); +#else + /* The actuall address to free is stuffed in the word immediately + * before the address the client sees. + */ + void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); + void *realAddr = *cubbyHole; + _mesa_free(realAddr); +#endif +} + + +void * +_mesa_memcpy(void *dest, const void *src, size_t n) { - (void) gc; #ifdef XFree86LOADER - return xf86getenv(var); + return xf86memcpy(dest, src, n); +#elif defined(SUNOS4) + return memcpy((char *) dest, (char *) src, (int) n); #else - return getenv(var); + return memcpy(dest, src, n); #endif } -static void -warning(__GLcontext *gc, char *str) +void +_mesa_memset( void *dst, int val, size_t n ) { - GLboolean debug; -#ifdef DEBUG - debug = GL_TRUE; +#ifdef XFree86LOADER + xf86memset( dst, val, n ); +#elif defined(SUNOS4) + memset( (char *) dst, (int) val, (int) n ); #else - if (_mesa_getenv(gc , "MESA_DEBUG")) - debug = GL_TRUE; - else - debug = GL_FALSE; + memset(dst, val, n); #endif - if (debug) { - fprintf(stderr, "Mesa warning: %s\n", str); - } } void -_mesa_fatal(__GLcontext *gc, char *str) +_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ) { - (void) gc; - fprintf(stderr, "%s\n", str); - abort(); + while (n-- > 0) + *dst++ = val; } -static int CAPI -_mesa_atoi(__GLcontext *gc, const char *str) +void +_mesa_bzero( void *dst, size_t n ) { - (void) gc; - return atoi(str); +#ifdef XFree86LOADER + xf86memset( dst, 0, n ); +#elif defined(__FreeBSD__) + bzero( dst, n ); +#else + memset( dst, 0, n ); +#endif } -int CAPI -_mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) +char * +_mesa_getenv( const char *var ) { - int r; - va_list args; - va_start( args, fmt ); - r = vsprintf( str, fmt, args ); - va_end( args ); - return r; +#ifdef XFree86LOADER + return xf86getenv(var); +#else + return getenv(var); +#endif } -void * CAPI -_mesa_fopen(__GLcontext *gc, const char *path, const char *mode) +char * +_mesa_strstr( const char *haystack, const char *needle ) { - return fopen(path, mode); +#ifdef XFree86LOADER + return xf86strstr(haystack, needle); +#else + return strstr(haystack, needle); +#endif } -int CAPI -_mesa_fclose(__GLcontext *gc, void *stream) +int +_mesa_atoi(const char *s) { - return fclose((FILE *) stream); +#ifdef XFree86LOADER + return xf86atoi(s); +#else + return atoi(s); +#endif } -int CAPI -_mesa_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) +int +_mesa_sprintf( char *str, const char *fmt, ... ) { int r; va_list args; va_start( args, fmt ); - r = vfprintf( (FILE *) stream, fmt, args ); va_end( args ); +#ifdef XFree86LOADER + r = xf86vsprintf( str, fmt, args ); +#else + r = vsprintf( str, fmt, args ); +#endif return r; } -/* XXX this really is driver-specific and can't be here */ -static __GLdrawablePrivate * -_mesa_GetDrawablePrivate(__GLcontext *gc) +void +_mesa_printf( const char *fmtString, ... ) { - return NULL; + char s[MAXSTRING]; + va_list args; + va_start( args, fmtString ); + vsnprintf(s, MAXSTRING, fmtString, args); + va_end( args ); +#ifdef XFree86LOADER + xf86printf("%s", s); +#else + printf("%s", s); +#endif } - void -_mesa_warning(__GLcontext *gc, const char *fmtString, ...) +_mesa_warning( GLcontext *ctx, const char *fmtString, ... ) { + GLboolean debug; char str[MAXSTRING]; va_list args; + (void) ctx; va_start( args, fmtString ); (void) vsnprintf( str, MAXSTRING, fmtString, args ); va_end( args ); - warning(gc, str); +#ifdef DEBUG + debug = GL_TRUE; /* always print warning */ +#else + debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE; +#endif + if (debug) { +#ifdef XFree86LOADER + xf86fprintf(stderr, "Mesa warning: %s\n", str); +#else + fprintf(stderr, "Mesa warning: %s\n", str); +#endif + } } @@ -193,23 +305,14 @@ _mesa_warning(__GLcontext *gc, const char *fmtString, ...) void _mesa_problem( const GLcontext *ctx, const char *s ) { - if (ctx) { - ctx->imports.fprintf((GLcontext *) ctx, stderr, "Mesa implementation error: %s\n", s); -#ifdef XF86DRI - ctx->imports.fprintf((GLcontext *) ctx, stderr, "Please report to the DRI bug database at dri.sourceforge.net\n"); -#else - ctx->imports.fprintf((GLcontext *) ctx, stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); -#endif - } - else { - /* what can we do if we don't have a context???? */ - fprintf( stderr, "Mesa implementation error: %s\n", s ); -#ifdef XF86DRI - fprintf( stderr, "Please report to the DRI bug database at dri.sourceforge.net\n"); + (void) ctx; +#ifdef XFree86LOADER + xf86fprintf(stderr, "Mesa implementation error: %s\n", s); + xf86fprintf(stderr, "Please report to the DRI project at dri.sourceforge.net\n"); #else - fprintf( stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); + fprintf(stderr, "Mesa implementation error: %s\n", s); + fprintf(stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); #endif - } } @@ -226,10 +329,10 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) const char *debugEnv; GLboolean debug; - debugEnv = _mesa_getenv(ctx, "MESA_DEBUG"); + debugEnv = _mesa_getenv("MESA_DEBUG"); #ifdef DEBUG - if (debugEnv && strstr(debugEnv, "silent")) + if (debugEnv && _mesa_strstr(debugEnv, "silent")) debug = GL_FALSE; else debug = GL_TRUE; @@ -295,31 +398,122 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) va_list args; va_start(args, fmtString); vsnprintf(s, MAXSTRING, fmtString, args); - if (ctx) - (void) ctx->imports.fprintf( (__GLcontext *) ctx, stderr, s ); - else - fprintf( stderr, s ); va_end(args); +#ifdef XFree86LOADER + xf86fprintf(stderr, "Mesa: %s", s); +#else + fprintf(stderr, "Mesa: %s", s); +#endif } -/* - * A wrapper for printf. Uses stdout. - */ -void -_mesa_printf( const GLcontext *ctx, const char *fmtString, ... ) + +/**********************************************************************/ +/* Default Imports Wrapper */ +/**********************************************************************/ + +static void * +default_malloc(__GLcontext *gc, size_t size) { - char s[MAXSTRING]; + (void) gc; + return _mesa_malloc(size); +} + +static void * +default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize) +{ + (void) gc; + return _mesa_calloc(numElem * elemSize); +} + +static void * +default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize) +{ + (void) gc; +#ifdef XFree86LOADER + return xf86realloc(oldAddr, newSize); +#else + return realloc(oldAddr, newSize); +#endif +} + +static void +default_free(__GLcontext *gc, void *addr) +{ + (void) gc; + _mesa_free(addr); +} + +static char * CAPI +default_getenv( __GLcontext *gc, const char *var ) +{ + (void) gc; + return _mesa_getenv(var); +} + +static void +default_warning(__GLcontext *gc, char *str) +{ + _mesa_warning(gc, str); +} + +static void +default_fatal(__GLcontext *gc, char *str) +{ + _mesa_problem(gc, str); + abort(); +} + +static int CAPI +default_atoi(__GLcontext *gc, const char *str) +{ + (void) gc; + return atoi(str); +} + +static int CAPI +default_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) +{ + int r; va_list args; - va_start( args, fmtString ); - vsnprintf(s, MAXSTRING, fmtString, args); - if (ctx) - (void) ctx->imports.fprintf( (__GLcontext *) ctx, stdout, s ); - else - printf( s ); + va_start( args, fmt ); + r = vsprintf( str, fmt, args ); va_end( args ); + return r; } +static void * CAPI +default_fopen(__GLcontext *gc, const char *path, const char *mode) +{ + return fopen(path, mode); +} + +static int CAPI +default_fclose(__GLcontext *gc, void *stream) +{ + return fclose((FILE *) stream); +} + +static int CAPI +default_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) +{ + int r; + va_list args; + va_start( args, fmt ); + r = vfprintf( (FILE *) stream, fmt, args ); + va_end( args ); + return r; +} + +/* XXX this really is driver-specific and can't be here */ +static __GLdrawablePrivate * +default_GetDrawablePrivate(__GLcontext *gc) +{ + return NULL; +} + + + /* * Initialize a __GLimports object to point to the functions in @@ -330,18 +524,18 @@ _mesa_printf( const GLcontext *ctx, const char *fmtString, ... ) void _mesa_init_default_imports(__GLimports *imports, void *driverCtx) { - imports->malloc = _mesa_Malloc; - imports->calloc = _mesa_Calloc; - imports->realloc = _mesa_Realloc; - imports->free = _mesa_Free; - imports->warning = 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->malloc = default_malloc; + imports->calloc = default_calloc; + imports->realloc = default_realloc; + imports->free = default_free; + imports->warning = default_warning; + imports->fatal = default_fatal; + imports->getenv = default_getenv; /* not used for now */ + imports->atoi = default_atoi; + imports->sprintf = default_sprintf; + imports->fopen = default_fopen; + imports->fclose = default_fclose; + imports->fprintf = default_fprintf; + imports->getDrawablePrivate = default_GetDrawablePrivate; imports->other = driverCtx; } diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 9363c4163e1..4054ed0c941 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -1,4 +1,4 @@ -/* $Id: imports.h,v 1.5 2002/10/15 15:36:26 brianp Exp $ */ +/* $Id: imports.h,v 1.6 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,48 +25,140 @@ */ +/* + * This file provides wrappers for all the standard C library functions + * like malloc, free, printf, getenv, etc. + */ + + #ifndef IMPORTS_H #define IMPORTS_H -#include "glheader.h" +#define MALLOC(BYTES) _mesa_malloc(BYTES) +#define CALLOC(BYTES) _mesa_calloc(BYTES) +#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T)) +#define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) +#define FREE(PTR) _mesa_free(PTR) + +#define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N) +#define ALIGN_CALLOC(BYTES, N) _mesa_align_calloc(BYTES, N) +#define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N) +#define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N) +#define ALIGN_FREE(PTR) _mesa_align_free(PTR) + +#define MEMCPY( DST, SRC, BYTES) _mesa_memcpy(DST, SRC, BYTES) +#define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N) +#define BZERO( ADDR, N ) _mesa_bzero(ADDR, N) + + +/* MACs and BeOS don't support static larger than 32kb, so... */ +#if defined(macintosh) && !defined(__MRC__) +/*extern char *AGLAlloc(int size);*/ +/*extern void AGLFree(char* ptr);*/ +# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_alloc(sizeof(TYPE)*(SIZE)) +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) + +# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) +# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) +#elif defined(__BEOS__) +# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_malloc(sizeof(TYPE)*(SIZE)) +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) +# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) +# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) +#else +# define DEFARRAY(TYPE,NAME,SIZE) TYPE NAME[SIZE] +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE NAME[SIZE1][SIZE2] +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE NAME[SIZE1][SIZE2][SIZE3] +# define CHECKARRAY(NAME,CMD) do {} while(0) +# define UNDEFARRAY(NAME) +#endif -extern int CAPI -_mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...); +#ifdef MESA_EXTERNAL_BUFFERALLOC +/* + * If you want Mesa's depth/stencil/accum/etc buffers to be allocated + * with a specialized allocator you can define MESA_EXTERNAL_BUFFERALLOC + * and implement _ext_mesa_alloc/free_pixelbuffer() in your app. + * Contributed by Gerk Huisma ([email protected]). + */ +extern void *_ext_mesa_alloc_pixelbuffer( unsigned int size ); +extern void _ext_mesa_free_pixelbuffer( void *pb ); + +#define MESA_PBUFFER_ALLOC(BYTES) (void *) _ext_mesa_alloc_pixelbuffer(BYTES) +#define MESA_PBUFFER_FREE(PTR) _ext_mesa_free_pixelbuffer(PTR) +#else +/* Default buffer allocation uses the aligned allocation routines: */ +#define MESA_PBUFFER_ALLOC(BYTES) (void *) _mesa_align_malloc(BYTES, 512) +#define MESA_PBUFFER_FREE(PTR) _mesa_align_free(PTR) +#endif + + +extern void * +_mesa_malloc( size_t bytes ); + +extern void * +_mesa_calloc( size_t bytes ); extern void -_mesa_warning(__GLcontext *gc, const char *fmtString, ...); +_mesa_free( void *ptr ); + +extern void * +_mesa_align_malloc( size_t bytes, unsigned long alignment ); + +extern void * +_mesa_align_calloc( size_t bytes, unsigned long alignment ); extern void -_mesa_fatal(__GLcontext *gc, char *str); +_mesa_align_free( void *ptr ); + +extern void * +_mesa_memcpy( void *dest, const void *src, size_t n ); extern void -_mesa_problem( const __GLcontext *ctx, const char *s ); +_mesa_memset( void *dst, int val, size_t n ); extern void -_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); +_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); extern void -_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); +_mesa_bzero( void *dst, size_t n ); + + +extern char * +_mesa_getenv( const char *var ); + +extern char * +_mesa_strstr( const char *haystack, const char *needle ); + +extern int +_mesa_atoi( const char *s ); + +extern int +_mesa_sprintf( char *str, const char *fmt, ... ); + +extern void +_mesa_printf( const char *fmtString, ... ); + extern void -_mesa_printf( const __GLcontext *ctx, const char *fmtString, ... ); +_mesa_warning( __GLcontext *gc, const char *fmtString, ... ); -extern int CAPI -_mesa_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...); +extern void +_mesa_problem( const __GLcontext *ctx, const char *s ); -extern void * CAPI -_mesa_fopen(__GLcontext *gc, const char *path, const char *mode); +extern void +_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); -extern int CAPI -_mesa_fclose(__GLcontext *gc, void *stream); +extern void +_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); -extern char * CAPI -_mesa_getenv(__GLcontext *gc, const char *var); extern void -_mesa_init_default_imports(__GLimports *imports, void *driverCtx); +_mesa_init_default_imports( __GLimports *imports, void *driverCtx ); -#endif +#endif /* IMPORTS_H */ + diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index ebddab0d282..638be5e8353 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,4 +1,4 @@ -/* $Id: light.c,v 1.52 2002/09/16 17:56:02 brianp Exp $ */ +/* $Id: light.c,v 1.53 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,23 +25,18 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colormac.h" #include "context.h" #include "enums.h" #include "light.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "simple_list.h" #include "mtypes.h" - #include "math/m_xform.h" #include "math/m_matrix.h" -#endif /* XXX this is a bit of a hack needed for compilation within XFree86 */ diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index 303ab71379c..0a33e1399e8 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -1,4 +1,4 @@ -/* $Id: lines.c,v 1.29 2001/03/12 00:48:38 gareth Exp $ */ +/* $Id: lines.c,v 1.30 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "depth.h" @@ -36,8 +33,6 @@ #include "mmath.h" #include "texstate.h" #include "mtypes.h" -#endif - void diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 1ad72f11b6b..0b5f0014024 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.44 2002/08/21 16:39:39 brianp Exp $ */ +/* $Id: matrix.c,v 1.45 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -35,21 +35,17 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "buffers.h" #include "context.h" #include "enums.h" #include "macros.h" #include "matrix.h" -#include "mem.h" #include "mmath.h" #include "mtypes.h" - #include "math/m_matrix.h" -#endif + void diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index ce1b2c57c2d..7ae50a77165 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1,4 +1,4 @@ -/* $Id: pixel.c,v 1.36 2002/09/21 17:34:56 brianp Exp $ */ +/* $Id: pixel.c,v 1.37 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,19 +24,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colormac.h" #include "context.h" #include "macros.h" -#include "mem.h" #include "pixel.h" #include "mtypes.h" -#endif - /**********************************************************************/ diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index cf9922479d5..f162da4b5bf 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -1,4 +1,4 @@ -/* $Id: points.c,v 1.33 2002/05/27 17:04:53 brianp Exp $ */ +/* $Id: points.c,v 1.34 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "macros.h" @@ -35,7 +32,6 @@ #include "points.h" #include "texstate.h" #include "mtypes.h" -#endif diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index 91c3933b543..a347b615df1 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -1,4 +1,4 @@ -/* $Id: polygon.c,v 1.24 2002/10/02 22:05:58 brianp Exp $ */ +/* $Id: polygon.c,v 1.25 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,19 +25,14 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "context.h" #include "image.h" #include "enums.h" #include "macros.h" -#include "mem.h" #include "polygon.h" #include "mtypes.h" -#endif - void diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 945eea9ecce..bb03c456973 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,4 +1,4 @@ -/* $Id: rastpos.c,v 1.38 2002/05/27 17:03:08 brianp Exp $ */ +/* $Id: rastpos.c,v 1.39 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "clip.h" #include "colormac.h" @@ -43,7 +40,6 @@ #include "math/m_matrix.h" #include "math/m_xform.h" -#endif /* diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 4df1afbc831..6948c78e7d6 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.95 2002/10/16 17:57:52 brianp Exp $ */ +/* $Id: state.c,v 1.96 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,9 +31,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "accum.h" #include "api_loopback.h" @@ -75,7 +72,6 @@ #include "math/m_matrix.h" #include "math/m_xform.h" -#endif static int diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 99f213c8541..b6afd660e6c 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,4 +1,4 @@ -/* $Id: stencil.c,v 1.28 2002/09/06 02:56:09 brianp Exp $ */ +/* $Id: stencil.c,v 1.29 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,20 +25,14 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "context.h" #include "depth.h" #include "macros.h" -#include "mem.h" #include "stencil.h" #include "mtypes.h" #include "enable.h" -#endif - - void diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 680c0bb0239..8474b4ee87f 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -1,4 +1,4 @@ -/* $Id: texcompress.c,v 1.2 2002/10/18 17:41:45 brianp Exp $ */ +/* $Id: texcompress.c,v 1.3 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -26,9 +26,9 @@ #include "glheader.h" +#include "imports.h" #include "context.h" #include "image.h" -#include "mem.h" #include "texcompress.h" #include "texformat.h" diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 1941c7a7b38..54257732e21 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1,4 +1,4 @@ -/* $Id: texformat.c,v 1.16 2002/09/27 02:45:38 brianp Exp $ */ +/* $Id: texformat.c,v 1.17 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -27,20 +27,16 @@ * Gareth Hughes <[email protected]> */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" #include "image.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" #include "texformat.h" #include "teximage.h" #include "texstate.h" -#endif /* Texel fetch routines for all supported formats: diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 74b526e0f3d..f7f428eb4e4 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.122 2002/10/18 18:03:04 brianp Exp $ */ +/* $Id: teximage.c,v 1.123 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,16 +24,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "convolve.h" #include "image.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "state.h" #include "texcompress.h" @@ -42,7 +38,6 @@ #include "texstate.h" #include "texstore.h" #include "mtypes.h" -#endif /* @@ -65,7 +60,7 @@ static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) const GLchan *data = (const GLchan *) img->Data; if (!data) { - _mesa_printf(ctx, "No texture data\n"); + _mesa_printf("No texture data\n"); return; } @@ -93,16 +88,16 @@ static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) for (i = 0; i < img->Height; i++) { for (j = 0; j < img->Width; j++) { if (c==1) - _mesa_printf(ctx, "%02x ", data[0]); + _mesa_printf("%02x ", data[0]); else if (c==2) - _mesa_printf(ctx, "%02x%02x ", data[0], data[1]); + _mesa_printf("%02x%02x ", data[0], data[1]); else if (c==3) - _mesa_printf(ctx, "%02x%02x%02x ", data[0], data[1], data[2]); + _mesa_printf("%02x%02x%02x ", data[0], data[1], data[2]); else if (c==4) - _mesa_printf(ctx, "%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); + _mesa_printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); data += (img->RowStride - img->Width) * c; } - _mesa_printf(ctx, "\n"); + _mesa_printf("\n"); } #endif } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index c58df0764c0..93ae40ac745 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $Id: texobj.c,v 1.61 2002/10/22 15:15:41 brianp Exp $ */ +/* $Id: texobj.c,v 1.62 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,23 +24,17 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colortab.h" #include "context.h" #include "enums.h" #include "hash.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "teximage.h" #include "texstate.h" #include "texobj.h" #include "mtypes.h" -#endif - /* diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 373b464a3c4..6c8dcc06703 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.83 2002/10/23 14:53:27 brianp Exp $ */ +/* $Id: texstate.c,v 1.84 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" @@ -40,7 +37,6 @@ #include "mtypes.h" #include "math/m_xform.h" #include "math/m_matrix.h" -#endif diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 2be6e476458..046e5289c52 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1,4 +1,4 @@ -/* $Id: texstore.c,v 1.44 2002/10/18 18:03:08 brianp Exp $ */ +/* $Id: texstore.c,v 1.45 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -53,13 +53,13 @@ */ - +#include "glheader.h" #include "colormac.h" #include "context.h" #include "convolve.h" #include "image.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "texcompress.h" #include "texformat.h" #include "teximage.h" diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c index 28a715a7237..94c052facae 100644 --- a/src/mesa/main/texutil.c +++ b/src/mesa/main/texutil.c @@ -1,4 +1,4 @@ -/* $Id: texutil.c,v 1.32 2002/09/27 02:45:38 brianp Exp $ */ +/* $Id: texutil.c,v 1.33 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -35,19 +35,16 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "enums.h" #include "image.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "mtypes.h" #include "texformat.h" #include "texutil.h" -#endif + #define DEBUG_TEXUTIL 0 diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 3fd318e7d4c..1b540eff447 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,4 +1,4 @@ -/* $Id: varray.c,v 1.46 2002/06/30 15:47:01 brianp Exp $ */ +/* $Id: varray.c,v 1.47 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -24,9 +24,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "enable.h" @@ -40,7 +37,6 @@ #include "mtypes.h" #include "varray.h" #include "math/m_translate.h" -#endif diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 44e387f92c5..54eef4a6028 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -1,4 +1,4 @@ -/* $Id: vtxfmt.c,v 1.12 2002/06/29 19:48:16 brianp Exp $ */ +/* $Id: vtxfmt.c,v 1.13 2002/10/24 23:57:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,6 +31,7 @@ #include "glheader.h" #include "api_loopback.h" #include "context.h" +#include "imports.h" #include "mtypes.h" #include "state.h" #include "vtxfmt.h" |