From c72a365d7822482941f92d5342c39dc5ad918fc8 Mon Sep 17 00:00:00 2001 From: GPUCode Date: Fri, 23 Sep 2022 22:38:05 +0300 Subject: [PATCH] renderer_vulkan: Add ABGR -> RGBA byteswap * Vulkan doesn't support VK_FORMAT_R8G8B8A8_UNORM_PACK32 unfortunately. Fixes graphical issues on the gpusprites demo --- src/video_core/renderer_vulkan/vk_texture_runtime.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_texture_runtime.cpp b/src/video_core/renderer_vulkan/vk_texture_runtime.cpp index 9a7d81620..ce7ba69b9 100644 --- a/src/video_core/renderer_vulkan/vk_texture_runtime.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_runtime.cpp @@ -206,13 +206,14 @@ void TextureRuntime::FormatConvert(VideoCore::PixelFormat format, bool upload, std::span source, std::span dest) { const VideoCore::SurfaceType type = VideoCore::GetFormatType(format); const vk::FormatFeatureFlagBits feature = ToVkFormatFeatures(type); - if (instance.IsFormatSupported(ToVkFormat(format), feature)) { + + if (format == VideoCore::PixelFormat::RGBA8) { + return Pica::Texture::ConvertABGRToRGBA(source, dest); + } else if (format == VideoCore::PixelFormat::RGB8 && upload) { + return Pica::Texture::ConvertBGRToRGBA(source, dest); + } else if (instance.IsFormatSupported(ToVkFormat(format), feature)) { std::memcpy(dest.data(), source.data(), source.size()); } else { - if (format == VideoCore::PixelFormat::RGB8 && upload) { - return Pica::Texture::ConvertBGRToRGBA(source, dest); - } - LOG_CRITICAL(Render_Vulkan, "Unimplemented converion for format {}!", format); UNREACHABLE(); }