Vulkan: Fix incorrect encoding for substituted R4G4 format (#288)

Fixed incorrect channel order when VK_FORMAT_R4G4_UNORM_PACK8 is substituted with VK_FORMAT_R4G4B4A4_UNORM_PACK16
This commit is contained in:
Exzap 2022-09-24 11:44:44 +02:00 committed by GitHub
parent 8e89187f95
commit 9caf57c2c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -612,8 +612,8 @@ public:
uint8* blockData = LatteTextureLoader_GetInput(textureLoader, x, y); uint8* blockData = LatteTextureLoader_GetInput(textureLoader, x, y);
sint32 pixelOffset = (x + yc * textureLoader->width) * 2; sint32 pixelOffset = (x + yc * textureLoader->width) * 2;
uint8 v = (*(uint8*)(blockData + 0)); uint8 v = (*(uint8*)(blockData + 0));
*(uint8*)(outputData + pixelOffset + 1) = 0; *(uint8*)(outputData + pixelOffset + 0) = 0;
*(uint8*)(outputData + pixelOffset + 0) = ((v >> 4) & 0xF) | ((v << 4) & 0xF0); // todo: Is this nibble swap correct? *(uint8*)(outputData + pixelOffset + 1) = v;
} }
} }
} }

View file

@ -2571,7 +2571,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD
else else
{ {
formatInfoOut->vkImageFormat = VK_FORMAT_R4G4_UNORM_PACK8; formatInfoOut->vkImageFormat = VK_FORMAT_R4G4_UNORM_PACK8;
formatInfoOut->decoder = TextureDecoder_R4_G4::getInstance(); // todo - verify if order of R/G matches between GX2/Vulkan formatInfoOut->decoder = TextureDecoder_R4_G4::getInstance();
} }
break; break;
// R formats // R formats