TINYGL: Add free_texture variant taking a GLTexture * argument.
To avoid looking texture up in the hash table when caller has a pointer to it already. Aka, O(0) is better than O(1).
This commit is contained in:
parent
306fdff963
commit
97dc3881e0
3 changed files with 7 additions and 3 deletions
|
@ -47,10 +47,13 @@ static GLTexture *find_texture(GLContext *c, unsigned int h) {
|
|||
}
|
||||
|
||||
void free_texture(GLContext *c, int h) {
|
||||
GLTexture *t, **ht;
|
||||
free_texture(c, find_texture(c, h));
|
||||
}
|
||||
|
||||
void free_texture(GLContext *c, GLTexture *t) {
|
||||
GLTexture **ht;
|
||||
GLImage *im;
|
||||
|
||||
t = find_texture(c, h);
|
||||
if (!t->prev) {
|
||||
ht = &c->shared_state.texture_hash_table[t->handle % TEXTURE_HASH_TABLE_SIZE];
|
||||
*ht = t->next;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue