1.1 --- a/src/pvr2/texcache.c Thu Mar 16 12:42:39 2006 +0000
1.2 +++ b/src/pvr2/texcache.c Thu Mar 23 13:18:51 2006 +0000
1.5 - * $Id: texcache.c,v 1.4 2006-03-16 12:42:39 nkeynes Exp $
1.6 + * $Id: texcache.c,v 1.5 2006-03-23 13:18:51 nkeynes Exp $
1.8 * Texture cache. Responsible for maintaining a working set of OpenGL
1.10 @@ -193,6 +193,20 @@
1.14 +static void detwiddle_16_to_16(int x1, int y1, int size, int totsize,
1.15 + uint16_t **in, uint16_t *out ) {
1.17 + out[y1 * totsize + x1] = **in;
1.21 + detwiddle_16_to_16(x1, y1, ns, totsize, in, out);
1.22 + detwiddle_16_to_16(x1, y1+ns, ns, totsize, in, out);
1.23 + detwiddle_16_to_16(x1+ns, y1, ns, totsize, in, out);
1.24 + detwiddle_16_to_16(x1+ns, y1+ns, ns, totsize, in, out);
1.30 * Load texture data from the given address and parameters into the currently
1.33 ((uint16_t *)data)[i] = ((uint16_t *)palette)[ch];
1.37 - /* TODO: Detwiddle */
1.38 glTexImage2D( GL_TEXTURE_2D, 0, intFormat, width, height, 0, format, type,
1.42 case PVR2_TEX_FORMAT_ARGB4444:
1.44 intFormat = GL_RGBA4;
1.46 - type = GL_UNSIGNED_SHORT_4_4_4_4;
1.48 + type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
1.50 case PVR2_TEX_FORMAT_YUV422:
1.51 ERROR( "YUV textures not supported" );
1.52 @@ -301,9 +315,14 @@
1.53 if( PVR2_TEX_IS_COMPRESSED(mode) ) {
1.54 ERROR( "VQ Compression not supported" );
1.56 - pvr2_vram64_read( &data, texture_addr, bytes );
1.57 if( PVR2_TEX_IS_TWIDDLED(mode) ) {
1.59 + uint16_t *p = (uint16_t *)tmp;
1.60 + pvr2_vram64_read( tmp, texture_addr, bytes );
1.62 + detwiddle_16_to_16( 0, 0, width, width, &p, (uint16_t *)&data );
1.64 + pvr2_vram64_read( data, texture_addr, bytes );