1.1 --- a/src/pvr2/texcache.c Mon Jan 22 21:26:39 2007 +0000
1.2 +++ b/src/pvr2/texcache.c Tue Jan 23 08:18:05 2007 +0000
1.5 - * $Id: texcache.c,v 1.16 2007-01-22 21:26:39 nkeynes Exp $
1.6 + * $Id: texcache.c,v 1.17 2007-01-23 08:18:05 nkeynes Exp $
1.8 * Texture cache. Responsible for maintaining a working set of OpenGL
1.11 uint8_t *c = (uint8_t *)input;
1.12 for( j=0; j<height; j+=2 ) {
1.13 for( i=0; i<width; i+=2 ) {
1.14 - uint8_t code = *c;
1.15 + uint8_t code = *c++;
1.16 output[i + j*width] = codebook->quad[code][0];
1.17 output[i + 1 + j*width] = codebook->quad[code][1];
1.18 output[i + (j+1)*width] = codebook->quad[code][2];
1.21 for( i=0; 1<<i < width; i++ );
1.27 filter = GL_LINEAR_MIPMAP_LINEAR;
1.29 mip_bytes = (mip_width * mip_height) << bpp_shift;
1.30 @@ -396,12 +396,13 @@
1.31 int inputlength = ((mip_width*mip_height)<<1);
1.32 char tmp[inputlength];
1.33 pvr2_vram64_read( tmp, texture_addr, inputlength );
1.34 + ERROR( "Twiddled YUV not supported" );
1.35 yuv_decode( (uint32_t *)data, (uint32_t *)tmp, mip_width, mip_height );
1.36 } else if( PVR2_TEX_IS_COMPRESSED(mode) ) {
1.37 int inputlength = ((mip_width*mip_height) >> 2);
1.38 char tmp[inputlength];
1.39 if( PVR2_TEX_IS_TWIDDLED(mode) ) {
1.40 - pvr2_vram64_read_twiddled_8( tmp, texture_addr, mip_width, mip_height );
1.41 + pvr2_vram64_read_twiddled_8( tmp, texture_addr, mip_width>>1, mip_height>>1 );
1.43 pvr2_vram64_read( tmp, texture_addr, inputlength );
1.45 @@ -411,14 +412,19 @@
1.47 pvr2_vram64_read( data, texture_addr, mip_bytes );
1.52 - glTexImage2D( GL_TEXTURE_2D, level, intFormat, mip_width, mip_height, 0, format, type,
1.54 - texture_addr += mip_bytes;
1.58 + if( level == last_level && level != 0 ) { /* 1x1 stored within a 2x2 */
1.59 + glTexImage2D( GL_TEXTURE_2D, level, intFormat, 1, 1, 0, format, type,
1.60 + data + (3 << bpp_shift) );
1.62 + glTexImage2D( GL_TEXTURE_2D, level, intFormat, mip_width, mip_height, 0, format, type,
1.64 + texture_addr += mip_bytes;
1.71 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);