VideoBackends: Pass window system info from host on creation

This commit is contained in:
Stenzek
2018-10-03 23:03:22 +10:00
parent 9c57a98723
commit eb284b5d66
26 changed files with 148 additions and 75 deletions

View File

@ -89,7 +89,7 @@ static bool ShouldEnableDebugReports(bool enable_validation_layers)
return enable_validation_layers || IsHostGPULoggingEnabled();
}
bool VideoBackend::Initialize(void* display_handle, void* window_handle)
bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
{
if (!LoadVulkanLibrary())
{
@ -107,7 +107,7 @@ bool VideoBackend::Initialize(void* display_handle, void* window_handle)
// Create Vulkan instance, needed before we can create a surface, or enumerate devices.
// We use this instance to fill in backend info, then re-use it for the actual device.
bool enable_surface = window_handle != nullptr;
bool enable_surface = wsi.render_surface != nullptr;
bool enable_debug_reports = ShouldEnableDebugReports(enable_validation_layer);
VkInstance instance = VulkanContext::CreateVulkanInstance(enable_surface, enable_debug_reports,
enable_validation_layer);
@ -146,7 +146,7 @@ bool VideoBackend::Initialize(void* display_handle, void* window_handle)
VkSurfaceKHR surface = VK_NULL_HANDLE;
if (enable_surface)
{
surface = SwapChain::CreateVulkanSurface(instance, display_handle, window_handle);
surface = SwapChain::CreateVulkanSurface(instance, wsi.display_connection, wsi.render_surface);
if (surface == VK_NULL_HANDLE)
{
PanicAlert("Failed to create Vulkan surface.");
@ -209,7 +209,8 @@ bool VideoBackend::Initialize(void* display_handle, void* window_handle)
std::unique_ptr<SwapChain> swap_chain;
if (surface != VK_NULL_HANDLE)
{
swap_chain = SwapChain::Create(display_handle, window_handle, surface, g_Config.IsVSync());
swap_chain =
SwapChain::Create(wsi.display_connection, wsi.render_surface, surface, g_Config.IsVSync());
if (!swap_chain)
{
PanicAlert("Failed to create Vulkan swap chain.");