From 6e7fd213388a89bd69978efe0a74c763d9bc9635 Mon Sep 17 00:00:00 2001 From: psucien Date: Sun, 16 Jun 2024 22:29:23 +0200 Subject: [PATCH] renderer_vulkan: simplified sRGB hack --- .../renderer_vulkan/liverpool_to_vk.cpp | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp index eca78436..f82a976a 100644 --- a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp +++ b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp @@ -364,22 +364,19 @@ vk::Format AdjustColorBufferFormat(vk::Format base_format, "Unsupported component swap mode {}", static_cast(comp_swap)); const bool comp_swap_alt = comp_swap == Liverpool::ColorBuffer::SwapMode::Alternate; - - switch (base_format) { - case vk::Format::eR8G8B8A8Unorm: - return comp_swap_alt ? vk::Format::eB8G8R8A8Unorm : base_format; - case vk::Format::eB8G8R8A8Unorm: - return comp_swap_alt ? vk::Format::eR8G8B8A8Unorm : base_format; - case vk::Format::eR8G8B8A8Srgb: - return comp_swap_alt ? vk::Format::eB8G8R8A8Unorm - : is_vo_surface ? vk::Format::eR8G8B8A8Unorm - : base_format; - case vk::Format::eB8G8R8A8Srgb: - return comp_swap_alt ? vk::Format::eR8G8B8A8Unorm - : is_vo_surface ? vk::Format::eB8G8R8A8Unorm - : base_format; + if (comp_swap_alt) { + switch (base_format) { + case vk::Format::eR8G8B8A8Unorm: + return vk::Format::eB8G8R8A8Unorm; + case vk::Format::eB8G8R8A8Unorm: + return vk::Format::eR8G8B8A8Unorm; + case vk::Format::eR8G8B8A8Srgb: + return is_vo_surface ? vk::Format::eB8G8R8A8Unorm : vk::Format::eB8G8R8A8Srgb; + case vk::Format::eB8G8R8A8Srgb: + return is_vo_surface ? vk::Format::eR8G8B8A8Unorm : vk::Format::eR8G8B8A8Srgb; + } } - UNREACHABLE_MSG("Unsupported base format {}", vk::to_string(base_format)); + return base_format; } vk::Format DepthFormat(DepthBuffer::ZFormat z_format, DepthBuffer::StencilFormat stencil_format) {