renderer_vulkan: Add ABGR -> RGBA byteswap

* Vulkan doesn't support VK_FORMAT_R8G8B8A8_UNORM_PACK32 unfortunately. Fixes graphical issues on the gpusprites demo
This commit is contained in:
GPUCode
2022-09-23 22:38:05 +03:00
parent 8f211613a3
commit c72a365d78

View File

@ -206,13 +206,14 @@ void TextureRuntime::FormatConvert(VideoCore::PixelFormat format, bool upload,
std::span<std::byte> source, std::span<std::byte> 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();
}