Search
lxdream.org :: lxdream/src/pvr2/texcache.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/texcache.c
changeset 645:a7392098299c
prev635:76c63aac3590
next647:d6fecb7750b9
author nkeynes
date Thu Mar 06 08:22:00 2008 +0000 (14 years ago)
branchlxdream-render
permissions -rw-r--r--
last change More refactor work in progress - nearly done now
file annotate diff log raw
1.1 --- a/src/pvr2/texcache.c Thu Feb 14 13:54:11 2008 +0000
1.2 +++ b/src/pvr2/texcache.c Thu Mar 06 08:22:00 2008 +0000
1.3 @@ -509,20 +509,19 @@
1.4 * If the texture has already been bound, return the ID to which it was
1.5 * bound. Otherwise obtain an unused texture ID and set it up appropriately.
1.6 */
1.7 -GLuint texcache_get_texture( uint32_t texture_addr, int width, int height,
1.8 - int mode )
1.9 +GLuint texcache_get_texture( uint32_t texture_word, int width, int height )
1.10 {
1.11 + uint32_t texture_addr = (texture_word & 0x000FFFFF)<<3;
1.12 uint32_t texture_page = texture_addr >> 12;
1.13 texcache_entry_index next;
1.14 texcache_entry_index idx = texcache_page_lookup[texture_page];
1.15 while( idx != EMPTY_ENTRY ) {
1.16 texcache_entry_t entry = &texcache_active_list[idx];
1.17 if( entry->texture_addr == texture_addr &&
1.18 - entry->mode == mode &&
1.19 + entry->mode == texture_word &&
1.20 entry->width == width &&
1.21 entry->height == height ) {
1.22 entry->lru_count = texcache_ref_counter++;
1.23 - glBindTexture( GL_TEXTURE_2D, entry->texture_id );
1.24 return entry->texture_id;
1.25 }
1.26 idx = entry->next;
1.27 @@ -542,7 +541,7 @@
1.28 texcache_active_list[slot].texture_addr = texture_addr;
1.29 texcache_active_list[slot].width = width;
1.30 texcache_active_list[slot].height = height;
1.31 - texcache_active_list[slot].mode = mode;
1.32 + texcache_active_list[slot].mode = texture_word;
1.33 texcache_active_list[slot].lru_count = texcache_ref_counter++;
1.34
1.35 /* Add entry to the lookup table */
1.36 @@ -563,9 +562,8 @@
1.37
1.38 /* Construct the GL texture */
1.39 glBindTexture( GL_TEXTURE_2D, texcache_active_list[slot].texture_id );
1.40 - texcache_load_texture( texture_addr, width, height, mode );
1.41 + texcache_load_texture( texture_addr, width, height, texture_word );
1.42
1.43 - texcache_integrity_check();
1.44 return texcache_active_list[slot].texture_id;
1.45 }
1.46
.