mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-22 20:29:15 +01:00
Fallback to RGBA888 for unsupported swapchain formats as opposed to swizzle
This commit is contained in:
parent
e0bc0d3a97
commit
c8fc8f84ec
@ -288,10 +288,13 @@ 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};
|
||||
texture::Format underlyingFormat{format};
|
||||
if (swapchainFormat != format) {
|
||||
auto formats{gpu.vkPhysicalDevice.getSurfaceFormatsKHR(**vkSurface)};
|
||||
if (std::find(formats.begin(), formats.end(), vk::SurfaceFormatKHR{vkFormat, vk::ColorSpaceKHR::eSrgbNonlinear}) == formats.end())
|
||||
Logger::Warn("Surface doesn't support requested image format '{}' with colorspace '{}'", vk::to_string(vkFormat), vk::to_string(vk::ColorSpaceKHR::eSrgbNonlinear));
|
||||
if (std::find(formats.begin(), formats.end(), vk::SurfaceFormatKHR{vkFormat, vk::ColorSpaceKHR::eSrgbNonlinear}) == formats.end()) {
|
||||
Logger::Debug("Surface doesn't support requested image format '{}' with colorspace '{}'", vk::to_string(vkFormat), vk::to_string(vk::ColorSpaceKHR::eSrgbNonlinear));
|
||||
underlyingFormat = format::R8G8B8A8Unorm;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr vk::ImageUsageFlags presentUsage{vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eTransferSrc | vk::ImageUsageFlagBits::eTransferDst};
|
||||
@ -306,7 +309,7 @@ namespace skyline::gpu {
|
||||
vkSwapchain.emplace(gpu.vkDevice, vk::SwapchainCreateInfoKHR{
|
||||
.surface = **vkSurface,
|
||||
.minImageCount = minImageCount,
|
||||
.imageFormat = vkFormat,
|
||||
.imageFormat = *underlyingFormat,
|
||||
.imageColorSpace = vk::ColorSpaceKHR::eSrgbNonlinear,
|
||||
.imageExtent = extent,
|
||||
.imageArrayLayers = 1,
|
||||
@ -323,7 +326,7 @@ namespace skyline::gpu {
|
||||
|
||||
for (size_t index{}; index < vkImages.size(); index++) {
|
||||
auto &slot{images[index]};
|
||||
slot = std::make_shared<Texture>(*state.gpu, vkImages[index], extent, format, vk::ImageLayout::eUndefined, vk::ImageTiling::eOptimal, vk::ImageCreateFlags{}, presentUsage);
|
||||
slot = std::make_shared<Texture>(*state.gpu, vkImages[index], extent, underlyingFormat, vk::ImageLayout::eUndefined, vk::ImageTiling::eOptimal, vk::ImageCreateFlags{}, presentUsage);
|
||||
slot->TransitionLayout(vk::ImageLayout::ePresentSrcKHR);
|
||||
}
|
||||
for (size_t index{vkImages.size()}; index < MaxSwapchainImageCount; index++)
|
||||
|
@ -84,12 +84,7 @@ namespace skyline::gpu::format {
|
||||
FORMAT_NORM_INT_FLOAT(R16G16, 32, eR16G16);
|
||||
FORMAT(B10G11R11Float, 32, eB10G11R11UfloatPack32);
|
||||
FORMAT_NORM_INT_SRGB(R8G8B8A8, 32, eR8G8B8A8);
|
||||
FORMAT_NORM_INT_SRGB(B8G8R8A8, 32, eR8G8B8A8, .swizzleMapping = {
|
||||
.r = vk::ComponentSwizzle::eB,
|
||||
.g = vk::ComponentSwizzle::eG,
|
||||
.b = vk::ComponentSwizzle::eR,
|
||||
.a = vk::ComponentSwizzle::eA
|
||||
}); // Used by SurfaceFlinger
|
||||
FORMAT_NORM_INT_SRGB(B8G8R8A8, 32, eB8G8R8A8);
|
||||
FORMAT_SUFF_NORM_INT(A2B10G10R10, 32, eA2B10G10R10, Pack32);
|
||||
FORMAT_SUFF_NORM_INT_SRGB(A8B8G8R8, 32, eA8B8G8R8, Pack32);
|
||||
FORMAT(E5B9G9R9Float, 32, eE5B9G9R9UfloatPack32);
|
||||
|
Loading…
Reference in New Issue
Block a user