<html>
<body>
<div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream/src/pvr2</tt></b></td></tr>
<tr><td><tt><a href="#file1">glrender.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+3</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-22</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f502f3d32f90 -> 68daed8f38af</td></tr>
<tr class="alt" style=";" ><td><tt><a href="#file2">pvr2.h</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+2</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-2</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f502f3d32f90 -> 68daed8f38af</td></tr>
<tr><td><tt><a href="#file3">texcache.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+37</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-18</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">f502f3d32f90 -> 68daed8f38af</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+42</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-42</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >3 modified files</small><br />
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
Set gl texture parameters at texture load time rather than render time.
(This does mean that if the texture is used with variant parameters it will be
loaded multiple times). 3-4% faster this way
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>glrender.c</b></big> <small id="info" style="color: #888888;" >f502f3d32f90 -> 68daed8f38af</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/glrender.c
+++ lxdream/src/pvr2/glrender.c
@@ -61,20 +61,16 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
int i;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- texcache_<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >set_config</span>( MMIO_READ( PVR2, RENDER_PALETTE ) & 0x03,
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ texcache_<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >begin_scene</span>( MMIO_READ( PVR2, RENDER_PALETTE ) & 0x03,
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > (MMIO_READ( PVR2, RENDER_TEXSIZE ) & 0x003F) << 5 );
for( i=0; i < pvr2_scene.poly_count; i++ ) {
struct polygon_struct *poly = &pvr2_scene.poly_array[i];
if( POLY1_TEXTURED(poly->context[0]) ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- poly->tex_id = texcache_get_texture( poly->context[2],
- POLY2_TEX_WIDTH(poly->context[1]),
- POLY2_TEX_HEIGHT(poly->context[1]) );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ poly->tex_id = texcache_get_texture( poly->context[1], poly->context[2] );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > if( poly->mod_vertex_index != -1 ) {
if( pvr2_scene.shadow_mode == SHADOW_FULL ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- poly->mod_tex_id = texcache_get_texture( poly->context[4],
- POLY2_TEX_WIDTH(poly->context[3]),
- POLY2_TEX_HEIGHT(poly->context[3]) );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ poly->mod_tex_id = texcache_get_texture( poly->context[3], poly->context[4] );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > } else {
poly->mod_tex_id = poly->tex_id;
}
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -155,21 +151,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > if( POLY1_TEXTURED(poly1) ) {
glEnable(GL_TEXTURE_2D);
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, pvr2_poly_texblend[POLY2_TEX_BLEND(poly2)] );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-
- if( POLY2_TEX_CLAMP_U(poly2) ) {
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- } else if( POLY2_TEX_MIRROR_U(poly2) ) {
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT_ARB );
- } else {
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- }
- if( POLY2_TEX_CLAMP_V(poly2) ) {
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
- } else if( POLY2_TEX_MIRROR_V(poly2) ) {
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT_ARB );
- } else {
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- }
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > } else {
glDisable( GL_TEXTURE_2D );
}
</pre></div>
<hr /><a name="file2" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>pvr2.h</b></big> <small id="info" style="color: #888888;" >f502f3d32f90 -> 68daed8f38af</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/pvr2.h
+++ lxdream/src/pvr2/pvr2.h
@@ -344,7 +344,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > * Set the global texture parameters for the scene (possibly invalidating
* some existing textures)
*/
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-void texcache_<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >set_config</span>( uint32_t palette_mode, uint32_t stride_width );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void texcache_<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >begin_scene</span>( uint32_t palette_mode, uint32_t stride_width );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
/**
* Return a texture ID for the texture specified at the supplied address
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -356,7 +356,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > * If the texture has already been bound, return the ID to which it was
* bound. Otherwise obtain an unused texture ID and set it up appropriately.
*/
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-GLuint texcache_get_texture( uint32_t texture_word, int width, int height );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+GLuint texcache_get_texture( uint32_t poly2_word, uint32_t texture_word );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
render_buffer_t texcache_get_render_buffer( uint32_t texture_addr, int mode, int width, int height );
</pre></div>
<hr /><a name="file3" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>texcache.c</b></big> <small id="info" style="color: #888888;" >f502f3d32f90 -> 68daed8f38af</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/texcache.c
+++ lxdream/src/pvr2/texcache.c
@@ -47,7 +47,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
typedef struct texcache_entry {
uint32_t texture_addr;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- int width, height, mode;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ uint32_t poly2_mode, tex_mode;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > GLuint texture_id;
render_buffer_t buffer;
texcache_entry_index next;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -230,7 +230,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > int i;
for( i=0; i<MAX_TEXTURES; i++ ) {
if( texcache_active_list[i].texture_addr != -1 &&
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- PVR2_TEX_IS_PALETTE(texcache_active_list[i].mode) ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ PVR2_TEX_IS_PALETTE(texcache_active_list[i].<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >tex_</span>mode) ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > texcache_evict( i );
texcache_free_ptr--;
texcache_free_list[texcache_free_ptr] = i;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -246,7 +246,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > int i;
for( i=0; i<MAX_TEXTURES; i++ ) {
if( texcache_active_list[i].texture_addr != -1 &&
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- PVR2_TEX_IS_STRIDE(texcache_active_list[i].mode) ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ PVR2_TEX_IS_STRIDE(texcache_active_list[i].<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >tex_</span>mode) ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > texcache_evict( i );
texcache_free_ptr--;
texcache_free_list[texcache_free_ptr] = i;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -254,7 +254,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-void texcache_<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >set_config</span>( uint32_t palette_mode, uint32_t stride )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void texcache_<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >begin_scene</span>( uint32_t palette_mode, uint32_t stride )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
if( palette_mode != texcache_palette_mode )
texcache_invalidate_palette();
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -579,7 +579,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-static int texcache_find_texture_slot( uint32_t texture_word, int width, int height )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static int texcache_find_texture_slot( uint32_t poly2_masked_word, uint32_t texture_word )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
uint32_t texture_addr = (texture_word & 0x000FFFFF)<<3;
uint32_t texture_page = texture_addr >> 12;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -587,10 +587,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > texcache_entry_index idx = texcache_page_lookup[texture_page];
while( idx != EMPTY_ENTRY ) {
texcache_entry_t entry = &texcache_active_list[idx];
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- if( entry->texture_addr == texture_addr &&
- entry->mode == texture_word &&
- entry->width == width &&
- entry->height == height ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ if( entry->tex_mode == texture_word &&
+ entry->poly2_mode == poly2_masked_word ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > entry->lru_count = texcache_ref_counter++;
return idx;
}
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -599,7 +597,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > return -1;
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-static int texcache_alloc_texture_slot( uint32_t texture_word, int width, int height )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static int texcache_alloc_texture_slot( uint32_t poly2_word, uint32_t texture_word )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
uint32_t texture_addr = (texture_word & 0x000FFFFF)<<3;
uint32_t texture_page = texture_addr >> 12;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -614,9 +612,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /* Construct new entry */
assert( texcache_active_list[slot].texture_addr == -1 );
texcache_active_list[slot].texture_addr = texture_addr;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- texcache_active_list[slot].width = width;
- texcache_active_list[slot].height = height;
- texcache_active_list[slot].mode = texture_word;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ texcache_active_list[slot].tex_mode = texture_word;
+ texcache_active_list[slot].poly2_mode = poly2_word;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > texcache_active_list[slot].lru_count = texcache_ref_counter++;
/* Add entry to the lookup table */
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -640,29 +637,50 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > * Return a texture ID for the texture specified at the supplied address
* and given parameters (the same sequence of bytes could in theory have
* multiple interpretations). We use the texture address as the primary
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * index, but allow for multiple instances at each address. The texture
- * will be bound to the GL_TEXTURE_2D target before being returned.
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * index, but allow for multiple instances at each address.
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > *
* If the texture has already been bound, return the ID to which it was
* bound. Otherwise obtain an unused texture ID and set it up appropriately.
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * The current GL_TEXTURE_2D binding will be changed in this case.
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-GLuint texcache_get_texture( uint32_t texture_word, int width, int height )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+GLuint texcache_get_texture( uint32_t poly2_word, uint32_t texture_word )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- int slot = texcache_find_texture_slot( texture_word, width, height );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ poly2_word &= 0x000F803F; /* Get just the texture-relevant bits */
+ int slot = texcache_find_texture_slot( poly2_word, texture_word );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
if( slot == -1 ) {
/* Not found - check the free list */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- slot = texcache_alloc_texture_slot( texture_word, width, height );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ slot = texcache_alloc_texture_slot( poly2_word, texture_word );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
/* Construct the GL texture */
uint32_t texture_addr = (texture_word & 0x000FFFFF)<<3;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ unsigned width = POLY2_TEX_WIDTH(poly2_word);
+ unsigned height = POLY2_TEX_HEIGHT(poly2_word);
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > glBindTexture( GL_TEXTURE_2D, texcache_active_list[slot].texture_id );
texcache_load_texture( texture_addr, width, height, texture_word );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
+ /* Set texture parameters from the poly2 word */
+ if( POLY2_TEX_CLAMP_U(poly2_word) ) {
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
+ } else if( POLY2_TEX_MIRROR_U(poly2_word) ) {
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT_ARB );
+ } else {
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
+ }
+ if( POLY2_TEX_CLAMP_V(poly2_word) ) {
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
+ } else if( POLY2_TEX_MIRROR_V(poly2_word) ) {
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT_ARB );
+ } else {
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
+ }
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
return texcache_active_list[slot].texture_id;
}
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#if 0
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > render_buffer_t texcache_get_render_buffer( uint32_t texture_addr, int mode, int width, int height )
{
uint32_t texture_word = ((texture_addr >> 3) & 0x000FFFFF) | PVR2_TEX_UNTWIDDLED;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -693,6 +711,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
return entry->buffer;
}
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#endif
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
/**
* Check the integrity of the texcache. Verifies that every cache slot
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>