mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-01-08 08:00:44 +01:00
properly implement ABGR4 decoder
This commit is contained in:
parent
2fb4d83a5f
commit
6ba6157bae
@ -594,7 +594,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextureDecoder_R4_G4_UNORM_To_RGBA4_vk : public TextureDecoder, public SingletonClass<TextureDecoder_R4_G4_UNORM_To_RGBA4_vk>
|
class TextureDecoder_R4_G4_UNORM_To_ABGR4 : public TextureDecoder, public SingletonClass<TextureDecoder_R4_G4_UNORM_To_ABGR4>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
sint32 getBytesPerTexel(LatteTextureLoaderCtx* textureLoader) override
|
sint32 getBytesPerTexel(LatteTextureLoaderCtx* textureLoader) override
|
||||||
@ -632,47 +632,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextureDecoder_R4_G4_UNORM_To_ABGR4 : public TextureDecoder, public SingletonClass<TextureDecoder_R4_G4_UNORM_To_ABGR4>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
sint32 getBytesPerTexel(LatteTextureLoaderCtx* textureLoader) override
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void decode(LatteTextureLoaderCtx* textureLoader, uint8* outputData) override
|
|
||||||
{
|
|
||||||
for (sint32 y = 0; y < textureLoader->height; y += textureLoader->stepY)
|
|
||||||
{
|
|
||||||
sint32 yc = y;
|
|
||||||
for (sint32 x = 0; x < textureLoader->width; x += textureLoader->stepX)
|
|
||||||
{
|
|
||||||
uint8* blockData = LatteTextureLoader_GetInput(textureLoader, x, y);
|
|
||||||
sint32 pixelOffset = (x + yc * textureLoader->width) * 2;
|
|
||||||
uint8 v = (*(uint8*)(blockData + 0));
|
|
||||||
uint8 c0 = (v & 0xF);
|
|
||||||
uint8 c1 = (v >> 4) & 0xF;
|
|
||||||
v = (c0 << 4) | c1;
|
|
||||||
*(uint8*)(outputData + pixelOffset + 0) = v;
|
|
||||||
*(uint8*)(outputData + pixelOffset + 1) = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void decodePixelToRGBA(uint8* blockData, uint8* outputPixel, uint8 blockOffsetX, uint8 blockOffsetY) override
|
|
||||||
{
|
|
||||||
uint8 v0 = *(blockData + 0);
|
|
||||||
uint8 c0 = (v0 & 0xF);
|
|
||||||
uint8 c1 = (v0 >> 4) & 0xF;
|
|
||||||
c0 = (c0 << 4) | c0;
|
|
||||||
c1 = (c1 << 4) | c1;
|
|
||||||
*(outputPixel + 0) = c0;
|
|
||||||
*(outputPixel + 1) = c1;
|
|
||||||
*(outputPixel + 2) = 0;
|
|
||||||
*(outputPixel + 3) = 255;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class TextureDecoder_R4G4_UNORM_To_RGBA8 : public TextureDecoder, public SingletonClass<TextureDecoder_R4G4_UNORM_To_RGBA8>
|
class TextureDecoder_R4G4_UNORM_To_RGBA8 : public TextureDecoder, public SingletonClass<TextureDecoder_R4G4_UNORM_To_RGBA8>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -2283,7 +2283,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
formatInfoOut->vkImageFormat = VK_FORMAT_R4G4B4A4_UNORM_PACK16;
|
formatInfoOut->vkImageFormat = VK_FORMAT_R4G4B4A4_UNORM_PACK16;
|
||||||
formatInfoOut->decoder = TextureDecoder_R4_G4_UNORM_To_RGBA4_vk::getInstance();
|
formatInfoOut->decoder = TextureDecoder_R4_G4_UNORM_To_ABGR4::getInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user