Merge branch 'sdl_platform' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-sdl_platform
# Conflicts: # Source/Editor/GUI/Dialogs/ColorPickerDialog.cs # Source/Editor/Modules/UIModule.cs
This commit is contained in:
@@ -217,7 +217,7 @@ bool GPUSwapChainVulkan::CreateSwapChain(int32 width, int32 height)
|
||||
ASSERT_LOW_LAYER(_backBuffers.Count() == 0);
|
||||
|
||||
// Create platform-dependent surface
|
||||
VulkanPlatform::CreateSurface(windowHandle, GPUDeviceVulkan::Instance, &_surface);
|
||||
VulkanPlatform::CreateSurface(_window, _device, GPUDeviceVulkan::Instance, &_surface);
|
||||
if (_surface == VK_NULL_HANDLE)
|
||||
{
|
||||
LOG(Warning, "Failed to create Vulkan surface.");
|
||||
@@ -356,13 +356,22 @@ bool GPUSwapChainVulkan::CreateSwapChain(int32 width, int32 height)
|
||||
LOG(Error, "Vulkan swapchain dimensions are invalid {}x{} (minImageExtent={}x{}, maxImageExtent={}x{})", width, height, surfProperties.minImageExtent.width, surfProperties.minImageExtent.height, surfProperties.maxImageExtent.width, surfProperties.maxImageExtent.height);
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t backbuffersCount = VULKAN_BACK_BUFFERS_COUNT;
|
||||
#if PLATFORM_SDL && PLATFORM_LINUX && USE_EDITOR
|
||||
// Wayland compositor might block one of the backbuffers while the window is minimized or fully occluded,
|
||||
// make sure we have at least 3 backbuffers available so double-buffering can be used while we are blocked.
|
||||
if (Platform::UsesWayland())
|
||||
backbuffersCount = Math::Max<uint32_t>(backbuffersCount, 3);
|
||||
#endif
|
||||
|
||||
ASSERT(surfProperties.minImageCount <= VULKAN_BACK_BUFFERS_COUNT_MAX);
|
||||
VkSwapchainCreateInfoKHR swapChainInfo;
|
||||
RenderToolsVulkan::ZeroStruct(swapChainInfo, VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR);
|
||||
swapChainInfo.surface = _surface;
|
||||
swapChainInfo.minImageCount = surfProperties.maxImageCount > 0 // A value of 0 means that there is no limit on the number of image
|
||||
? Math::Min<uint32_t>(VULKAN_BACK_BUFFERS_COUNT, surfProperties.maxImageCount)
|
||||
: VULKAN_BACK_BUFFERS_COUNT;
|
||||
? Math::Min<uint32_t>(backbuffersCount, surfProperties.maxImageCount)
|
||||
: backbuffersCount;
|
||||
swapChainInfo.minImageCount = Math::Max<uint32_t>(swapChainInfo.minImageCount, surfProperties.minImageCount);
|
||||
swapChainInfo.minImageCount = Math::Min<uint32_t>(swapChainInfo.minImageCount, VULKAN_BACK_BUFFERS_COUNT_MAX);
|
||||
swapChainInfo.imageFormat = result.format;
|
||||
@@ -381,7 +390,9 @@ bool GPUSwapChainVulkan::CreateSwapChain(int32 width, int32 height)
|
||||
swapChainInfo.presentMode = presentMode;
|
||||
swapChainInfo.clipped = VK_TRUE;
|
||||
swapChainInfo.compositeAlpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
|
||||
if (surfProperties.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR)
|
||||
if (_window->GetSettings().SupportsTransparency && surfProperties.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR)
|
||||
swapChainInfo.compositeAlpha = VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
|
||||
else if (surfProperties.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR)
|
||||
swapChainInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
|
||||
// Create swap chain
|
||||
|
||||
Reference in New Issue
Block a user