mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Video_Software: Implement proper RGBA8 texture loading from tmem.
For RGBA8 textures, AR and GB tiles are stored in separate tmem banks. TextureDecoder did not support that previously.
This commit is contained in:
@ -2515,6 +2515,28 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
||||
}
|
||||
}
|
||||
|
||||
void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth)
|
||||
{
|
||||
u16 sBlk = s >> 2;
|
||||
u16 tBlk = t >> 2;
|
||||
u16 widthBlks = (imageWidth >> 2) + 1;
|
||||
u32 base_ar = (tBlk * widthBlks + sBlk) << 4;
|
||||
u32 base_gb = (tBlk * widthBlks + sBlk) << 4;
|
||||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
u32 blk_off = (blkT << 2) + blkS;
|
||||
|
||||
u32 offset_ar = (base_ar + blk_off) << 1;
|
||||
u32 offset_gb = (base_gb + blk_off) << 1;
|
||||
const u8* val_addr_ar = src_ar + offset_ar;
|
||||
const u8* val_addr_gb = src_gb + offset_gb;
|
||||
|
||||
dst[3] = val_addr_ar[0]; // A
|
||||
dst[0] = val_addr_ar[1]; // R
|
||||
dst[1] = val_addr_gb[0]; // G
|
||||
dst[2] = val_addr_gb[1]; // B
|
||||
}
|
||||
|
||||
|
||||
const char* texfmt[] = {
|
||||
// pixel
|
||||
|
@ -86,6 +86,7 @@ enum PC_TexFormat
|
||||
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt,bool rgbaOnly = false);
|
||||
PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt);
|
||||
void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, int tlutaddr, int tlutfmt);
|
||||
void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth);
|
||||
void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user