filename | src/pvr2/glrender.c |
changeset | 1137:4799d64b3478 |
prev | 1136:078a2202958a |
next | 1138:3bcb705a7ebc |
author | nkeynes |
date | Sun Oct 24 13:40:52 2010 +1000 (13 years ago) |
permissions | -rw-r--r-- |
last change | Change forced-depth-function lists (autosort, punchout) to just set the depth once at the start of the list Remove unused parameter from render_set_tsp_context |
file | annotate | diff | log | raw |
1.1 --- a/src/pvr2/glrender.c Sun Oct 24 13:10:53 2010 +10001.2 +++ b/src/pvr2/glrender.c Sun Oct 24 13:40:52 2010 +10001.3 @@ -131,12 +131,10 @@1.4 * Setup the basic context that's shared between normal and modified modes -1.5 * depth, culling1.6 */1.7 -static void render_set_base_context( uint32_t poly1, GLint depth_mode )1.8 +static void render_set_base_context( uint32_t poly1, gboolean set_depth )1.9 {1.10 - if( depth_mode == 0 ) {1.11 + if( set_depth ) {1.12 glDepthFunc( POLY1_DEPTH_MODE(poly1) );1.13 - } else {1.14 - glDepthFunc(depth_mode);1.15 }1.17 glDepthMask( POLY1_DEPTH_WRITE(poly1) ? GL_TRUE : GL_FALSE );1.18 @@ -145,7 +143,7 @@1.19 /**1.20 * Setup the texture/shading settings (TSP) which vary between mod/unmod modes.1.21 */1.22 -static void render_set_tsp_context( uint32_t poly1, uint32_t poly2, uint32_t texture )1.23 +void render_set_tsp_context( uint32_t poly1, uint32_t poly2 )1.24 {1.25 glShadeModel( POLY1_SHADE_MODEL(poly1) );1.26 if( POLY1_TEXTURED(poly1) ) {1.27 @@ -179,10 +177,10 @@1.28 * @param depth_mode force depth mode, or 0 to use the polygon's1.29 * depth mode.1.30 */1.31 -void render_set_context( uint32_t *context, GLint depth_mode )1.32 +void render_set_context( uint32_t *context, gboolean set_depth )1.33 {1.34 - render_set_base_context(context[0], depth_mode);1.35 - render_set_tsp_context(context[0],context[1],context[2]);1.36 + render_set_base_context(context[0], set_depth);1.37 + render_set_tsp_context(context[0],context[1]);1.38 }1.40 static inline void gl_draw_vertexes( struct polygon_struct *poly )1.41 @@ -201,7 +199,7 @@1.42 } while( poly != NULL );1.43 }1.45 -static void gl_render_poly( struct polygon_struct *poly, GLint depth_mode )1.46 +static void gl_render_poly( struct polygon_struct *poly, gboolean set_depth)1.47 {1.48 if( poly->vertex_count == 0 )1.49 return; /* Culled */1.50 @@ -210,12 +208,12 @@1.51 glBindTexture(GL_TEXTURE_2D, poly->tex_id);1.52 }1.53 if( poly->mod_vertex_index == -1 ) {1.54 - render_set_context( poly->context, depth_mode );1.55 + render_set_context( poly->context, set_depth );1.56 gl_draw_vertexes(poly);1.57 } else {1.58 glEnable( GL_STENCIL_TEST );1.59 - render_set_base_context( poly->context[0], depth_mode );1.60 - render_set_tsp_context( poly->context[0], poly->context[1], poly->context[2] );1.61 + render_set_base_context( poly->context[0], set_depth );1.62 + render_set_tsp_context( poly->context[0], poly->context[1] );1.63 glStencilFunc(GL_EQUAL, 0, 2);1.64 gl_draw_vertexes(poly);1.66 @@ -223,7 +221,7 @@1.67 if( poly->mod_tex_id != -1 ) {1.68 glBindTexture(GL_TEXTURE_2D, poly->mod_tex_id);1.69 }1.70 - render_set_tsp_context( poly->context[0], poly->context[3], poly->context[4] );1.71 + render_set_tsp_context( poly->context[0], poly->context[3] );1.72 }1.73 glStencilFunc(GL_EQUAL, 2, 2);1.74 gl_draw_mod_vertexes(poly);1.75 @@ -236,14 +234,14 @@1.76 if( poly->tex_id != -1 ) {1.77 glBindTexture(GL_TEXTURE_2D, poly->tex_id);1.78 }1.79 - render_set_context( poly->context, 0 );1.80 + render_set_tsp_context( poly->context[0], poly->context[1] );1.81 glDisable( GL_DEPTH_TEST );1.82 glBlendFunc( GL_ONE, GL_ZERO );1.83 gl_draw_vertexes(poly);1.84 glEnable( GL_DEPTH_TEST );1.85 }1.87 -void gl_render_tilelist( pvraddr_t tile_entry, GLint depth_mode )1.88 +void gl_render_tilelist( pvraddr_t tile_entry, gboolean set_depth )1.89 {1.90 uint32_t *tile_list = (uint32_t *)(pvr2_main_ram+tile_entry);1.91 int strip_count;1.92 @@ -265,7 +263,7 @@1.93 poly = pvr2_scene.buf_to_poly_map[entry&0x000FFFFF];1.94 while( strip_count > 0 ) {1.95 assert( poly != NULL );1.96 - gl_render_poly( poly, depth_mode );1.97 + gl_render_poly( poly, set_depth );1.98 poly = poly->next;1.99 strip_count--;1.100 }1.101 @@ -273,7 +271,7 @@1.102 default:1.103 if( entry & 0x7E000000 ) {1.104 poly = pvr2_scene.buf_to_poly_map[entry&0x000FFFFF];1.105 - gl_render_poly( poly, depth_mode );1.106 + gl_render_poly( poly, set_depth );1.107 }1.108 }1.109 }1.110 @@ -306,7 +304,7 @@1.111 poly = pvr2_scene.buf_to_poly_map[entry&0x000FFFFF];1.112 while( strip_count > 0 ) {1.113 if( poly->vertex_count != 0 ) {1.114 - render_set_base_context(poly->context[0],0);1.115 + render_set_base_context(poly->context[0],TRUE);1.116 gl_draw_vertexes(poly);1.117 }1.118 poly = poly->next;1.119 @@ -317,7 +315,7 @@1.120 if( entry & 0x7E000000 ) {1.121 poly = pvr2_scene.buf_to_poly_map[entry&0x000FFFFF];1.122 if( poly->vertex_count != 0 ) {1.123 - render_set_base_context(poly->context[0],0);1.124 + render_set_base_context(poly->context[0],TRUE);1.125 gl_draw_vertexes(poly);1.126 }1.127 }1.128 @@ -530,17 +528,18 @@1.129 glClear( GL_DEPTH_BUFFER_BIT );1.130 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );1.131 }1.132 - gl_render_tilelist(segment->opaque_ptr,0);1.133 + gl_render_tilelist(segment->opaque_ptr,TRUE);1.134 if( IS_TILE_PTR(segment->punchout_ptr) ) {1.135 glEnable(GL_ALPHA_TEST );1.136 - gl_render_tilelist(segment->punchout_ptr, GL_GEQUAL );1.137 + glDepthFunc(GL_GEQUAL);1.138 + gl_render_tilelist(segment->punchout_ptr, FALSE );1.139 glDisable(GL_ALPHA_TEST );1.140 }1.142 if( IS_TILE_PTR(segment->trans_ptr) ) {1.143 if( pvr2_scene.sort_mode == SORT_NEVER ||1.144 (pvr2_scene.sort_mode == SORT_TILEFLAG && (segment->control&SEGMENT_SORT_TRANS))) {1.145 - gl_render_tilelist(segment->trans_ptr, 0);1.146 + gl_render_tilelist(segment->trans_ptr, TRUE);1.147 } else {1.148 render_autosort_tile(segment->trans_ptr, RENDER_NORMAL );1.149 }
.