diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 1c163665091..11cc56d559e 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -1,4 +1,4 @@ -/* $Id: glapi.c,v 1.37 2000/02/24 22:14:04 brianp Exp $ */ +/* $Id: glapi.c,v 1.38 2000/03/19 01:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -223,354 +223,6 @@ _glapi_get_version(void) } -struct name_address_offset { - const char *Name; - GLvoid *Address; - GLuint Offset; -}; - -static struct name_address_offset static_functions[1000]; - - - -/* - * Return dispatch table offset of the named static (built-in) function. - * Return -1 if function not found. - */ -static GLint -get_static_proc_offset(const char *funcName) -{ - GLuint i; - for (i = 0; static_functions[i].Name; i++) { - if (strcmp(static_functions[i].Name, funcName) == 0) { - return static_functions[i].Offset; - } - } - return -1; -} - - -/* - * Return dispatch function address the named static (built-in) function. - * Return NULL if function not found. - */ -static GLvoid * -get_static_proc_address(const char *funcName) -{ - GLint i = get_static_proc_offset(funcName); - if (i >= 0) - return static_functions[i].Address; - else - return NULL; -} - - - -/********************************************************************** - * Extension function management. - */ - - -#define MAX_EXTENSION_FUNCS 1000 - -static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS]; -static GLuint NumExtEntryPoints = 0; - - - -/* - * Generate a dispatch function (entrypoint) which jumps through - * the given slot number (offset) in the current dispatch table. - * We need assembly language in order to accomplish this. - */ -static void * -generate_entrypoint(GLuint functionOffset) -{ -#if defined(USE_X86_ASM) - /* - * This x86 code contributed by Josh Vanderhoof. - * - * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax - * 00 01 02 03 04 - * 5: 85 c0 testl %eax,%eax - * 05 06 - * 7: 74 06 je f - * 07 08 - * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax) - * 09 0a 0b 0c 0d 0e - * f: e8 fc ff ff ff call __glapi_get_dispatch - * 0f 10 11 12 13 - * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax) - * 14 15 16 17 18 19 - */ - static const unsigned char temp[] = { - 0xa1, 0x00, 0x00, 0x00, 0x00, - 0x85, 0xc0, - 0x74, 0x06, - 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00, - 0xe8, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00 - }; - unsigned char *code = malloc(sizeof(temp)); - unsigned int next_insn; - if (code) { - memcpy(code, temp, sizeof(temp)); - - *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch; - *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4; - next_insn = (unsigned int)(code + 0x14); - *(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn; - *(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4; - } - return code; -#else - return NULL; -#endif -} - - - -/* - * Add a new extension function entrypoint. - * Return: GL_TRUE = success or GL_FALSE = failure - */ -GLboolean -_glapi_add_entrypoint(const char *funcName, GLuint offset) -{ - /* Make sure we don't try to add a new entrypoint after someone - * has already called _glapi_get_dispatch_table_size()! If that's - * happened the caller's information will now be out of date. - */ - assert(!GetSizeCalled); - - /* first check if the named function is already statically present */ - { - GLint index = get_static_proc_offset(funcName); - if (index >= 0) { - return (GLboolean) (index == offset); /* bad offset! */ - } - } - - { - /* make sure this offset/name pair is legal */ - const char *name = _glapi_get_proc_name(offset); - if (name && strcmp(name, funcName) != 0) - return GL_FALSE; /* bad name! */ - } - - { - /* be sure index and name match known data */ - GLuint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - /* function already registered with api */ - if (ExtEntryTable[i].Offset == offset) { - return GL_TRUE; /* offsets match */ - } - else { - return GL_FALSE; /* bad offset! */ - } - } - } - - /* make sure we have space */ - if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) { - return GL_FALSE; - } - else { - void *entrypoint = generate_entrypoint(offset); - if (!entrypoint) - return GL_FALSE; - - ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName); - ExtEntryTable[NumExtEntryPoints].Offset = offset; - ExtEntryTable[NumExtEntryPoints].Address = entrypoint; - NumExtEntryPoints++; - - if (offset > MaxDispatchOffset) - MaxDispatchOffset = offset; - - return GL_TRUE; /* success */ - } - } - - /* should never get here, but play it safe */ - return GL_FALSE; -} - - - -#if 0000 /* prototype code for dynamic extension slot allocation */ - -static int NextFreeOffset = 409; /*XXX*/ -#define MAX_DISPATCH_TABLE_SIZE 1000 - -/* - * Dynamically allocate a dispatch slot for an extension entrypoint - * and generate the assembly language dispatch stub. - * Return the dispatch offset for the function or -1 if no room or error. - */ -GLint -_glapi_add_entrypoint2(const char *funcName) -{ - int offset; - - /* first see if extension func is already known */ - offset = _glapi_get_proc_offset(funcName); - if (offset >= 0) - return offset; - - if (NumExtEntryPoints < MAX_EXTENSION_FUNCS - && NextFreeOffset < MAX_DISPATCH_TABLE_SIZE) { - void *entryPoint; - offset = NextFreeOffset; - entryPoint = generate_entrypoint(offset); - if (entryPoint) { - NextFreeOffset++; - ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName); - ExtEntryTable[NumExtEntryPoints].Offset = offset; - ExtEntryTable[NumExtEntryPoints].Address = entryPoint; - NumExtEntryPoints++; - return offset; - } - } - return -1; -} - -#endif - - - -/* - * Return offset of entrypoint for named function within dispatch table. - */ -GLint -_glapi_get_proc_offset(const char *funcName) -{ - /* search extension functions first */ - GLint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - return ExtEntryTable[i].Offset; - } - } - - /* search static functions */ - return get_static_proc_offset(funcName); -} - - - -/* - * Return entrypoint for named function. - */ -const GLvoid * -_glapi_get_proc_address(const char *funcName) -{ - /* search extension functions first */ - GLint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - return ExtEntryTable[i].Address; - } - } - - /* search static functions */ - return get_static_proc_address(funcName); -} - - - - -/* - * Return the name of the function at the given dispatch offset. - * This is only intended for debugging. - */ -const char * -_glapi_get_proc_name(GLuint offset) -{ - const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset); - GLuint i; - for (i = 0; i < n; i++) { - if (static_functions[i].Offset == offset) - return static_functions[i].Name; - } - - /* search added extension functions */ - for (i = 0; i < NumExtEntryPoints; i++) { - if (ExtEntryTable[i].Offset == offset) { - return ExtEntryTable[i].Name; - } - } - return NULL; -} - - - -/* - * Make sure there are no NULL pointers in the given dispatch table. - * Intented for debugging purposes. - */ -void -_glapi_check_table(const struct _glapi_table *table) -{ - const GLuint entries = _glapi_get_dispatch_table_size(); - const void **tab = (const void **) table; - GLuint i; - for (i = 1; i < entries; i++) { - assert(tab[i]); - } - -#ifdef DEBUG - /* Do some spot checks to be sure that the dispatch table - * slots are assigned correctly. - */ - { - GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); - char *BeginFunc = (char*) &table->Begin; - GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); - assert(BeginOffset == _gloffset_Begin); - assert(BeginOffset == offset); - } - { - GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); - char *viewportFunc = (char*) &table->Viewport; - GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); - assert(viewportOffset == _gloffset_Viewport); - assert(viewportOffset == offset); - } - { - GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); - char *VertexPointerFunc = (char*) &table->VertexPointer; - GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); - assert(VertexPointerOffset == _gloffset_VertexPointer); - assert(VertexPointerOffset == offset); - } - { - GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); - char *ResetMinMaxFunc = (char*) &table->ResetMinmax; - GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); - assert(ResetMinMaxOffset == _gloffset_ResetMinmax); - assert(ResetMinMaxOffset == offset); - } - { - GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); - char *blendColorFunc = (char*) &table->BlendColor; - GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); - assert(blendColorOffset == _gloffset_BlendColor); - assert(blendColorOffset == offset); - } - { - GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); - char *istextureFunc = (char*) &table->IsTextureEXT; - GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); - assert(istextureOffset == _gloffset_IsTextureEXT); - assert(istextureOffset == offset); - } -#endif -} - - /* * For each entry in static_functions[] which use this function * we should implement a dispatch function in glapitemp.h and @@ -582,6 +234,12 @@ static int NotImplemented(void) } +struct name_address_offset { + const char *Name; + GLvoid *Address; + GLuint Offset; +}; + static struct name_address_offset static_functions[] = { /* GL 1.1 */ @@ -1523,3 +1181,345 @@ static struct name_address_offset static_functions[] = { { NULL, NULL } /* end of list marker */ }; + + +/* + * Return dispatch table offset of the named static (built-in) function. + * Return -1 if function not found. + */ +static GLint +get_static_proc_offset(const char *funcName) +{ + GLuint i; + for (i = 0; static_functions[i].Name; i++) { + if (strcmp(static_functions[i].Name, funcName) == 0) { + return static_functions[i].Offset; + } + } + return -1; +} + + +/* + * Return dispatch function address the named static (built-in) function. + * Return NULL if function not found. + */ +static GLvoid * +get_static_proc_address(const char *funcName) +{ + GLint i = get_static_proc_offset(funcName); + if (i >= 0) + return static_functions[i].Address; + else + return NULL; +} + + + +/********************************************************************** + * Extension function management. + */ + + +#define MAX_EXTENSION_FUNCS 1000 + +static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS]; +static GLuint NumExtEntryPoints = 0; + + + +/* + * Generate a dispatch function (entrypoint) which jumps through + * the given slot number (offset) in the current dispatch table. + * We need assembly language in order to accomplish this. + */ +static void * +generate_entrypoint(GLuint functionOffset) +{ +#if defined(USE_X86_ASM) + /* + * This x86 code contributed by Josh Vanderhoof. + * + * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax + * 00 01 02 03 04 + * 5: 85 c0 testl %eax,%eax + * 05 06 + * 7: 74 06 je f + * 07 08 + * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax) + * 09 0a 0b 0c 0d 0e + * f: e8 fc ff ff ff call __glapi_get_dispatch + * 0f 10 11 12 13 + * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax) + * 14 15 16 17 18 19 + */ + static const unsigned char temp[] = { + 0xa1, 0x00, 0x00, 0x00, 0x00, + 0x85, 0xc0, + 0x74, 0x06, + 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00, + 0xe8, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00 + }; + unsigned char *code = malloc(sizeof(temp)); + unsigned int next_insn; + if (code) { + memcpy(code, temp, sizeof(temp)); + + *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch; + *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4; + next_insn = (unsigned int)(code + 0x14); + *(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn; + *(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4; + } + return code; +#else + return NULL; +#endif +} + + + +/* + * Add a new extension function entrypoint. + * Return: GL_TRUE = success or GL_FALSE = failure + */ +GLboolean +_glapi_add_entrypoint(const char *funcName, GLuint offset) +{ + /* Make sure we don't try to add a new entrypoint after someone + * has already called _glapi_get_dispatch_table_size()! If that's + * happened the caller's information will now be out of date. + */ + assert(!GetSizeCalled); + + /* first check if the named function is already statically present */ + { + GLint index = get_static_proc_offset(funcName); + if (index >= 0) { + return (GLboolean) (index == offset); /* bad offset! */ + } + } + + { + /* make sure this offset/name pair is legal */ + const char *name = _glapi_get_proc_name(offset); + if (name && strcmp(name, funcName) != 0) + return GL_FALSE; /* bad name! */ + } + + { + /* be sure index and name match known data */ + GLuint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { + /* function already registered with api */ + if (ExtEntryTable[i].Offset == offset) { + return GL_TRUE; /* offsets match */ + } + else { + return GL_FALSE; /* bad offset! */ + } + } + } + + /* make sure we have space */ + if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) { + return GL_FALSE; + } + else { + void *entrypoint = generate_entrypoint(offset); + if (!entrypoint) + return GL_FALSE; + + ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName); + ExtEntryTable[NumExtEntryPoints].Offset = offset; + ExtEntryTable[NumExtEntryPoints].Address = entrypoint; + NumExtEntryPoints++; + + if (offset > MaxDispatchOffset) + MaxDispatchOffset = offset; + + return GL_TRUE; /* success */ + } + } + + /* should never get here, but play it safe */ + return GL_FALSE; +} + + + +#if 0000 /* prototype code for dynamic extension slot allocation */ + +static int NextFreeOffset = 409; /*XXX*/ +#define MAX_DISPATCH_TABLE_SIZE 1000 + +/* + * Dynamically allocate a dispatch slot for an extension entrypoint + * and generate the assembly language dispatch stub. + * Return the dispatch offset for the function or -1 if no room or error. + */ +GLint +_glapi_add_entrypoint2(const char *funcName) +{ + int offset; + + /* first see if extension func is already known */ + offset = _glapi_get_proc_offset(funcName); + if (offset >= 0) + return offset; + + if (NumExtEntryPoints < MAX_EXTENSION_FUNCS + && NextFreeOffset < MAX_DISPATCH_TABLE_SIZE) { + void *entryPoint; + offset = NextFreeOffset; + entryPoint = generate_entrypoint(offset); + if (entryPoint) { + NextFreeOffset++; + ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName); + ExtEntryTable[NumExtEntryPoints].Offset = offset; + ExtEntryTable[NumExtEntryPoints].Address = entryPoint; + NumExtEntryPoints++; + return offset; + } + } + return -1; +} + +#endif + + + +/* + * Return offset of entrypoint for named function within dispatch table. + */ +GLint +_glapi_get_proc_offset(const char *funcName) +{ + /* search extension functions first */ + GLint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { + return ExtEntryTable[i].Offset; + } + } + + /* search static functions */ + return get_static_proc_offset(funcName); +} + + + +/* + * Return entrypoint for named function. + */ +const GLvoid * +_glapi_get_proc_address(const char *funcName) +{ + /* search extension functions first */ + GLint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { + return ExtEntryTable[i].Address; + } + } + + /* search static functions */ + return get_static_proc_address(funcName); +} + + + + +/* + * Return the name of the function at the given dispatch offset. + * This is only intended for debugging. + */ +const char * +_glapi_get_proc_name(GLuint offset) +{ + const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset); + GLuint i; + for (i = 0; i < n; i++) { + if (static_functions[i].Offset == offset) + return static_functions[i].Name; + } + + /* search added extension functions */ + for (i = 0; i < NumExtEntryPoints; i++) { + if (ExtEntryTable[i].Offset == offset) { + return ExtEntryTable[i].Name; + } + } + return NULL; +} + + + +/* + * Make sure there are no NULL pointers in the given dispatch table. + * Intented for debugging purposes. + */ +void +_glapi_check_table(const struct _glapi_table *table) +{ + const GLuint entries = _glapi_get_dispatch_table_size(); + const void **tab = (const void **) table; + GLuint i; + for (i = 1; i < entries; i++) { + assert(tab[i]); + } + +#ifdef DEBUG + /* Do some spot checks to be sure that the dispatch table + * slots are assigned correctly. + */ + { + GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); + char *BeginFunc = (char*) &table->Begin; + GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); + assert(BeginOffset == _gloffset_Begin); + assert(BeginOffset == offset); + } + { + GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); + char *viewportFunc = (char*) &table->Viewport; + GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); + assert(viewportOffset == _gloffset_Viewport); + assert(viewportOffset == offset); + } + { + GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); + char *VertexPointerFunc = (char*) &table->VertexPointer; + GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); + assert(VertexPointerOffset == _gloffset_VertexPointer); + assert(VertexPointerOffset == offset); + } + { + GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); + char *ResetMinMaxFunc = (char*) &table->ResetMinmax; + GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); + assert(ResetMinMaxOffset == _gloffset_ResetMinmax); + assert(ResetMinMaxOffset == offset); + } + { + GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); + char *blendColorFunc = (char*) &table->BlendColor; + GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); + assert(blendColorOffset == _gloffset_BlendColor); + assert(blendColorOffset == offset); + } + { + GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); + char *istextureFunc = (char*) &table->IsTextureEXT; + GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); + assert(istextureOffset == _gloffset_IsTextureEXT); + assert(istextureOffset == offset); + } +#endif +} + + + + diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 9621da5b5d3..ee32c92206a 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -1,4 +1,4 @@ -/* $Id: accum.c,v 1.16 2000/02/02 21:53:11 brianp Exp $ */ +/* $Id: accum.c,v 1.17 2000/03/19 01:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -351,7 +351,7 @@ _mesa_Accum( GLenum op, GLfloat value ) static GLchan multTable[32768]; static GLfloat prevMult = 0.0; GLuint j; - const GLint max = 256 / mult; + const GLint max = (GLint) (256 / mult); if (mult != prevMult) { assert(max <= 32768); for (j = 0; j < max; j++) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 95d2bc4ebfc..617a274e03e 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.19 2000/03/10 22:12:22 brianp Exp $ */ +/* $Id: attrib.c,v 1.20 2000/03/19 01:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -699,7 +699,7 @@ _mesa_PopAttrib(void) case GL_POLYGON_STIPPLE_BIT: MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) ); if (ctx->Driver.PolygonStipple) - ctx->Driver.PolygonStipple( ctx, attr->data ); + ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data ); break; case GL_SCISSOR_BIT: MEMCPY( &ctx->Scissor, attr->data, diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f770326c39f..748607b8f5e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.47 2000/03/17 15:31:52 brianp Exp $ */ +/* $Id: context.c,v 1.48 2000/03/19 01:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -287,6 +287,7 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, * bad value now (a 1-bit depth buffer!?!). */ assert(depthBits == 0 || depthBits > 1); +printf("depthbits %d\n", depthBits); if (depthBits < 0 || depthBits > 32) { return NULL; @@ -1394,8 +1395,8 @@ GLboolean gl_initialize_context_data( GLcontext *ctx, } /* setup API dispatch tables */ - ctx->Exec = CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *)); - ctx->Save = CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *)); + ctx->Exec = (struct _glapi_table *) CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *)); + ctx->Save = (struct _glapi_table *) CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *)); if (!ctx->Exec || !ctx->Save) { free_shared_state(ctx, ctx->Shared); FREE(ctx->VB); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index b5dfa4d9e18..b9cc69bc69d 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -1,4 +1,4 @@ -/* $Id: context.h,v 1.13 2000/02/02 19:16:46 brianp Exp $ */ +/* $Id: context.h,v 1.14 2000/03/19 01:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -142,7 +142,7 @@ do { \ extern struct immediate *_mesa_CurrentInput; -#define GET_CURRENT_CONTEXT(C) GLcontext *C = _glapi_Context +#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context #define GET_IMMEDIATE struct immediate *IM = _mesa_CurrentInput diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 57937dd0930..2f9697616e0 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -1,4 +1,4 @@ -/* $Id: depth.c,v 1.14 2000/03/17 15:31:52 brianp Exp $ */ +/* $Id: depth.c,v 1.15 2000/03/19 01:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1570,7 +1570,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) 2 * ctx->DrawBuffer->Width * ctx->DrawBuffer->Height); } else { - GLushort *d = ctx->DrawBuffer->DepthBuffer; + GLushort *d = (GLushort *) ctx->DrawBuffer->DepthBuffer; GLint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; while (n >= 16) { d[0] = clearValue; d[1] = clearValue; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 2a317c7ba78..995e413e9c5 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.34 2000/03/03 17:47:39 brianp Exp $ */ +/* $Id: dlist.c,v 1.35 2000/03/19 01:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -3391,7 +3391,7 @@ static void execute_list( GLcontext *ctx, GLuint list ) struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = _mesa_native_packing; (*ctx->Exec->Bitmap)( (GLsizei) n[1].i, (GLsizei) n[2].i, - n[3].f, n[4].f, n[5].f, n[6].f, n[7].data ); + n[3].f, n[4].f, n[5].f, n[6].f, (const GLubyte *) n[7].data ); ctx->Unpack = save; /* restore */ } break; diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 6c7e66dd64b..b1f64fb3fdf 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.19 2000/03/13 18:31:51 brianp Exp $ */ +/* $Id: image.c,v 1.20 2000/03/19 01:10:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -497,7 +497,7 @@ void _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], const struct gl_pixelstore_attrib *unpacking ) { - GLubyte *ptrn = _mesa_unpack_bitmap( 32, 32, pattern, unpacking ); + GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap( 32, 32, pattern, unpacking ); if (ptrn) { /* Convert pattern from GLubytes to GLuints and handle big/little * endian differences @@ -1518,12 +1518,12 @@ extract_uint_indexes(GLuint n, GLuint indexes[], for (i = 0; i < n; i++) { GLfloat value = s[i]; SWAP4BYTE(value); - indexes[i] = value; + indexes[i] = (GLuint) value; } } else { for (i = 0; i < n; i++) - indexes[i] = s[i]; + indexes[i] = (GLuint) s[i]; } } break; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 035e88db0b5..a38d0c5a6df 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.18 2000/03/01 23:28:20 brianp Exp $ */ +/* $Id: teximage.c,v 1.19 2000/03/19 01:10:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -446,9 +446,9 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, /* This will cover the common GL_RGB, GL_RGBA, GL_ALPHA, * GL_LUMINANCE_ALPHA, etc. texture formats. */ - const GLubyte *src = gl_pixel_addr_in_image(unpacking, + const GLubyte *src = (const GLubyte *) gl_pixel_addr_in_image(unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0); - const GLubyte *src1 = gl_pixel_addr_in_image(unpacking, + const GLubyte *src1 = (const GLubyte *) gl_pixel_addr_in_image(unpacking, pixels, width, height, srcFormat, srcType, 0, 1, 0); const GLint srcStride = src1 - src; GLubyte *dst = texImage->Data; @@ -468,9 +468,9 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, } else if (srcFormat == GL_RGBA && internalFormat == GL_RGB) { /* commonly used by Quake */ - const GLubyte *src = gl_pixel_addr_in_image(unpacking, + const GLubyte *src = (const GLubyte *) gl_pixel_addr_in_image(unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0); - const GLubyte *src1 = gl_pixel_addr_in_image(unpacking, + const GLubyte *src1 = (const GLubyte *) gl_pixel_addr_in_image(unpacking, pixels, width, height, srcFormat, srcType, 0, 1, 0); const GLint srcStride = src1 - src; GLubyte *dst = texImage->Data; @@ -1316,7 +1316,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, assert(dest); if (texImage->Format == GL_RGBA) { const GLubyte *src = texImage->Data + row * width * 4 * sizeof(GLubyte); - gl_pack_rgba_span( ctx, width, (void *) src, format, type, dest, + gl_pack_rgba_span( ctx, width, (CONST GLubyte (*)[4]) src, + format, type, dest, &ctx->Pack, GL_TRUE ); } else { @@ -1633,7 +1634,7 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, GLint stride, i; GLubyte *image, *dst; - image = MALLOC(width * height * 4 * sizeof(GLubyte)); + image = (GLubyte *) MALLOC(width * height * 4 * sizeof(GLubyte)); if (!image) return NULL;