filename | src/pvr2/rendcore.c |
changeset | 221:cf5c6d326162 |
prev | 215:f432833e8303 |
next | 222:541d9d899aba |
author | nkeynes |
date | Tue Sep 12 08:38:38 2006 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Bug #0010 Move polygon macros to pvr2.h Implement background rendering more fully |
file | annotate | diff | log | raw |
1.1 --- a/src/pvr2/rendcore.c Fri Aug 18 12:43:24 2006 +00001.2 +++ b/src/pvr2/rendcore.c Tue Sep 12 08:38:38 2006 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: rendcore.c,v 1.3 2006-08-18 12:43:24 nkeynes Exp $1.6 + * $Id: rendcore.c,v 1.4 2006-09-12 08:38:38 nkeynes Exp $1.7 *1.8 * PVR2 renderer core.1.9 *1.10 @@ -19,41 +19,23 @@1.11 #include "pvr2/pvr2.h"1.12 #include "asic.h"1.14 -static int pvr2_poly_depthmode[8] = { GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL,1.15 +int pvr2_poly_depthmode[8] = { GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL,1.16 GL_GREATER, GL_NOTEQUAL, GL_GEQUAL,1.17 GL_ALWAYS };1.18 -static int pvr2_poly_srcblend[8] = {1.19 +int pvr2_poly_srcblend[8] = {1.20 GL_ZERO, GL_ONE, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR,1.21 GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA,1.22 GL_ONE_MINUS_DST_ALPHA };1.23 -static int pvr2_poly_dstblend[8] = {1.24 +int pvr2_poly_dstblend[8] = {1.25 GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,1.26 GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA,1.27 GL_ONE_MINUS_DST_ALPHA };1.28 -static int pvr2_poly_texblend[4] = {1.29 +int pvr2_poly_texblend[4] = {1.30 GL_REPLACE, GL_BLEND, GL_DECAL, GL_MODULATE };1.31 -static int pvr2_render_colour_format[8] = {1.32 +int pvr2_render_colour_format[8] = {1.33 COLFMT_ARGB1555, COLFMT_RGB565, COLFMT_ARGB4444, COLFMT_ARGB1555,1.34 COLFMT_RGB888, COLFMT_ARGB8888, COLFMT_ARGB8888, COLFMT_ARGB4444 };1.35 -#define POLY1_DEPTH_MODE(poly1) ( pvr2_poly_depthmode[(poly1)>>29] )1.36 -#define POLY1_DEPTH_ENABLE(poly1) (((poly1)&0x04000000) == 0 )1.37 -#define POLY1_CULL_MODE(poly1) (((poly1)>>27)&0x03)1.38 -#define POLY1_TEXTURED(poly1) (((poly1)&0x02000000))1.39 -#define POLY1_SPECULAR(poly1) (((poly1)&0x01000000))1.40 -#define POLY1_SHADE_MODEL(poly1) (((poly1)&0x00800000) ? GL_SMOOTH : GL_FLAT)1.41 -#define POLY1_UV16(poly1) (((poly1)&0x00400000))1.42 -#define POLY1_SINGLE_TILE(poly1) (((poly1)&0x00200000))1.44 -#define POLY2_SRC_BLEND(poly2) ( pvr2_poly_srcblend[(poly2) >> 29] )1.45 -#define POLY2_DEST_BLEND(poly2) ( pvr2_poly_dstblend[((poly2)>>26)&0x07] )1.46 -#define POLY2_SRC_BLEND_ENABLE(poly2) ((poly2)&0x02000000)1.47 -#define POLY2_DEST_BLEND_ENABLE(poly2) ((poly2)&0x01000000)1.48 -#define POLY2_COLOUR_CLAMP_ENABLE(poly2) ((poly2)&0x00200000)1.49 -#define POLY2_ALPHA_ENABLE(poly2) ((poly2)&0x001000000)1.50 -#define POLY2_TEX_ALPHA_ENABLE(poly2) (((poly2)&0x00080000) == 0 )1.51 -#define POLY2_TEX_WIDTH(poly2) ( 1<< ((((poly2) >> 3) & 0x07 ) + 3) )1.52 -#define POLY2_TEX_HEIGHT(poly2) ( 1<< (((poly2) & 0x07 ) + 3) )1.53 -#define POLY2_TEX_BLEND(poly2) ( pvr2_poly_texblend[((poly2) >> 6)&0x03] )1.55 #define RENDER_ZONLY 01.56 #define RENDER_NORMAL 1 /* Render non-modified polygons */1.57 @@ -153,7 +135,9 @@1.59 glShadeModel( POLY1_SHADE_MODEL(poly1) );1.61 - glBlendFunc( POLY2_SRC_BLEND(poly2), POLY2_DEST_BLEND(poly2) );1.62 + int srcblend = POLY2_SRC_BLEND(poly2);1.63 + int destblend = POLY2_DEST_BLEND(poly2);1.64 + glBlendFunc( srcblend, destblend );1.65 if( POLY2_TEX_ALPHA_ENABLE(poly2) ) {1.66 glEnable(GL_BLEND);1.67 } else {1.68 @@ -297,6 +281,7 @@1.69 fprintf( stderr, "Start render at %d.%d\n", tv_start.tv_sec, tv_start.tv_usec );1.70 glEnable( GL_SCISSOR_TEST );1.71 while( (segment->control & SEGMENT_END) == 0 ) {1.72 + // fwrite_dump32v( (uint32_t *)segment, sizeof(struct tile_segment), 6, stderr );1.73 int tilex = SEGMENT_X(segment->control);1.74 int tiley = SEGMENT_Y(segment->control);
.