revision 1221:f50407acc682
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 1221:f50407acc682 |
parent | 1220:34e696c3a56f |
child | 1222:a4545699a82b |
author | nkeynes |
date | Mon Feb 13 22:16:43 2012 +1000 (12 years ago) |
Make palette textures 2D (1 pixel high) instead of 1D - pretty much the
same, but some systems don't support 1D textures
same, but some systems don't support 1D textures
1.1 --- a/src/pvr2/shaders.glsl Mon Feb 13 21:52:55 2012 +10001.2 +++ b/src/pvr2/shaders.glsl Mon Feb 13 22:16:43 2012 +10001.3 @@ -80,13 +80,13 @@1.4 #fragment DEFAULT_FRAGMENT_SHADER1.6 uniform sampler2D primary_texture;1.7 -uniform sampler1D palette_texture;1.8 +uniform sampler2D palette_texture;1.10 void main()1.11 {1.12 vec4 tex = texture2D( primary_texture, gl_TexCoord[0].xy );1.13 if( gl_TexCoord[0].z >= 0.0 ) {1.14 - tex = texture1D( palette_texture, gl_TexCoord[0].z + (tex.a*0.249023) );1.15 + tex = texture2D( palette_texture, vec2(gl_TexCoord[0].z + (tex.a*0.249023),0.5) );1.16 }1.17 /* HACK: unfortunately we have to maintain compatibility with GLSL 1.20,1.18 * which only supports varying float. So since we're propagating texcoord
2.1 --- a/src/pvr2/texcache.c Mon Feb 13 21:52:55 2012 +10002.2 +++ b/src/pvr2/texcache.c Mon Feb 13 22:16:43 2012 +10002.3 @@ -101,10 +101,10 @@2.5 /* Bind the texture and set the params */2.6 glActiveTexture(GL_TEXTURE1);2.7 - glBindTexture(GL_TEXTURE_1D, texcache_palette_texid);2.8 - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);2.9 - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);2.10 - glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP );2.11 + glBindTexture(GL_TEXTURE_2D, texcache_palette_texid);2.12 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);2.13 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);2.14 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );2.15 glActiveTexture(GL_TEXTURE0);2.17 } else {2.18 @@ -290,14 +290,10 @@2.19 }2.21 glActiveTexture(GL_TEXTURE1);2.22 -// glBindTexture(GL_TEXTURE_1D, texcache_palette_texid);2.23 if( format_changed )2.24 - glTexImage1D(GL_TEXTURE_1D, 0, intFormat, 1024, 0, format, type, data );2.25 + glTexImage2D(GL_TEXTURE_2D, 0, intFormat, 1024, 1, 0, format, type, data );2.26 else2.27 - glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 1024, format, type, data);2.28 -// glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);2.29 -// glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);2.30 -// glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP );2.31 + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1024, 1, format, type, data);2.32 glActiveTexture(GL_TEXTURE0);2.33 texcache_palette_valid = TRUE;2.34 }2.35 @@ -510,7 +506,7 @@2.36 case PVR2_TEX_FORMAT_IDX4:2.37 case PVR2_TEX_FORMAT_IDX8:2.38 if( texcache_have_palette_shader ) {2.39 - intFormat = GL_ALPHA8;2.40 + intFormat = GL_ALPHA;2.41 format = GL_ALPHA;2.42 type = GL_UNSIGNED_BYTE;2.43 bpp_shift = 0;2.44 @@ -895,7 +891,12 @@2.45 POLY2_TEX_HEIGHT(texcache_active_list[slot].poly2_mode),2.46 texcache_active_list[slot].poly2_mode,2.47 texcache_active_list[slot].tex_mode,2.48 - (glAreTexturesResident(1, &texcache_active_list[slot].texture_id, &boolresult) ? "[RESIDENT]" : "[NOT RESIDENT]") );2.49 +#ifdef HAVE_OPENGL_TEX_RESIDENT2.50 + (glAreTexturesResident(1, &texcache_active_list[slot].texture_id, &boolresult) ? "[RESIDENT]" : "[NOT RESIDENT]")2.51 +#else2.52 + ""2.53 +#endif2.54 + );2.55 slot = texcache_active_list[slot].next;2.56 }2.57 }
.