Search
lxdream.org :: lxdream :: r1221:f50407acc682
lxdream 0.9.1
released Jun 29
Download Now
changeset1221:f50407acc682
parent1220:34e696c3a56f
child1222:a4545699a82b
authornkeynes
dateMon Feb 13 22:16:43 2012 +1000 (7 years ago)
Make palette textures 2D (1 pixel high) instead of 1D - pretty much the
same, but some systems don't support 1D textures
src/pvr2/shaders.glsl
src/pvr2/texcache.c
1.1 --- a/src/pvr2/shaders.glsl Mon Feb 13 21:52:55 2012 +1000
1.2 +++ b/src/pvr2/shaders.glsl Mon Feb 13 22:16:43 2012 +1000
1.3 @@ -80,13 +80,13 @@
1.4 #fragment DEFAULT_FRAGMENT_SHADER
1.5
1.6 uniform sampler2D primary_texture;
1.7 -uniform sampler1D palette_texture;
1.8 +uniform sampler2D palette_texture;
1.9
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 +1000
2.2 +++ b/src/pvr2/texcache.c Mon Feb 13 22:16:43 2012 +1000
2.3 @@ -101,10 +101,10 @@
2.4
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.16
2.17 } else {
2.18 @@ -290,14 +290,10 @@
2.19 }
2.20
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 else
2.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_RESIDENT
2.50 + (glAreTexturesResident(1, &texcache_active_list[slot].texture_id, &boolresult) ? "[RESIDENT]" : "[NOT RESIDENT]")
2.51 +#else
2.52 + ""
2.53 +#endif
2.54 + );
2.55 slot = texcache_active_list[slot].next;
2.56 }
2.57 }
.