Rework swizzle infrastructure to support arbritary format swizzles

This is required to support R4G4B4A4 which has no directly corresponding Vulkan format.

Co-authored-by: Lunar-Pixel <lunarn452@gmail.com>
This commit is contained in:
Billy Laws
2022-04-12 17:04:46 +01:00
committed by PixelyIon
parent 6f85a66151
commit 3f3acc31d8
4 changed files with 42 additions and 30 deletions

View File

@ -121,7 +121,7 @@ namespace skyline::gpu {
throw exception("Cannot update swapchain to accomodate image extent: {}x{} ({}x{}-{}x{})", extent.width, extent.height, capabilities.minImageExtent.width, capabilities.minImageExtent.height, capabilities.maxImageExtent.width, capabilities.maxImageExtent.height);
vk::Format vkFormat{*format};
if (vkFormat == vk::Format::eB5G6R5UnormPack16 && format->swapRedBlue)
if (format == gpu::format::R5G6B5Unorm)
// B5G6R5 isn't generally supported by the swapchain and the format is used for R5G6B5 with swapped R/B channels to avoid aliasing so we reverse that by using R5G6B5 as the underlying Vulkan format for the swapchain which should be automatically handled by the driver for any copies from B5G6R5 textures and the data representation should be the same as B5G6R5 with swapped R/B channels so not reporting the correct texture::Format should be fine
vkFormat = vk::Format::eR5G6B5UnormPack16;