engine/wii/video.c
/**
 * Copies and swizzles an image to texture memory.  Works for 32-bit (GX_TF_RGBA8)
 * texture format.  Textures are stored into tiles containing 4 rows of 8 bytes.
 * However, each tile is 64 bytes in size because each tile is divided across two
 * cache lines.  So each 4x4 tile is a 32-byte AR block followed by a 32-byte GB block.
 *
 * @param src the image
 */
Copies and swizzles an image to texture memory.  Works for 32-bit (GX_TF_RGBA8)
texture format.  Textures are stored into tiles containing 4 rows of 8 bytes.
However, each tile is 64 bytes in size because each tile is divided across two
cache lines.  So each 4x4 tile is a 32-byte AR block followed by a 32-byte GB block.

@param src the image
Copies and swizzles an image to texture memory . Works for 32 - bit ( GX_TF_RGBA8 ) texture format . Textures are stored into tiles containing 4 rows of 8 bytes . However each tile is 64 bytes in size because each tile is divided across two cache lines . So each 4x4 tile is a 32 - byte AR block followed by a 32 - byte GB block . @param src the image
void copyscreen32(s_screen* src)
{
	int x, y;
	u32* data = (u32*)src->data;
	u16* dest = (u16*)texturemem[whichtexture];
	s32 offset1 = textureWidth;
	s32 offset2 = textureWidth * 2;
	s32 offset3 = textureWidth * 3;
	for(y=0; y<textureHeight; y+=4)
	{
		for(x=0; x<textureWidth; x+=4)
		{
			memcpy32(dest, data);
			memcpy32(dest+4, data+offset1);
			memcpy32(dest+8, data+offset2);
			memcpy32(dest+12, data+offset3);
			data += 4;
			dest += 32;
		}
		data += textureWidth * 3; 
	}
}
void copyscreen32 ( s_screen * src ) { int x , y ; u32 * data = ( u32 * ) src -> data ; u16 * dest = ( u16 * ) texturemem [ whichtexture ] ; s32 offset1 = textureWidth ; s32 offset2 = textureWidth * 2 ; s32 offset3 = textureWidth * 3 ; for ( y = 0 ; y < textureHeight ; y += 4 ) { for ( x = 0 ; x < textureWidth ; x += 4 ) { memcpy32 ( dest , data ) ; memcpy32 ( dest + 4 , data + offset1 ) ; memcpy32 ( dest + 8 , data + offset2 ) ; memcpy32 ( dest + 12 , data + offset3 ) ; data += 4 ; dest += 32 ; } data += textureWidth * 3 ; } }
Copies and swizzles an image to texture memory.
Copies and swizzles an image to texture memory .
// RGBA8 textures in GX are stored in 4x4 tiles in two cache lines, AR and GB // we're already at the end of the first line