mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 04:51:05 +00:00
Added HILO8 support.
Signed-off-by: Patrick Martin <thehairyrock@gmail.com>
This commit is contained in:
parent
7d21b0663b
commit
b3df840ee8
@ -69,6 +69,16 @@ inline const Math::Vec4<u8> DecodeRGB8(const u8* bytes) {
|
|||||||
return { bytes[2], bytes[1], bytes[0], 255 };
|
return { bytes[2], bytes[1], bytes[0], 255 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode a color stored in HILO8 format
|
||||||
|
* @remark HILO8 is not intended to store colors, the word color here is used just for consistency, HILO8 is a format intended for normal maps.
|
||||||
|
* @param bytes Pointer to encoded source color
|
||||||
|
* @return Result color decoded as Math::Vec4<u8>
|
||||||
|
*/
|
||||||
|
inline const Math::Vec4<u8> DecodeHILO8(const u8* bytes) {
|
||||||
|
return { bytes[0], bytes[1], 0, 255 };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode a color stored in RGB565 format
|
* Decode a color stored in RGB565 format
|
||||||
* @param bytes Pointer to encoded source color
|
* @param bytes Pointer to encoded source color
|
||||||
@ -152,6 +162,16 @@ inline void EncodeRGB8(const Math::Vec4<u8>& color, u8* bytes) {
|
|||||||
bytes[0] = color.b();
|
bytes[0] = color.b();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode a color as HILO8 format
|
||||||
|
* @remark HILO8 is not intended to store colors, the word color here is used just for consistency, HILO8 is a format intended for normal maps.
|
||||||
|
* @param color Source color to encode
|
||||||
|
* @param bytes Destination pointer to store encoded color
|
||||||
|
*/
|
||||||
|
inline void EncodeHILO8(const Math::Vec4<u8>& color, u8* bytes) {
|
||||||
|
bytes[0] = color.r();
|
||||||
|
bytes[1] = color.g();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Encode a color as RGB565 format
|
* Encode a color as RGB565 format
|
||||||
* @param color Source color to encode
|
* @param color Source color to encode
|
||||||
|
@ -361,6 +361,12 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Regs::TextureFormat::HILO8:
|
||||||
|
{
|
||||||
|
auto res = Color::DecodeHILO8(source + VideoCore::GetMortonOffset(x, y, 2));
|
||||||
|
return { res.r(), res.g(), 0, 255 };
|
||||||
|
}
|
||||||
|
|
||||||
case Regs::TextureFormat::I8:
|
case Regs::TextureFormat::I8:
|
||||||
{
|
{
|
||||||
const u8* source_ptr = source + VideoCore::GetMortonOffset(x, y, 1);
|
const u8* source_ptr = source + VideoCore::GetMortonOffset(x, y, 1);
|
||||||
|
@ -152,7 +152,7 @@ struct Regs {
|
|||||||
RGB565 = 3,
|
RGB565 = 3,
|
||||||
RGBA4 = 4,
|
RGBA4 = 4,
|
||||||
IA8 = 5,
|
IA8 = 5,
|
||||||
|
HILO8 = 6,
|
||||||
I8 = 7,
|
I8 = 7,
|
||||||
A8 = 8,
|
A8 = 8,
|
||||||
IA4 = 9,
|
IA4 = 9,
|
||||||
@ -174,6 +174,7 @@ struct Regs {
|
|||||||
case TextureFormat::RGB565:
|
case TextureFormat::RGB565:
|
||||||
case TextureFormat::RGBA4:
|
case TextureFormat::RGBA4:
|
||||||
case TextureFormat::IA8:
|
case TextureFormat::IA8:
|
||||||
|
case TextureFormat::HILO8:
|
||||||
return 4;
|
return 4;
|
||||||
|
|
||||||
case TextureFormat::A4:
|
case TextureFormat::A4:
|
||||||
|
Loading…
Reference in New Issue
Block a user