From 952fd0d2eef19e7e28f5a439051f02be9aa72ec5 Mon Sep 17 00:00:00 2001 From: rcaridade145 Date: Mon, 18 Nov 2024 22:15:30 +0000 Subject: [PATCH 1/3] Add missing readbacks --- .../HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp index b055fe7eb..07b9f6c77 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp @@ -22,7 +22,7 @@ uint32 LatteTextureReadbackInfoVk::GetImageSize(LatteTextureView* textureView) cemu_assert(textureFormat == VK_FORMAT_R8G8B8A8_UNORM); return baseTexture->width * baseTexture->height * 4; } - else if (textureView->format == Latte::E_GX2SURFFMT::R8_UNORM) + else if (textureView->format == Latte::E_GX2SURFFMT::R8_UNORM ) { cemu_assert(textureFormat == VK_FORMAT_R8_UNORM); return baseTexture->width * baseTexture->height * 1; @@ -79,6 +79,16 @@ uint32 LatteTextureReadbackInfoVk::GetImageSize(LatteTextureView* textureView) // todo - if driver does not support VK_FORMAT_D24_UNORM_S8_UINT this is represented as VK_FORMAT_D32_SFLOAT_S8_UINT which is 8 bytes return baseTexture->width * baseTexture->height * 4; } + else if (textureView->format == Latte::E_GX2SURFFMT::R5_G6_B5_UNORM ) + { + cemu_assert(textureFormat == VK_FORMAT_R8G8B8A8_UNORM); + return baseTexture->width * baseTexture->height * 4; + } + else if (textureView->format == Latte::E_GX2SURFFMT::R5_G5_B5_A1_UNORM ) + { + cemu_assert(textureFormat == VK_FORMAT_R8G8B8A8_UNORM); + return baseTexture->width * baseTexture->height * 4; + } else { cemuLog_log(LogType::Force, "Unsupported texture readback format {:04x}", (uint32)textureView->format); From 90480edc02b3df125addc4b94ed6da7a3c7299ab Mon Sep 17 00:00:00 2001 From: rcaridade145 Date: Tue, 26 Nov 2024 13:19:02 +0000 Subject: [PATCH 2/3] Update src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp Latte::E_GX2SURFFMT::R5_G6_B5_UNORM is 2 bytes per texel Co-authored-by: Exzap <13877693+Exzap@users.noreply.github.com> --- src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp index 07b9f6c77..55d126108 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp @@ -82,7 +82,7 @@ uint32 LatteTextureReadbackInfoVk::GetImageSize(LatteTextureView* textureView) else if (textureView->format == Latte::E_GX2SURFFMT::R5_G6_B5_UNORM ) { cemu_assert(textureFormat == VK_FORMAT_R8G8B8A8_UNORM); - return baseTexture->width * baseTexture->height * 4; + return baseTexture->width * baseTexture->height * 2; } else if (textureView->format == Latte::E_GX2SURFFMT::R5_G5_B5_A1_UNORM ) { From c8cc31ebb3911b1980f39162170742db0d4a5246 Mon Sep 17 00:00:00 2001 From: rcaridade145 Date: Tue, 26 Nov 2024 22:26:02 +0000 Subject: [PATCH 3/3] Addressing comments in review --- .../HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp index 55d126108..bce23b597 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/TextureReadbackVk.cpp @@ -81,13 +81,10 @@ uint32 LatteTextureReadbackInfoVk::GetImageSize(LatteTextureView* textureView) } else if (textureView->format == Latte::E_GX2SURFFMT::R5_G6_B5_UNORM ) { - cemu_assert(textureFormat == VK_FORMAT_R8G8B8A8_UNORM); - return baseTexture->width * baseTexture->height * 2; - } - else if (textureView->format == Latte::E_GX2SURFFMT::R5_G5_B5_A1_UNORM ) - { - cemu_assert(textureFormat == VK_FORMAT_R8G8B8A8_UNORM); - return baseTexture->width * baseTexture->height * 4; + if(textureFormat == VK_FORMAT_R5G6B5_UNORM_PACK16){ + return baseTexture->width * baseTexture->height * 2; + } + return 0; } else {