<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">+13</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-25</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">4727c2006e0f -> 1e074a98317c</td></tr>
<tr class="alt" style=";" ><td><tt><a href="#file2">scene.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+8</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-4</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">4727c2006e0f -> 1e074a98317c</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+21</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-29</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >2 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;" >
Turn on COLOR_SUM + FOG unconditionally, relying on scene setup to set
appropriate empty values when disabled - this is a minor performance win
</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;" >4727c2006e0f -> 1e074a98317c</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/glrender.c
+++ lxdream/src/pvr2/glrender.c
@@ -124,6 +124,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
     glClearDepth(0);
     glClearStencil(0);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
+    glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
+    glFogi(GL_FOG_MODE, GL_LINEAR);
+    glFogf(GL_FOG_START, 0.0);
+    glFogf(GL_FOG_END, 1.0);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
 static void render_set_cull( uint32_t poly1 )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -166,16 +171,10 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > static void render_set_tsp_context( uint32_t poly1, uint32_t poly2, uint32_t texture )
 {
     glShadeModel( POLY1_SHADE_MODEL(poly1) );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-
-    if( POLY1_SPECULAR(poly1) ) {
-        glEnable(GL_COLOR_SUM);
-    } else {
-        glDisable(GL_COLOR_SUM);
-    }
-
</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="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >          if( POLY2_TEX_CLAMP_U(poly2) ) {
              glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
          } else if( POLY2_TEX_MIRROR_U(poly2) ) {
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -193,20 +192,14 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      } else {
          glDisable( GL_TEXTURE_2D );
      }
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-     
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      switch( POLY2_FOG_MODE(poly2) ) {
      case PVR2_POLY_FOG_LOOKUP:
          glFogfv( GL_FOG_COLOR, pvr2_scene.fog_lut_colour );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-         glEnable( GL_FOG );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >          break;
      case PVR2_POLY_FOG_VERTEX:
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-         if( POLY1_SPECULAR(poly1) ) {
-             glFogfv( GL_FOG_COLOR, pvr2_scene.fog_vert_colour );
-             glEnable( GL_FOG );
-             break;
-         } /* else fallthrough */
-     default:
-         glDisable( GL_FOG );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+         glFogfv( GL_FOG_COLOR, pvr2_scene.fog_vert_colour );
+         break;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >      }
 
      int srcblend = POLY2_SRC_BLEND(poly2);
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -321,8 +314,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         return;
 
     glDisable( GL_TEXTURE_2D );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glDisable( GL_FOG );
-    glDisable( GL_COLOR_SUM );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     
     while(1) {
         uint32_t entry = *tile_list++;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -436,8 +427,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         return;
 
     glDisable( GL_TEXTURE_2D );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glDisable( GL_FOG );
-    glDisable( GL_COLOR_SUM );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glDisable( GL_CULL_FACE );
     glEnable( GL_STENCIL_TEST );
     glEnable( GL_DEPTH_TEST );
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -521,10 +510,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glTexCoordPointer(2, GL_FLOAT, sizeof(struct vertex_struct), &pvr2_scene.vertex_array[0].u);
     glSecondaryColorPointerEXT(3, GL_FLOAT, sizeof(struct vertex_struct), pvr2_scene.vertex_array[0].offset_rgba );
     glFogCoordPointerEXT(GL_FLOAT, sizeof(struct vertex_struct), &pvr2_scene.vertex_array[0].offset_rgba[3] );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
-    glFogi(GL_FOG_MODE, GL_LINEAR);
-    glFogf(GL_FOG_START, 0.0);
-    glFogf(GL_FOG_END, 1.0);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     /* Turn on the shaders (if available) */
     glsl_set_shader(DEFAULT_PROGRAM);
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -532,6 +517,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     gl_render_bkgnd( pvr2_scene.bkgnd_poly );
 
     glEnable( GL_SCISSOR_TEST );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glEnable( GL_COLOR_SUM );
+    glEnable( GL_FOG );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
     /* Process the segment list */
     struct tile_segment *segment = pvr2_scene.segment_list;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -579,7 +566,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         }
     } while( !IS_LAST_SEGMENT(segment++) );
     glDisable( GL_SCISSOR_TEST );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glDisable( GL_COLOR_SUM );
+    glDisable( GL_FOG );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glsl_clear_shader();
 
     gettimeofday( &end_tv, NULL );
</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>scene.c</b></big> <small id="info" style="color: #888888;" >4727c2006e0f -> 1e074a98317c</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/scene.c
+++ lxdream/src/pvr2/scene.c
@@ -372,20 +372,24 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     
     for( i=0; i<pvr2_scene.poly_count; i++ ) {
         int mode = POLY2_FOG_MODE(pvr2_scene.poly_array[i].context[1]);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        uint32_t index = pvr2_scene.poly_array[i].vertex_index;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         if( mode == PVR2_POLY_FOG_LOOKUP ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            uint32_t index = pvr2_scene.poly_array[i].vertex_index;
-            for( j=0; j<=pvr2_scene.poly_array[i].vertex_count; j++ ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            for( j=0; j<pvr2_scene.poly_array[i].vertex_count; j++ ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >                 pvr2_scene.vertex_array[index+j].offset_rgba[3] = 
                     scene_compute_lut_fog_vertex( pvr2_scene.vertex_array[index+j].z, fog_density, fog_table );
             }
         } else if( mode == PVR2_POLY_FOG_LOOKUP2 ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-            uint32_t index = pvr2_scene.poly_array[i].vertex_index;
-            for( j=0; j<=pvr2_scene.poly_array[i].vertex_count; j++ ) {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+            for( j=0; j<pvr2_scene.poly_array[i].vertex_count; j++ ) {
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >                 pvr2_scene.vertex_array[index+j].rgba[0] = pvr2_scene.fog_lut_colour[0];
                 pvr2_scene.vertex_array[index+j].rgba[1] = pvr2_scene.fog_lut_colour[1];
                 pvr2_scene.vertex_array[index+j].rgba[2] = pvr2_scene.fog_lut_colour[2];
                 pvr2_scene.vertex_array[index+j].rgba[3] = 
                     scene_compute_lut_fog_vertex( pvr2_scene.vertex_array[index+j].z, fog_density, fog_table );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+                pvr2_scene.vertex_array[index+j].offset_rgba[3] = 0;
+            }
+        } else if( mode == PVR2_POLY_FOG_DISABLED ) {
+            for( j=0; j<pvr2_scene.poly_array[i].vertex_count; j++ ) {
+                pvr2_scene.vertex_array[index+j].offset_rgba[3] = 0;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >             }
         }
     }    
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>