diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-08-10 15:04:29 -0400 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-09-04 18:36:56 -0700 |
| commit | fcd4ecc94265cc95bf939e517f378447c47df703 (patch) | |
| tree | 58453af5f57e78d37d8a792a1fa1c3155524667d /Source/Core/VideoCommon/TextureDecoder_Generic.cpp | |
| parent | 32da01edec04f2fdedb8270cf260d0ae61dac4d7 (diff) | |
TextureDecoder: Add an enum for the TLUT formats
Quick code cleanup. The enum names and values come from libogc.
Diffstat (limited to 'Source/Core/VideoCommon/TextureDecoder_Generic.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureDecoder_Generic.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp index 3808483742..3dff970afa 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp @@ -246,7 +246,7 @@ static void decodeDXTBlockRGBA(u32 *dst, const DXTBlock *src, int pitch) // TODO: complete SSE2 optimization of less often used texture formats. // TODO: refactor algorithms using _mm_loadl_epi64 unaligned loads to prefer 128-bit aligned loads. -PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int height, int texformat, int tlutaddr, int tlutfmt) +PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int height, int texformat, int tlutaddr, TlutFormat tlutfmt) { const int Wsteps4 = (width + 3) / 4; @@ -255,7 +255,7 @@ PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int he switch (texformat) { case GX_TF_C4: - if (tlutfmt == 2) + if (tlutfmt == GX_TL_RGB5A3) { // Special decoding is required for TLUT format 5A3 for (int y = 0; y < height; y += 8) @@ -263,14 +263,14 @@ PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int he for (int iy = 0, xStep = 8 * yStep; iy < 8; iy++,xStep++) decodebytesC4_5A3_To_rgba32(dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr); } - else if (tlutfmt == 0) + else if (tlutfmt == GX_TL_IA8) { for (int y = 0; y < height; y += 8) for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8,yStep++) for (int iy = 0, xStep = 8 * yStep; iy < 8; iy++,xStep++) decodebytesC4IA8_To_RGBA(dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr); } - else + else if (tlutfmt == GX_TL_RGB565) { for (int y = 0; y < height; y += 8) for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8,yStep++) @@ -317,7 +317,7 @@ PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int he } break; case GX_TF_C8: - if (tlutfmt == 2) + if (tlutfmt == GX_TL_RGB5A3) { // Special decoding is required for TLUT format 5A3 for (int y = 0; y < height; y += 4) @@ -325,14 +325,14 @@ PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int he for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++) decodebytesC8_5A3_To_RGBA32((u32*)dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr); } - else if (tlutfmt == 0) + else if (tlutfmt == GX_TL_IA8) { for (int y = 0; y < height; y += 4) for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++) for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++) decodebytesC8IA8_To_RGBA(dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr); } - else + else if (tlutfmt == GX_TL_RGB565) { for (int y = 0; y < height; y += 4) for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++) @@ -366,7 +366,7 @@ PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int he } break; case GX_TF_C14X2: - if (tlutfmt == 2) + if (tlutfmt == GX_TL_RGB5A3) { // Special decoding is required for TLUT format 5A3 for (int y = 0; y < height; y += 4) @@ -374,14 +374,14 @@ PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int he for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++) decodebytesC14X2_5A3_To_RGBA(dst + (y + iy) * width + x, (u16*)(src + 8 * xStep), tlutaddr); } - else if (tlutfmt == 0) + else if (tlutfmt == GX_TL_IA8) { for (int y = 0; y < height; y += 4) for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++) for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++) decodebytesC14X2IA8_To_RGBA(dst + (y + iy) * width + x, (u16*)(src + 8 * xStep), tlutaddr); } - else + else if (tlutfmt == GX_TL_RGB565) { for (int y = 0; y < height; y += 4) for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++) |
