mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
parent
9fa6777c3e
commit
36c8b043f3
@ -204,6 +204,17 @@ inline void DeIndexTexture4Optimal<u16>(u16 *dest, const u8 *indexed, int length
|
||||
}
|
||||
}
|
||||
|
||||
inline void DeIndexTexture4OptimalRev(u16 *dest, const u8 *indexed, int length, u16 color) {
|
||||
const u16_le *indexed16 = (const u16_le *)indexed;
|
||||
const u32 color32 = (color << 16) | color;
|
||||
u32 *dest32 = (u32 *)dest;
|
||||
for (int i = 0; i < length / 2; i += 2) {
|
||||
u16 index = *indexed16++;
|
||||
dest32[i + 0] = color32 | ((index & 0x00f0) << 24) | ((index & 0x000f) << 12);
|
||||
dest32[i + 1] = color32 | ((index & 0xf000) << 16) | ((index & 0x0f00) << 4);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename ClutT>
|
||||
inline void DeIndexTexture4(ClutT *dest, const u32 texaddr, int length, const ClutT *clut) {
|
||||
const u8 *indexed = (const u8 *) Memory::GetPointer(texaddr);
|
||||
|
@ -1451,7 +1451,7 @@ void *TextureCacheDX9::DecodeTextureLevel(GETextureFormat format, GEPaletteForma
|
||||
texByteAlign = 2;
|
||||
if (!swizzled) {
|
||||
if (clutAlphaLinear_ && mipmapShareClut) {
|
||||
DeIndexTexture4Optimal(tmpTexBuf16.data(), texptr, bufw * h, clutAlphaLinearColor_);
|
||||
DeIndexTexture4OptimalRev(tmpTexBuf16.data(), texptr, bufw * h, clutAlphaLinearColor_);
|
||||
} else {
|
||||
DeIndexTexture4(tmpTexBuf16.data(), texptr, bufw * h, clut);
|
||||
}
|
||||
@ -1459,7 +1459,7 @@ void *TextureCacheDX9::DecodeTextureLevel(GETextureFormat format, GEPaletteForma
|
||||
tmpTexBuf32.resize(std::max(bufw, w) * h);
|
||||
UnswizzleFromMem(texptr, bufw, h, 0);
|
||||
if (clutAlphaLinear_ && mipmapShareClut) {
|
||||
DeIndexTexture4Optimal(tmpTexBuf16.data(), (const u8 *)tmpTexBuf32.data(), bufw * h, clutAlphaLinearColor_);
|
||||
DeIndexTexture4OptimalRev(tmpTexBuf16.data(), (const u8 *)tmpTexBuf32.data(), bufw * h, clutAlphaLinearColor_);
|
||||
} else {
|
||||
DeIndexTexture4(tmpTexBuf16.data(), (const u8 *)tmpTexBuf32.data(), bufw * h, clut);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user