| @@ -1,4 +1,4 @@ | |||
| /* $Id: context.c,v 1.33 2000/01/18 17:36:16 brianp Exp $ */ | |||
| /* $Id: context.c,v 1.34 2000/01/24 16:19:55 brianp Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -472,9 +472,9 @@ static struct gl_shared_state *alloc_shared_state( void ) | |||
| if (!ss) | |||
| return NULL; | |||
| ss->DisplayList = NewHashTable(); | |||
| ss->DisplayList = _mesa_NewHashTable(); | |||
| ss->TexObjects = NewHashTable(); | |||
| ss->TexObjects = _mesa_NewHashTable(); | |||
| /* Default Texture objects */ | |||
| outOfMemory = GL_FALSE; | |||
| @@ -490,9 +490,9 @@ static struct gl_shared_state *alloc_shared_state( void ) | |||
| if (!ss->DisplayList || !ss->TexObjects || outOfMemory) { | |||
| /* Ran out of memory at some point. Free everything and return NULL */ | |||
| if (ss->DisplayList) | |||
| DeleteHashTable(ss->DisplayList); | |||
| _mesa_DeleteHashTable(ss->DisplayList); | |||
| if (ss->TexObjects) | |||
| DeleteHashTable(ss->TexObjects); | |||
| _mesa_DeleteHashTable(ss->TexObjects); | |||
| if (ss->DefaultD[1]) | |||
| gl_free_texture_object(ss, ss->DefaultD[1]); | |||
| if (ss->DefaultD[2]) | |||
| @@ -515,7 +515,7 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) | |||
| { | |||
| /* Free display lists */ | |||
| while (1) { | |||
| GLuint list = HashFirstEntry(ss->DisplayList); | |||
| GLuint list = _mesa_HashFirstEntry(ss->DisplayList); | |||
| if (list) { | |||
| gl_destroy_list(ctx, list); | |||
| } | |||
| @@ -523,7 +523,7 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) | |||
| break; | |||
| } | |||
| } | |||
| DeleteHashTable(ss->DisplayList); | |||
| _mesa_DeleteHashTable(ss->DisplayList); | |||
| /* Free texture objects */ | |||
| while (ss->TexObjectList) | |||
| @@ -533,7 +533,7 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) | |||
| /* this function removes from linked list too! */ | |||
| gl_free_texture_object(ss, ss->TexObjectList); | |||
| } | |||
| DeleteHashTable(ss->TexObjects); | |||
| _mesa_DeleteHashTable(ss->TexObjects); | |||
| FREE(ss); | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| /* $Id: dlist.c,v 1.24 2000/01/13 00:24:48 brianp Exp $ */ | |||
| /* $Id: dlist.c,v 1.25 2000/01/24 16:19:54 brianp Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| @@ -339,7 +339,7 @@ void gl_destroy_list( GLcontext *ctx, GLuint list ) | |||
| if (list==0) | |||
| return; | |||
| block = (Node *) HashLookup(ctx->Shared->DisplayList, list); | |||
| block = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); | |||
| n = block; | |||
| done = block ? GL_FALSE : GL_TRUE; | |||
| @@ -419,7 +419,7 @@ void gl_destroy_list( GLcontext *ctx, GLuint list ) | |||
| } | |||
| } | |||
| HashRemove(ctx->Shared->DisplayList, list); | |||
| _mesa_HashRemove(ctx->Shared->DisplayList, list); | |||
| } | |||
| @@ -3190,7 +3190,7 @@ void gl_save_error( GLcontext *ctx, GLenum error, const char *s ) | |||
| static GLboolean | |||
| islist(GLcontext *ctx, GLuint list) | |||
| { | |||
| if (list > 0 && HashLookup(ctx->Shared->DisplayList, list)) { | |||
| if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) { | |||
| return GL_TRUE; | |||
| } | |||
| else { | |||
| @@ -3224,7 +3224,7 @@ static void execute_list( GLcontext *ctx, GLuint list ) | |||
| ctx->CallDepth++; | |||
| n = (Node *) HashLookup(ctx->Shared->DisplayList, list); | |||
| n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); | |||
| done = GL_FALSE; | |||
| while (!done) { | |||
| @@ -3849,12 +3849,12 @@ _mesa_GenLists(GLsizei range ) | |||
| return 0; | |||
| } | |||
| base = HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); | |||
| base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); | |||
| if (base) { | |||
| /* reserve the list IDs by with empty/dummy lists */ | |||
| GLint i; | |||
| for (i=0; i<range; i++) { | |||
| HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list()); | |||
| _mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list()); | |||
| } | |||
| } | |||
| return base; | |||
| @@ -3934,7 +3934,7 @@ _mesa_EndList( void ) | |||
| /* Destroy old list, if any */ | |||
| gl_destroy_list(ctx, ctx->CurrentListNum); | |||
| /* Install the list */ | |||
| HashInsert(ctx->Shared->DisplayList, ctx->CurrentListNum, ctx->CurrentListPtr); | |||
| _mesa_HashInsert(ctx->Shared->DisplayList, ctx->CurrentListNum, ctx->CurrentListPtr); | |||
| if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) | |||
| @@ -4542,7 +4542,7 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) | |||
| return; | |||
| } | |||
| n = (Node *) HashLookup(ctx->Shared->DisplayList, list); | |||
| n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); | |||
| fprintf( f, "START-LIST %u, address %p\n", list, (void*)n ); | |||
| @@ -1,10 +1,10 @@ | |||
| /* $Id: hash.c,v 1.5 2000/01/04 08:14:36 brianp Exp $ */ | |||
| /* $Id: hash.c,v 1.6 2000/01/24 16:19:54 brianp Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 3.3 | |||
| * | |||
| * Copyright (C) 1999 Brian Paul All Rights Reserved. | |||
| * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. | |||
| * | |||
| * Permission is hereby granted, free of charge, to any person obtaining a | |||
| * copy of this software and associated documentation files (the "Software"), | |||
| @@ -50,7 +50,7 @@ struct HashEntry { | |||
| struct HashEntry *Next; | |||
| }; | |||
| struct HashTable { | |||
| struct _mesa_HashTable { | |||
| struct HashEntry *Table[TABLE_SIZE]; | |||
| GLuint MaxKey; | |||
| }; | |||
| @@ -60,9 +60,9 @@ struct HashTable { | |||
| /* | |||
| * Return pointer to a new, empty hash table. | |||
| */ | |||
| struct HashTable *NewHashTable(void) | |||
| struct _mesa_HashTable *_mesa_NewHashTable(void) | |||
| { | |||
| return CALLOC_STRUCT(HashTable); | |||
| return CALLOC_STRUCT(_mesa_HashTable); | |||
| } | |||
| @@ -70,7 +70,7 @@ struct HashTable *NewHashTable(void) | |||
| /* | |||
| * Delete a hash table. | |||
| */ | |||
| void DeleteHashTable(struct HashTable *table) | |||
| void _mesa_DeleteHashTable(struct _mesa_HashTable *table) | |||
| { | |||
| GLuint i; | |||
| assert(table); | |||
| @@ -93,7 +93,7 @@ void DeleteHashTable(struct HashTable *table) | |||
| * key - the key | |||
| * Return: user data pointer or NULL if key not in table | |||
| */ | |||
| void *HashLookup(const struct HashTable *table, GLuint key) | |||
| void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key) | |||
| { | |||
| GLuint pos; | |||
| const struct HashEntry *entry; | |||
| @@ -121,7 +121,7 @@ void *HashLookup(const struct HashTable *table, GLuint key) | |||
| * key - the key (not zero) | |||
| * data - pointer to user data | |||
| */ | |||
| void HashInsert(struct HashTable *table, GLuint key, void *data) | |||
| void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) | |||
| { | |||
| /* search for existing entry with this key */ | |||
| GLuint pos; | |||
| @@ -159,7 +159,7 @@ void HashInsert(struct HashTable *table, GLuint key, void *data) | |||
| * Input: table - the hash table | |||
| * key - key of entry to remove | |||
| */ | |||
| void HashRemove(struct HashTable *table, GLuint key) | |||
| void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) | |||
| { | |||
| GLuint pos; | |||
| struct HashEntry *entry, *prev; | |||
| @@ -194,7 +194,7 @@ void HashRemove(struct HashTable *table, GLuint key) | |||
| * By calling this function until zero is returned we can get | |||
| * the keys of all entries in the table. | |||
| */ | |||
| GLuint HashFirstEntry(const struct HashTable *table) | |||
| GLuint _mesa_HashFirstEntry(const struct _mesa_HashTable *table) | |||
| { | |||
| GLuint pos; | |||
| assert(table); | |||
| @@ -210,7 +210,7 @@ GLuint HashFirstEntry(const struct HashTable *table) | |||
| /* | |||
| * Dump contents of hash table for debugging. | |||
| */ | |||
| void HashPrint(const struct HashTable *table) | |||
| void _mesa_HashPrint(const struct _mesa_HashTable *table) | |||
| { | |||
| GLuint i; | |||
| assert(table); | |||
| @@ -231,7 +231,7 @@ void HashPrint(const struct HashTable *table) | |||
| * numKeys - number of keys needed | |||
| * Return: starting key of free block or 0 if failure | |||
| */ | |||
| GLuint HashFindFreeKeyBlock(const struct HashTable *table, GLuint numKeys) | |||
| GLuint _mesa_HashFindFreeKeyBlock(const struct _mesa_HashTable *table, GLuint numKeys) | |||
| { | |||
| GLuint maxKey = ~((GLuint) 0); | |||
| if (maxKey - numKeys > table->MaxKey) { | |||
| @@ -244,7 +244,7 @@ GLuint HashFindFreeKeyBlock(const struct HashTable *table, GLuint numKeys) | |||
| GLuint freeStart = 1; | |||
| GLuint key; | |||
| for (key=1; key!=maxKey; key++) { | |||
| if (HashLookup(table, key)) { | |||
| if (_mesa_HashLookup(table, key)) { | |||
| /* darn, this key is already in use */ | |||
| freeCount = 0; | |||
| freeStart = key+1; | |||
| @@ -273,15 +273,15 @@ int main(int argc, char *argv[]) | |||
| printf("&a = %p\n", &a); | |||
| printf("&b = %p\n", &b); | |||
| t = NewHashTable(); | |||
| HashInsert(t, 501, &a); | |||
| HashInsert(t, 10, &c); | |||
| HashInsert(t, 0xfffffff8, &b); | |||
| HashPrint(t); | |||
| printf("Find 501: %p\n", HashLookup(t,501)); | |||
| printf("Find 1313: %p\n", HashLookup(t,1313)); | |||
| printf("Find block of 100: %d\n", HashFindFreeKeyBlock(t, 100)); | |||
| DeleteHashTable(t); | |||
| t = _mesa_NewHashTable(); | |||
| _mesa_HashInsert(t, 501, &a); | |||
| _mesa_HashInsert(t, 10, &c); | |||
| _mesa_HashInsert(t, 0xfffffff8, &b); | |||
| _mesa_HashPrint(t); | |||
| printf("Find 501: %p\n", _mesa_HashLookup(t,501)); | |||
| printf("Find 1313: %p\n", _mesa_HashLookup(t,1313)); | |||
| printf("Find block of 100: %d\n", _mesa_HashFindFreeKeyBlock(t, 100)); | |||
| _mesa_DeleteHashTable(t); | |||
| return 0; | |||
| } | |||
| @@ -1,10 +1,10 @@ | |||
| /* $Id: hash.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */ | |||
| /* $Id: hash.h,v 1.3 2000/01/24 16:19:54 brianp Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 3.3 | |||
| * | |||
| * Copyright (C) 1999 Brian Paul All Rights Reserved. | |||
| * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. | |||
| * | |||
| * Permission is hereby granted, free of charge, to any person obtaining a | |||
| * copy of this software and associated documentation files (the "Software"), | |||
| @@ -36,21 +36,21 @@ struct HashTable; | |||
| extern struct HashTable *NewHashTable(void); | |||
| extern struct _mesa_HashTable *_mesa_NewHashTable(void); | |||
| extern void DeleteHashTable(struct HashTable *table); | |||
| extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table); | |||
| extern void *HashLookup(const struct HashTable *table, GLuint key); | |||
| extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key); | |||
| extern void HashInsert(struct HashTable *table, GLuint key, void *data); | |||
| extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data); | |||
| extern void HashRemove(struct HashTable *table, GLuint key); | |||
| extern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key); | |||
| extern GLuint HashFirstEntry(const struct HashTable *table); | |||
| extern GLuint _mesa_HashFirstEntry(const struct _mesa_HashTable *table); | |||
| extern void HashPrint(const struct HashTable *table); | |||
| extern void _mesa_HashPrint(const struct _mesa_HashTable *table); | |||
| extern GLuint HashFindFreeKeyBlock(const struct HashTable *table, GLuint numKeys); | |||
| extern GLuint _mesa_HashFindFreeKeyBlock(const struct _mesa_HashTable *table, GLuint numKeys); | |||
| #endif | |||
| @@ -1,10 +1,10 @@ | |||
| /* $Id: texobj.c,v 1.10 1999/12/01 21:10:08 brianp Exp $ */ | |||
| /* $Id: texobj.c,v 1.11 2000/01/24 16:19:55 brianp Exp $ */ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 3.3 | |||
| * | |||
| * Copyright (C) 1999 Brian Paul All Rights Reserved. | |||
| * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. | |||
| * | |||
| * Permission is hereby granted, free of charge, to any person obtaining a | |||
| * copy of this software and associated documentation files (the "Software"), | |||
| @@ -90,7 +90,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, | |||
| if (name > 0) { | |||
| /* insert into hash table */ | |||
| HashInsert(shared->TexObjects, name, obj); | |||
| _mesa_HashInsert(shared->TexObjects, name, obj); | |||
| } | |||
| } | |||
| return obj; | |||
| @@ -137,7 +137,7 @@ void gl_free_texture_object( struct gl_shared_state *shared, | |||
| if (t->Name) { | |||
| /* remove from hash table */ | |||
| HashRemove(shared->TexObjects, t->Name); | |||
| _mesa_HashRemove(shared->TexObjects, t->Name); | |||
| } | |||
| /* free texture image */ | |||
| @@ -338,7 +338,7 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) | |||
| return; | |||
| } | |||
| first = HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); | |||
| first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); | |||
| /* Return the texture names */ | |||
| for (i=0;i<n;i++) { | |||
| @@ -370,7 +370,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName) | |||
| struct gl_texture_object *t; | |||
| if (texName[i]>0) { | |||
| t = (struct gl_texture_object *) | |||
| HashLookup(ctx->Shared->TexObjects, texName[i]); | |||
| _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); | |||
| if (t) { | |||
| GLuint u; | |||
| for (u=0; u<MAX_TEXTURE_UNITS; u++) { | |||
| @@ -443,7 +443,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) | |||
| if (texName == 0) | |||
| newTexObj = ctx->Shared->DefaultD[dim]; | |||
| else { | |||
| struct HashTable *hash = ctx->Shared->TexObjects; | |||
| struct _mesa_HashTable *hash = ctx->Shared->TexObjects; | |||
| newTexObj = (struct gl_texture_object *) HashLookup(hash, texName); | |||
| if (!newTexObj) | |||
| @@ -523,7 +523,7 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, | |||
| struct gl_texture_object *t; | |||
| if (texName[i]>0) { | |||
| t = (struct gl_texture_object *) | |||
| HashLookup(ctx->Shared->TexObjects, texName[i]); | |||
| _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); | |||
| if (t) { | |||
| t->Priority = CLAMP( priorities[i], 0.0F, 1.0F ); | |||
| @@ -562,7 +562,7 @@ _mesa_AreTexturesResident( GLsizei n, const GLuint *texName, | |||
| return GL_FALSE; | |||
| } | |||
| t = (struct gl_texture_object *) | |||
| HashLookup(ctx->Shared->TexObjects, texName[i]); | |||
| _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); | |||
| if (t) { | |||
| if (ctx->Driver.IsTextureResident) | |||
| residences[i] = ctx->Driver.IsTextureResident( ctx, t ); | |||
| @@ -588,7 +588,7 @@ _mesa_IsTexture( GLuint texture ) | |||
| GET_CURRENT_CONTEXT(ctx); | |||
| ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures", | |||
| GL_FALSE); | |||
| if (texture>0 && HashLookup(ctx->Shared->TexObjects, texture)) { | |||
| if (texture>0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) { | |||
| return GL_TRUE; | |||
| } | |||
| else { | |||