From 959f802dabd4f4347dc0ea925ae687abb6938588 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 19 Mar 2000 01:10:11 +0000 Subject: fixed compiler warnings on BeOS R4 --- src/mesa/glapi/glapi.c | 1012 +++++++++++++++++++++++----------------------- src/mesa/main/accum.c | 4 +- src/mesa/main/attrib.c | 4 +- src/mesa/main/context.c | 7 +- src/mesa/main/context.h | 4 +- src/mesa/main/depth.c | 4 +- src/mesa/main/dlist.c | 4 +- src/mesa/main/image.c | 8 +- src/mesa/main/teximage.c | 15 +- 9 files changed, 532 insertions(+), 530 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 1c16366509..11cc56d559 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 */ @@ -1325,201 +983,543 @@ static struct name_address_offset static_functions[] = { { "glImageTransformParameteriHP", (GLvoid *) NAME(glImageTransformParameteriHP), _gloffset_ImageTransformParameteriHP }, { "glImageTransformParameterivHP", (GLvoid *) NAME(glImageTransformParameterivHP), _gloffset_ImageTransformParameterivHP }, #undef NAME -#endif +#endif + + /* 74. GL_EXT_color_subtable */ +#ifdef GL_EXT_color_subtable +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glColorSubTableEXT", (GLvoid *) NAME(glColorSubTableEXT), _gloffset_ColorSubTable }, + { "glCopyColorSubTableEXT", (GLvoid *) NAME(glCopyColorSubTableEXT), _gloffset_CopyColorSubTable }, +#undef NAME + + /* 77. GL_PGI_misc_hints */ +#ifdef GL_PGI_misc_hints +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glHintPGI", (GLvoid *) NAME(glHintPGI), _gloffset_HintPGI }, +#undef NAME + + /* 78. GL_EXT_paletted_texture */ +#ifdef GL_EXT_paletted_texture +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glColorTableEXT", (GLvoid *) NAME(glColorTableEXT), _gloffset_ColorTable }, + { "glGetColorTableEXT", (GLvoid *) NAME(glGetColorTableEXT), _gloffset_GetColorTable }, + { "glGetColorTableParameterfvEXT", (GLvoid *) NAME(glGetColorTableParameterfvEXT), _gloffset_GetColorTableParameterfv }, + { "glGetColorTableParameterivEXT", (GLvoid *) NAME(glGetColorTableParameterivEXT), _gloffset_GetColorTableParameteriv }, +#undef NAME + + /* 80. GL_SGIX_list_priority */ +#ifdef GL_SGIX_list_priority +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glGetListParameterfvSGIX", (GLvoid *) NAME(glGetListParameterfvSGIX), _gloffset_GetListParameterfvSGIX }, + { "glGetListParameterivSGIX", (GLvoid *) NAME(glGetListParameterivSGIX), _gloffset_GetListParameterivSGIX }, + { "glListParameterfSGIX", (GLvoid *) NAME(glListParameterfSGIX), _gloffset_ListParameterfSGIX }, + { "glListParameterfvSGIX", (GLvoid *) NAME(glListParameterfvSGIX), _gloffset_ListParameterfvSGIX }, + { "glListParameteriSGIX", (GLvoid *) NAME(glListParameteriSGIX), _gloffset_ListParameteriSGIX }, + { "glListParameterivSGIX", (GLvoid *) NAME(glListParameterivSGIX), _gloffset_ListParameterivSGIX }, +#undef NAME + + /* 94. GL_EXT_index_material */ +#ifdef GL_EXT_index_material +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glIndexMaterialEXT", (GLvoid *) NAME(glIndexMaterialEXT), _gloffset_IndexMaterialEXT }, +#undef NAME + + /* 95. GL_EXT_index_func */ +#ifdef GL_EXT_index_func +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glIndexFuncEXT", (GLvoid *) NAME(glIndexFuncEXT), _gloffset_IndexFuncEXT }, +#undef NAME + + /* 97. GL_EXT_compiled_vertex_array */ +#ifdef GL_EXT_compiled_vertex_array +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glLockArraysEXT", (GLvoid *) NAME(glLockArraysEXT), _gloffset_LockArraysEXT }, + { "glUnlockArraysEXT", (GLvoid *) NAME(glUnlockArraysEXT), _gloffset_UnlockArraysEXT }, +#undef NAME + + /* 98. GL_EXT_cull_vertex */ +#ifdef GL_EXT_cull_vertex +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glCullParameterfvEXT", (GLvoid *) NAME(glCullParameterfvEXT), _gloffset_CullParameterfvEXT }, + { "glCullParameterdvEXT", (GLvoid *) NAME(glCullParameterdvEXT), _gloffset_CullParameterdvEXT }, +#undef NAME + + /* 102. GL_SGIX_fragment_lighting */ +#ifdef GL_SGIX_fragment_lighting +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glFragmentColorMaterialSGIX", (GLvoid *) NAME(glFragmentColorMaterialSGIX), _gloffset_FragmentColorMaterialSGIX }, + { "glFragmentLightfSGIX", (GLvoid *) NAME(glFragmentLightfSGIX), _gloffset_FragmentLightfSGIX }, + { "glFragmentLightfvSGIX", (GLvoid *) NAME(glFragmentLightfvSGIX), _gloffset_FragmentLightfvSGIX }, + { "glFragmentLightiSGIX", (GLvoid *) NAME(glFragmentLightiSGIX), _gloffset_FragmentLightiSGIX }, + { "glFragmentLightivSGIX", (GLvoid *) NAME(glFragmentLightivSGIX), _gloffset_FragmentLightivSGIX }, + { "glFragmentLightModelfSGIX", (GLvoid *) NAME(glFragmentLightModelfSGIX), _gloffset_FragmentLightModelfSGIX }, + { "glFragmentLightModelfvSGIX", (GLvoid *) NAME(glFragmentLightModelfvSGIX), _gloffset_FragmentLightModelfvSGIX }, + { "glFragmentLightModeliSGIX", (GLvoid *) NAME(glFragmentLightModeliSGIX), _gloffset_FragmentLightModeliSGIX }, + { "glFragmentLightModelivSGIX", (GLvoid *) NAME(glFragmentLightModelivSGIX), _gloffset_FragmentLightModelivSGIX }, + { "glFragmentMaterialfSGIX", (GLvoid *) NAME(glFragmentMaterialfSGIX), _gloffset_FragmentMaterialfSGIX }, + { "glFragmentMaterialfvSGIX", (GLvoid *) NAME(glFragmentMaterialfvSGIX), _gloffset_FragmentMaterialfvSGIX }, + { "glFragmentMaterialiSGIX", (GLvoid *) NAME(glFragmentMaterialiSGIX), _gloffset_FragmentMaterialiSGIX }, + { "glFragmentMaterialivSGIX", (GLvoid *) NAME(glFragmentMaterialivSGIX), _gloffset_FragmentMaterialivSGIX }, + { "glGetFragmentLightfvSGIX", (GLvoid *) NAME(glGetFragmentLightfvSGIX), _gloffset_GetFragmentLightfvSGIX }, + { "glGetFragmentLightivSGIX", (GLvoid *) NAME(glGetFragmentLightivSGIX), _gloffset_GetFragmentLightivSGIX }, + { "glGetFragmentMaterialfvSGIX", (GLvoid *) NAME(glGetFragmentMaterialfvSGIX), _gloffset_GetFragmentMaterialfvSGIX }, + { "glGetFragmentMaterialivSGIX", (GLvoid *) NAME(glGetFragmentMaterialivSGIX), _gloffset_GetFragmentMaterialivSGIX }, + { "glLightEnviSGIX", (GLvoid *) NAME(glLightEnviSGIX), _gloffset_LightEnviSGIX }, +#undef NAME + + /* 149. GL_EXT_fog_coord */ +#ifdef GL_EXT_fog_coord +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glFogCoordfEXT", (GLvoid *) NAME(glFogCoordfEXT), _gloffset_FogCoordfEXT }, + { "glFogCoordfvEXT", (GLvoid *) NAME(glFogCoordfvEXT), _gloffset_FogCoordfvEXT }, + { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, + { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, + { "glFogCoordPointerEXT", (GLvoid *) NAME(glFogCoordPointerEXT), _gloffset_FogCoordPointerEXT }, +#undef NAME + + /* 173. GL_EXT/INGR_blend_func_separate */ +#ifdef GL_EXT_blend_func_separate +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glBlendFuncSeparateEXT", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, + { "glBlendFuncSeparateINGR", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, +#undef NAME + + /* 188. GL_EXT_vertex_weighting */ +#ifdef GL_EXT_vertex_weighting +#define NAME(X) X +#else +#define NAME(X) NotImplemented +#endif + { "glVertexWeightfEXT", (GLvoid *) NAME(glVertexWeightfEXT), _gloffset_VertexWeightfEXT }, + { "glVertexWeightfvEXT", (GLvoid *) NAME(glVertexWeightfvEXT), _gloffset_VertexWeightfvEXT }, + { "glVertexWeightPointerEXT", (GLvoid *) NAME(glVertexWeightPointerEXT), _gloffset_VertexWeightPointerEXT }, +#undef NAME - /* 74. GL_EXT_color_subtable */ -#ifdef GL_EXT_color_subtable + /* 190. GL_NV_vertex_array_range */ +#ifdef GL_NV_vertex_array_range #define NAME(X) X #else #define NAME(X) NotImplemented #endif - { "glColorSubTableEXT", (GLvoid *) NAME(glColorSubTableEXT), _gloffset_ColorSubTable }, - { "glCopyColorSubTableEXT", (GLvoid *) NAME(glCopyColorSubTableEXT), _gloffset_CopyColorSubTable }, + { "glFlushVertexArrayRangeNV", (GLvoid *) NAME(glFlushVertexArrayRangeNV), _gloffset_FlushVertexArrayRangeNV }, + { "glVertexArrayRangeNV", (GLvoid *) NAME(glVertexArrayRangeNV), _gloffset_VertexArrayRangeNV }, #undef NAME - /* 77. GL_PGI_misc_hints */ -#ifdef GL_PGI_misc_hints + /* 191. GL_NV_register_combiners */ +#ifdef GL_NV_register_combiners #define NAME(X) X #else #define NAME(X) NotImplemented #endif - { "glHintPGI", (GLvoid *) NAME(glHintPGI), _gloffset_HintPGI }, + { "glCombinerParameterfvNV", (GLvoid *) NAME(glCombinerParameterfvNV), _gloffset_CombinerParameterfvNV }, + { "glCombinerParameterfNV", (GLvoid *) NAME(glCombinerParameterfNV), _gloffset_CombinerParameterfNV }, + { "glCombinerParameterivNV", (GLvoid *) NAME(glCombinerParameterivNV), _gloffset_CombinerParameterivNV }, + { "glCombinerParameteriNV", (GLvoid *) NAME(glCombinerParameteriNV), _gloffset_CombinerParameteriNV }, + { "glCombinerInputNV", (GLvoid *) NAME(glCombinerInputNV), _gloffset_CombinerInputNV }, + { "glCombinerOutputNV", (GLvoid *) NAME(glCombinerOutputNV), _gloffset_CombinerOutputNV }, + { "glFinalCombinerInputNV", (GLvoid *) NAME(glFinalCombinerInputNV), _gloffset_FinalCombinerInputNV }, + { "glGetCombinerInputParameterfvNV", (GLvoid *) NAME(glGetCombinerInputParameterfvNV), _gloffset_GetCombinerInputParameterfvNV }, + { "glGetCombinerInputParameterivNV", (GLvoid *) NAME(glGetCombinerInputParameterivNV), _gloffset_GetCombinerInputParameterivNV }, + { "glGetCombinerOutputParameterfvNV", (GLvoid *) NAME(glGetCombinerOutputParameterfvNV), _gloffset_GetCombinerOutputParameterfvNV }, + { "glGetCombinerOutputParameterivNV", (GLvoid *) NAME(glGetCombinerOutputParameterivNV), _gloffset_GetCombinerOutputParameterivNV }, + { "glGetFinalCombinerInputParameterfvNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterfvNV), _gloffset_GetFinalCombinerInputParameterfvNV }, + { "glGetFinalCombinerInputParameterivNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterivNV), _gloffset_GetFinalCombinerInputParameterivNV }, #undef NAME - /* 78. GL_EXT_paletted_texture */ -#ifdef GL_EXT_paletted_texture + /* 196. GL_MESA_resize_buffers */ +#ifdef MESA_resize_buffers #define NAME(X) X #else #define NAME(X) NotImplemented #endif - { "glColorTableEXT", (GLvoid *) NAME(glColorTableEXT), _gloffset_ColorTable }, - { "glGetColorTableEXT", (GLvoid *) NAME(glGetColorTableEXT), _gloffset_GetColorTable }, - { "glGetColorTableParameterfvEXT", (GLvoid *) NAME(glGetColorTableParameterfvEXT), _gloffset_GetColorTableParameterfv }, - { "glGetColorTableParameterivEXT", (GLvoid *) NAME(glGetColorTableParameterivEXT), _gloffset_GetColorTableParameteriv }, + { "glResizeBuffersMESA", (GLvoid *) NAME(glResizeBuffersMESA), _gloffset_ResizeBuffersMESA }, #undef NAME - /* 80. GL_SGIX_list_priority */ -#ifdef GL_SGIX_list_priority + /* 197. GL_MESA_window_pos */ +#ifdef MESA_window_pos #define NAME(X) X #else #define NAME(X) NotImplemented #endif - { "glGetListParameterfvSGIX", (GLvoid *) NAME(glGetListParameterfvSGIX), _gloffset_GetListParameterfvSGIX }, - { "glGetListParameterivSGIX", (GLvoid *) NAME(glGetListParameterivSGIX), _gloffset_GetListParameterivSGIX }, - { "glListParameterfSGIX", (GLvoid *) NAME(glListParameterfSGIX), _gloffset_ListParameterfSGIX }, - { "glListParameterfvSGIX", (GLvoid *) NAME(glListParameterfvSGIX), _gloffset_ListParameterfvSGIX }, - { "glListParameteriSGIX", (GLvoid *) NAME(glListParameteriSGIX), _gloffset_ListParameteriSGIX }, - { "glListParameterivSGIX", (GLvoid *) NAME(glListParameterivSGIX), _gloffset_ListParameterivSGIX }, + { "glWindowPos4fMESA", (GLvoid *) NAME(glWindowPos4fMESA), _gloffset_WindowPos4fMESA }, #undef NAME - /* 94. GL_EXT_index_material */ -#ifdef GL_EXT_index_material -#define NAME(X) X -#else -#define NAME(X) NotImplemented + + { 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 - { "glIndexMaterialEXT", (GLvoid *) NAME(glIndexMaterialEXT), _gloffset_IndexMaterialEXT }, -#undef NAME - /* 95. GL_EXT_index_func */ -#ifdef GL_EXT_index_func -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glIndexFuncEXT", (GLvoid *) NAME(glIndexFuncEXT), _gloffset_IndexFuncEXT }, -#undef NAME - /* 97. GL_EXT_compiled_vertex_array */ -#ifdef GL_EXT_compiled_vertex_array -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glLockArraysEXT", (GLvoid *) NAME(glLockArraysEXT), _gloffset_LockArraysEXT }, - { "glUnlockArraysEXT", (GLvoid *) NAME(glUnlockArraysEXT), _gloffset_UnlockArraysEXT }, -#undef NAME - /* 98. GL_EXT_cull_vertex */ -#ifdef GL_EXT_cull_vertex -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glCullParameterfvEXT", (GLvoid *) NAME(glCullParameterfvEXT), _gloffset_CullParameterfvEXT }, - { "glCullParameterdvEXT", (GLvoid *) NAME(glCullParameterdvEXT), _gloffset_CullParameterdvEXT }, -#undef NAME +/* + * 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; + } + } - /* 102. GL_SGIX_fragment_lighting */ -#ifdef GL_SGIX_fragment_lighting -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glFragmentColorMaterialSGIX", (GLvoid *) NAME(glFragmentColorMaterialSGIX), _gloffset_FragmentColorMaterialSGIX }, - { "glFragmentLightfSGIX", (GLvoid *) NAME(glFragmentLightfSGIX), _gloffset_FragmentLightfSGIX }, - { "glFragmentLightfvSGIX", (GLvoid *) NAME(glFragmentLightfvSGIX), _gloffset_FragmentLightfvSGIX }, - { "glFragmentLightiSGIX", (GLvoid *) NAME(glFragmentLightiSGIX), _gloffset_FragmentLightiSGIX }, - { "glFragmentLightivSGIX", (GLvoid *) NAME(glFragmentLightivSGIX), _gloffset_FragmentLightivSGIX }, - { "glFragmentLightModelfSGIX", (GLvoid *) NAME(glFragmentLightModelfSGIX), _gloffset_FragmentLightModelfSGIX }, - { "glFragmentLightModelfvSGIX", (GLvoid *) NAME(glFragmentLightModelfvSGIX), _gloffset_FragmentLightModelfvSGIX }, - { "glFragmentLightModeliSGIX", (GLvoid *) NAME(glFragmentLightModeliSGIX), _gloffset_FragmentLightModeliSGIX }, - { "glFragmentLightModelivSGIX", (GLvoid *) NAME(glFragmentLightModelivSGIX), _gloffset_FragmentLightModelivSGIX }, - { "glFragmentMaterialfSGIX", (GLvoid *) NAME(glFragmentMaterialfSGIX), _gloffset_FragmentMaterialfSGIX }, - { "glFragmentMaterialfvSGIX", (GLvoid *) NAME(glFragmentMaterialfvSGIX), _gloffset_FragmentMaterialfvSGIX }, - { "glFragmentMaterialiSGIX", (GLvoid *) NAME(glFragmentMaterialiSGIX), _gloffset_FragmentMaterialiSGIX }, - { "glFragmentMaterialivSGIX", (GLvoid *) NAME(glFragmentMaterialivSGIX), _gloffset_FragmentMaterialivSGIX }, - { "glGetFragmentLightfvSGIX", (GLvoid *) NAME(glGetFragmentLightfvSGIX), _gloffset_GetFragmentLightfvSGIX }, - { "glGetFragmentLightivSGIX", (GLvoid *) NAME(glGetFragmentLightivSGIX), _gloffset_GetFragmentLightivSGIX }, - { "glGetFragmentMaterialfvSGIX", (GLvoid *) NAME(glGetFragmentMaterialfvSGIX), _gloffset_GetFragmentMaterialfvSGIX }, - { "glGetFragmentMaterialivSGIX", (GLvoid *) NAME(glGetFragmentMaterialivSGIX), _gloffset_GetFragmentMaterialivSGIX }, - { "glLightEnviSGIX", (GLvoid *) NAME(glLightEnviSGIX), _gloffset_LightEnviSGIX }, -#undef NAME + /* search static functions */ + return get_static_proc_offset(funcName); +} - /* 149. GL_EXT_fog_coord */ -#ifdef GL_EXT_fog_coord -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glFogCoordfEXT", (GLvoid *) NAME(glFogCoordfEXT), _gloffset_FogCoordfEXT }, - { "glFogCoordfvEXT", (GLvoid *) NAME(glFogCoordfvEXT), _gloffset_FogCoordfvEXT }, - { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, - { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, - { "glFogCoordPointerEXT", (GLvoid *) NAME(glFogCoordPointerEXT), _gloffset_FogCoordPointerEXT }, -#undef NAME - /* 173. GL_EXT/INGR_blend_func_separate */ -#ifdef GL_EXT_blend_func_separate -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glBlendFuncSeparateEXT", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, - { "glBlendFuncSeparateINGR", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, -#undef NAME - /* 188. GL_EXT_vertex_weighting */ -#ifdef GL_EXT_vertex_weighting -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glVertexWeightfEXT", (GLvoid *) NAME(glVertexWeightfEXT), _gloffset_VertexWeightfEXT }, - { "glVertexWeightfvEXT", (GLvoid *) NAME(glVertexWeightfvEXT), _gloffset_VertexWeightfvEXT }, - { "glVertexWeightPointerEXT", (GLvoid *) NAME(glVertexWeightPointerEXT), _gloffset_VertexWeightPointerEXT }, -#undef NAME +/* + * 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; + } + } - /* 190. GL_NV_vertex_array_range */ -#ifdef GL_NV_vertex_array_range -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glFlushVertexArrayRangeNV", (GLvoid *) NAME(glFlushVertexArrayRangeNV), _gloffset_FlushVertexArrayRangeNV }, - { "glVertexArrayRangeNV", (GLvoid *) NAME(glVertexArrayRangeNV), _gloffset_VertexArrayRangeNV }, -#undef NAME + /* search static functions */ + return get_static_proc_address(funcName); +} - /* 191. GL_NV_register_combiners */ -#ifdef GL_NV_register_combiners -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glCombinerParameterfvNV", (GLvoid *) NAME(glCombinerParameterfvNV), _gloffset_CombinerParameterfvNV }, - { "glCombinerParameterfNV", (GLvoid *) NAME(glCombinerParameterfNV), _gloffset_CombinerParameterfNV }, - { "glCombinerParameterivNV", (GLvoid *) NAME(glCombinerParameterivNV), _gloffset_CombinerParameterivNV }, - { "glCombinerParameteriNV", (GLvoid *) NAME(glCombinerParameteriNV), _gloffset_CombinerParameteriNV }, - { "glCombinerInputNV", (GLvoid *) NAME(glCombinerInputNV), _gloffset_CombinerInputNV }, - { "glCombinerOutputNV", (GLvoid *) NAME(glCombinerOutputNV), _gloffset_CombinerOutputNV }, - { "glFinalCombinerInputNV", (GLvoid *) NAME(glFinalCombinerInputNV), _gloffset_FinalCombinerInputNV }, - { "glGetCombinerInputParameterfvNV", (GLvoid *) NAME(glGetCombinerInputParameterfvNV), _gloffset_GetCombinerInputParameterfvNV }, - { "glGetCombinerInputParameterivNV", (GLvoid *) NAME(glGetCombinerInputParameterivNV), _gloffset_GetCombinerInputParameterivNV }, - { "glGetCombinerOutputParameterfvNV", (GLvoid *) NAME(glGetCombinerOutputParameterfvNV), _gloffset_GetCombinerOutputParameterfvNV }, - { "glGetCombinerOutputParameterivNV", (GLvoid *) NAME(glGetCombinerOutputParameterivNV), _gloffset_GetCombinerOutputParameterivNV }, - { "glGetFinalCombinerInputParameterfvNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterfvNV), _gloffset_GetFinalCombinerInputParameterfvNV }, - { "glGetFinalCombinerInputParameterivNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterivNV), _gloffset_GetFinalCombinerInputParameterivNV }, -#undef NAME - /* 196. GL_MESA_resize_buffers */ -#ifdef MESA_resize_buffers -#define NAME(X) X -#else -#define NAME(X) NotImplemented -#endif - { "glResizeBuffersMESA", (GLvoid *) NAME(glResizeBuffersMESA), _gloffset_ResizeBuffersMESA }, -#undef NAME - /* 197. GL_MESA_window_pos */ -#ifdef MESA_window_pos -#define NAME(X) X -#else -#define NAME(X) NotImplemented + +/* + * 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 - { "glWindowPos4fMESA", (GLvoid *) NAME(glWindowPos4fMESA), _gloffset_WindowPos4fMESA }, -#undef NAME +} + - { NULL, NULL } /* end of list marker */ -}; diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 9621da5b5d..ee32c92206 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 95d2bc4ebf..617a274e03 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 f770326c39..748607b8f5 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 b5dfa4d9e1..b9cc69bc69 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 57937dd093..2f9697616e 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 2a317c7ba7..995e413e9c 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 6c7e66dd64..b1f64fb3fd 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 035e88db0b..a38d0c5a6d 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; -- cgit v1.2.3