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:
@ -206,13 +206,14 @@ void TextureRuntime::FormatConvert(VideoCore::PixelFormat format, bool upload,
|
|||||||
std::span<std::byte> source, std::span<std::byte> dest) {
|
std::span<std::byte> source, std::span<std::byte> dest) {
|
||||||
const VideoCore::SurfaceType type = VideoCore::GetFormatType(format);
|
const VideoCore::SurfaceType type = VideoCore::GetFormatType(format);
|
||||||
const vk::FormatFeatureFlagBits feature = ToVkFormatFeatures(type);
|
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());
|
std::memcpy(dest.data(), source.data(), source.size());
|
||||||
} else {
|
} else {
|
||||||
if (format == VideoCore::PixelFormat::RGB8 && upload) {
|
|
||||||
return Pica::Texture::ConvertBGRToRGBA(source, dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_CRITICAL(Render_Vulkan, "Unimplemented converion for format {}!", format);
|
LOG_CRITICAL(Render_Vulkan, "Unimplemented converion for format {}!", format);
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user