Search
lxdream.org :: lxdream/src/pvr2/glrender.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/glrender.c
changeset 1132:1e074a98317c
prev1130:5f56fc931112
next1133:f3da7d810d5c
author nkeynes
date Tue Oct 19 22:43:10 2010 +1000 (9 years ago)
permissions -rw-r--r--
last change Turn on COLOR_SUM + FOG unconditionally, relying on scene setup to set
appropriate empty values when disabled - this is a minor performance win
file annotate diff log raw
1.1 --- a/src/pvr2/glrender.c Fri Sep 17 20:08:50 2010 +1000
1.2 +++ b/src/pvr2/glrender.c Tue Oct 19 22:43:10 2010 +1000
1.3 @@ -124,6 +124,11 @@
1.4 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
1.5 glClearDepth(0);
1.6 glClearStencil(0);
1.7 +
1.8 + glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
1.9 + glFogi(GL_FOG_MODE, GL_LINEAR);
1.10 + glFogf(GL_FOG_START, 0.0);
1.11 + glFogf(GL_FOG_END, 1.0);
1.12 }
1.13
1.14 static void render_set_cull( uint32_t poly1 )
1.15 @@ -166,16 +171,10 @@
1.16 static void render_set_tsp_context( uint32_t poly1, uint32_t poly2, uint32_t texture )
1.17 {
1.18 glShadeModel( POLY1_SHADE_MODEL(poly1) );
1.19 -
1.20 - if( POLY1_SPECULAR(poly1) ) {
1.21 - glEnable(GL_COLOR_SUM);
1.22 - } else {
1.23 - glDisable(GL_COLOR_SUM);
1.24 - }
1.25 -
1.26 if( POLY1_TEXTURED(poly1) ) {
1.27 glEnable(GL_TEXTURE_2D);
1.28 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, pvr2_poly_texblend[POLY2_TEX_BLEND(poly2)] );
1.29 +
1.30 if( POLY2_TEX_CLAMP_U(poly2) ) {
1.31 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
1.32 } else if( POLY2_TEX_MIRROR_U(poly2) ) {
1.33 @@ -193,20 +192,14 @@
1.34 } else {
1.35 glDisable( GL_TEXTURE_2D );
1.36 }
1.37 -
1.38 +
1.39 switch( POLY2_FOG_MODE(poly2) ) {
1.40 case PVR2_POLY_FOG_LOOKUP:
1.41 glFogfv( GL_FOG_COLOR, pvr2_scene.fog_lut_colour );
1.42 - glEnable( GL_FOG );
1.43 break;
1.44 case PVR2_POLY_FOG_VERTEX:
1.45 - if( POLY1_SPECULAR(poly1) ) {
1.46 - glFogfv( GL_FOG_COLOR, pvr2_scene.fog_vert_colour );
1.47 - glEnable( GL_FOG );
1.48 - break;
1.49 - } /* else fallthrough */
1.50 - default:
1.51 - glDisable( GL_FOG );
1.52 + glFogfv( GL_FOG_COLOR, pvr2_scene.fog_vert_colour );
1.53 + break;
1.54 }
1.55
1.56 int srcblend = POLY2_SRC_BLEND(poly2);
1.57 @@ -321,8 +314,6 @@
1.58 return;
1.59
1.60 glDisable( GL_TEXTURE_2D );
1.61 - glDisable( GL_FOG );
1.62 - glDisable( GL_COLOR_SUM );
1.63
1.64 while(1) {
1.65 uint32_t entry = *tile_list++;
1.66 @@ -436,8 +427,6 @@
1.67 return;
1.68
1.69 glDisable( GL_TEXTURE_2D );
1.70 - glDisable( GL_FOG );
1.71 - glDisable( GL_COLOR_SUM );
1.72 glDisable( GL_CULL_FACE );
1.73 glEnable( GL_STENCIL_TEST );
1.74 glEnable( GL_DEPTH_TEST );
1.75 @@ -521,10 +510,6 @@
1.76 glTexCoordPointer(2, GL_FLOAT, sizeof(struct vertex_struct), &pvr2_scene.vertex_array[0].u);
1.77 glSecondaryColorPointerEXT(3, GL_FLOAT, sizeof(struct vertex_struct), pvr2_scene.vertex_array[0].offset_rgba );
1.78 glFogCoordPointerEXT(GL_FLOAT, sizeof(struct vertex_struct), &pvr2_scene.vertex_array[0].offset_rgba[3] );
1.79 - glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
1.80 - glFogi(GL_FOG_MODE, GL_LINEAR);
1.81 - glFogf(GL_FOG_START, 0.0);
1.82 - glFogf(GL_FOG_END, 1.0);
1.83 /* Turn on the shaders (if available) */
1.84 glsl_set_shader(DEFAULT_PROGRAM);
1.85
1.86 @@ -532,6 +517,8 @@
1.87 gl_render_bkgnd( pvr2_scene.bkgnd_poly );
1.88
1.89 glEnable( GL_SCISSOR_TEST );
1.90 + glEnable( GL_COLOR_SUM );
1.91 + glEnable( GL_FOG );
1.92
1.93 /* Process the segment list */
1.94 struct tile_segment *segment = pvr2_scene.segment_list;
1.95 @@ -579,7 +566,8 @@
1.96 }
1.97 } while( !IS_LAST_SEGMENT(segment++) );
1.98 glDisable( GL_SCISSOR_TEST );
1.99 -
1.100 + glDisable( GL_COLOR_SUM );
1.101 + glDisable( GL_FOG );
1.102 glsl_clear_shader();
1.103
1.104 gettimeofday( &end_tv, NULL );
.