Search
lxdream.org :: lxdream :: r1219:3966d3e55351
lxdream 0.9.1
released Jun 29
Download Now
changeset1219:3966d3e55351
parent1218:be02e87f9f87
child1220:34e696c3a56f
authornkeynes
dateMon Feb 13 21:43:22 2012 +1000 (7 years ago)
Remove unused pvr2_poly_texblend array
Support GL_MAX_TEXTURE_UNITS and GL_MAX_IMAGE_TEXTURE_UNITS
Protected against undefined GL_STACK_OVERFLOW
src/pvr2/glrender.c
src/pvr2/glutil.c
src/pvr2/glutil.h
src/pvr2/pvr2.h
1.1 --- a/src/pvr2/glrender.c Mon Feb 13 21:02:42 2012 +1000
1.2 +++ b/src/pvr2/glrender.c Mon Feb 13 21:43:22 2012 +1000
1.3 @@ -46,12 +46,6 @@
1.4 GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
1.5 GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA,
1.6 GL_ONE_MINUS_DST_ALPHA };
1.7 -int pvr2_poly_texblend[4] = {
1.8 - GL_REPLACE,
1.9 - GL_MODULATE,
1.10 - GL_DECAL,
1.11 - GL_MODULATE
1.12 -};
1.13
1.14 static gboolean have_shaders = FALSE;
1.15 static int currentTexId = -1;
1.16 @@ -188,13 +182,15 @@
1.17 {
1.18 glShadeModel( POLY1_SHADE_MODEL(poly1) );
1.19
1.20 - if( POLY1_TEXTURED(poly1) && !have_shaders ) {
1.21 - if( POLY2_TEX_BLEND(poly2) == 2 )
1.22 - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
1.23 - else
1.24 - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1.25 + if( !have_shaders ) {
1.26 + if( POLY1_TEXTURED(poly1) ) {
1.27 + if( POLY2_TEX_BLEND(poly2) == 2 )
1.28 + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
1.29 + else
1.30 + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1.31
1.32 - }
1.33 + }
1.34 + }
1.35
1.36 switch( POLY2_FOG_MODE(poly2) ) {
1.37 case PVR2_POLY_FOG_LOOKUP:
2.1 --- a/src/pvr2/glutil.c Mon Feb 13 21:02:42 2012 +1000
2.2 +++ b/src/pvr2/glutil.c Mon Feb 13 21:43:22 2012 +1000
2.3 @@ -49,7 +49,12 @@
2.4 if( !isGLExtensionSupported("GL_ARB_multitexture") )
2.5 return FALSE;
2.6 int units = 0;
2.7 - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &units);
2.8 +
2.9 +#if defined(GL_MAX_TEXTURE_UNITS)
2.10 + glGetIntegerv(GL_MAX_TEXTURE_UNITS, &units);
2.11 +#elif defined(GL_MAX_TEXTURE_IMAGE_UNITS)
2.12 + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &units);
2.13 +#endif
2.14 return units >= 2;
2.15 }
2.16
2.17 @@ -177,7 +182,9 @@
2.18 case GL_INVALID_ENUM: s = "Invalid enum"; break;
2.19 case GL_INVALID_VALUE: s = "Invalid value"; break;
2.20 case GL_INVALID_OPERATION: s = "Invalid operation"; break;
2.21 +#ifdef GL_STACK_OVERFLOW
2.22 case GL_STACK_OVERFLOW: s = "Stack overflow"; break;
2.23 +#endif GL_STACK_OVERFLOW
2.24 case GL_STACK_UNDERFLOW: s = "Stack underflow"; break;
2.25 case GL_OUT_OF_MEMORY: s = "Out of memory"; break;
2.26 default: s = "Unknown error"; break;
3.1 --- a/src/pvr2/glutil.h Mon Feb 13 21:02:42 2012 +1000
3.2 +++ b/src/pvr2/glutil.h Mon Feb 13 21:43:22 2012 +1000
3.3 @@ -61,6 +61,10 @@
3.4 #define GL_MIRRORED_REPEAT GL_MIRRORED_REPEAT_ARB
3.5 #endif
3.6
3.7 +#if defined(GL_MAX_TEXTURE_UNITS_ARB) && !defined(GL_MAX_TEXTURE_UNITS)
3.8 +#define GL_MAX_TEXTURE_UNITS GL_MAX_TEXTURE_UNITS_ARB
3.9 +#endif
3.10 +
3.11 #if defined(GL_FRAMEBUFFER_EXT) && !defined(GL_FRAMEBUFFER)
3.12 #define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
3.13 #endif
4.1 --- a/src/pvr2/pvr2.h Mon Feb 13 21:02:42 2012 +1000
4.2 +++ b/src/pvr2/pvr2.h Mon Feb 13 21:43:22 2012 +1000
4.3 @@ -403,7 +403,6 @@
4.4 extern int pvr2_poly_depthmode[8];
4.5 extern int pvr2_poly_srcblend[8];
4.6 extern int pvr2_poly_dstblend[8];
4.7 -extern int pvr2_poly_texblend[4];
4.8 extern int pvr2_render_colour_format[8];
4.9
4.10 #define CULL_NONE 0
.