From c31d6dadcbe8d6131b90ea30b756553d8ee5ae6e Mon Sep 17 00:00:00 2001 From: Ahmad Abdallah <50462420+Ahmad8864@users.noreply.github.com> Date: Thu, 4 Jun 2026 23:02:59 -0700 Subject: [PATCH] Implement GX_TF_C14X2 conversion (#222) --- lib/gfx/texture_convert.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/gfx/texture_convert.cpp b/lib/gfx/texture_convert.cpp index 199806b..d1ed04c 100644 --- a/lib/gfx/texture_convert.cpp +++ b/lib/gfx/texture_convert.cpp @@ -315,6 +315,17 @@ struct TextureDecoderC8 { static void decode_texel(Target* target, const Source* in, const uint32_t x) { target[x] = in[x]; } }; +struct TextureDecoderC14X2 { + using Source = uint16_t; + using Target = uint16_t; + + static constexpr uint32_t Frac = 1; + static constexpr uint32_t BlockWidth = 4; + static constexpr uint32_t BlockHeight = 4; + + static void decode_texel(Target* target, const Source* in, const uint32_t x) { target[x] = bswap(in[x]) & 0x3fff; } +}; + struct TextureDecoderRGB565 { using Source = uint16_t; using Target = RGBA8; @@ -603,7 +614,8 @@ ConvertedTexture convert_texture(u32 format, uint32_t width, uint32_t height, ui converted = DecodeTiled(width, height, mips, data); break; case GX_TF_C14X2: - FATAL("convert_texture: C14X2 unimplemented"); + converted = DecodeTiled(width, height, mips, data); + break; case GX_TF_RGB565: converted = DecodeTiled(width, height, mips, data); break;