diff options
Diffstat (limited to 'Source/Core/VideoCommon/TextureDecoder_Common.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureDecoder_Common.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/TextureDecoder_Common.cpp b/Source/Core/VideoCommon/TextureDecoder_Common.cpp index 5f8f314a0b..a37abe6e7e 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Common.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Common.cpp @@ -156,6 +156,58 @@ int TexDecoder_GetPaletteSize(int format) } } +// Get the "in memory" texture format of an EFB copy's format. +// With the exception of c4/c8/c14 paletted texture formats (which are handled elsewhere) +// this is the format the game should be using when it is drawing an EFB copy back. +int TexDecoder_GetEfbCopyBaseFormat(int format) +{ + switch (format) + { + case GX_TF_I4: + case GX_CTF_Z4: + case GX_CTF_R4: + return GX_TF_I4; + case GX_TF_I8: + case GX_CTF_A8: + case GX_CTF_R8: + case GX_CTF_G8: + case GX_CTF_B8: + case GX_TF_Z8: + case GX_CTF_Z8H: + case GX_CTF_Z8M: + case GX_CTF_Z8L: + return GX_TF_I8; + case GX_TF_IA4: + case GX_CTF_RA4: + return GX_TF_IA4; + case GX_TF_IA8: + case GX_TF_Z16: + case GX_CTF_RA8: + case GX_CTF_RG8: + case GX_CTF_GB8: + case GX_CTF_Z16R: + case GX_CTF_Z16L: + return GX_TF_IA8; + case GX_TF_RGB565: + return GX_TF_RGB565; + case GX_TF_RGB5A3: + return GX_TF_RGB5A3; + case GX_TF_RGBA8: + case GX_TF_Z24X8: + case GX_CTF_YUVA8: + return GX_TF_RGBA8; + // These formats can't be (directly) generated by EFB copies + case GX_TF_C4: + case GX_TF_C8: + case GX_TF_C14X2: + case GX_TF_CMPR: + default: + PanicAlert("Unsupported Texture Format (%08x)! (GetEfbCopyBaseFormat)", format); + return format & 0xf; + } +} + + void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center) { TexFmt_Overlay_Enable = enable; |
