mesa: add _mesa_HashNumEntries() function
Useful when debugging to find the number of texture objects, shader programs, etc.
This commit is contained in:
parent
6811704830
commit
f1b33c74dc
|
@ -480,6 +480,26 @@ _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of entries in the hash table.
|
||||
*/
|
||||
GLuint
|
||||
_mesa_HashNumEntries(const struct _mesa_HashTable *table)
|
||||
{
|
||||
GLuint pos, count = 0;
|
||||
|
||||
for (pos = 0; pos < TABLE_SIZE; pos++) {
|
||||
const struct HashEntry *entry;
|
||||
for (entry = table->Table[pos]; entry; entry = entry->Next) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0 /* debug only */
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,6 +63,9 @@ extern void _mesa_HashPrint(const struct _mesa_HashTable *table);
|
|||
|
||||
extern GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys);
|
||||
|
||||
extern GLuint
|
||||
_mesa_HashNumEntries(const struct _mesa_HashTable *table);
|
||||
|
||||
extern void _mesa_test_hash_functions(void);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue