From 9caf57c2c55e82cb5209d9a0d890fbd204f89d2c Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Sat, 24 Sep 2022 11:44:44 +0200 Subject: [PATCH] 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 --- src/Cafe/HW/Latte/Core/LatteTextureLoader.h | 4 ++-- src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cafe/HW/Latte/Core/LatteTextureLoader.h b/src/Cafe/HW/Latte/Core/LatteTextureLoader.h index 7c89a09a..25321006 100644 --- a/src/Cafe/HW/Latte/Core/LatteTextureLoader.h +++ b/src/Cafe/HW/Latte/Core/LatteTextureLoader.h @@ -612,8 +612,8 @@ public: uint8* blockData = LatteTextureLoader_GetInput(textureLoader, x, y); sint32 pixelOffset = (x + yc * textureLoader->width) * 2; uint8 v = (*(uint8*)(blockData + 0)); - *(uint8*)(outputData + pixelOffset + 1) = 0; - *(uint8*)(outputData + pixelOffset + 0) = ((v >> 4) & 0xF) | ((v << 4) & 0xF0); // todo: Is this nibble swap correct? + *(uint8*)(outputData + pixelOffset + 0) = 0; + *(uint8*)(outputData + pixelOffset + 1) = v; } } } diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp index 338d09af..fbc268cb 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp @@ -2571,7 +2571,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD else { 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; // R formats