summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-02-16 14:15:00 +1000
committerGitHub <noreply@github.com>2019-02-16 14:15:00 +1000
commitb5c3881fe703287c4f883ca42a3b931bb6594854 (patch)
tree29daf45582fa2860c76127271457675184341900 /Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
parentc41f32bcf8fe0c04d54d3541df210a604b2399d1 (diff)
parenteabde77892faf4408481f685f2fbf1b348232d5f (diff)
Merge pull request #7512 from stenzek/runtime-headless
DolphinNoGUI: Runtime selection of platform
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/VulkanContext.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/VulkanContext.cpp43
1 files changed, 29 insertions, 14 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
index e38c47eefc..4eaea78865 100644
--- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
@@ -84,11 +84,11 @@ bool VulkanContext::CheckValidationLayerAvailablility()
}) != layer_list.end());
}
-VkInstance VulkanContext::CreateVulkanInstance(bool enable_surface, bool enable_debug_report,
+VkInstance VulkanContext::CreateVulkanInstance(WindowSystemType wstype, bool enable_debug_report,
bool enable_validation_layer)
{
ExtensionList enabled_extensions;
- if (!SelectInstanceExtensions(&enabled_extensions, enable_surface, enable_debug_report))
+ if (!SelectInstanceExtensions(&enabled_extensions, wstype, enable_debug_report))
return VK_NULL_HANDLE;
VkApplicationInfo app_info = {};
@@ -129,7 +129,7 @@ VkInstance VulkanContext::CreateVulkanInstance(bool enable_surface, bool enable_
return instance;
}
-bool VulkanContext::SelectInstanceExtensions(ExtensionList* extension_list, bool enable_surface,
+bool VulkanContext::SelectInstanceExtensions(ExtensionList* extension_list, WindowSystemType wstype,
bool enable_debug_report)
{
u32 extension_count = 0;
@@ -172,24 +172,39 @@ bool VulkanContext::SelectInstanceExtensions(ExtensionList* extension_list, bool
};
// Common extensions
- if (enable_surface && !SupportsExtension(VK_KHR_SURFACE_EXTENSION_NAME, true))
+ if (wstype != WindowSystemType::Headless &&
+ !SupportsExtension(VK_KHR_SURFACE_EXTENSION_NAME, true))
+ {
return false;
+ }
#if defined(VK_USE_PLATFORM_WIN32_KHR)
- if (enable_surface && !SupportsExtension(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, true))
- return false;
-#elif defined(VK_USE_PLATFORM_XLIB_KHR)
- if (enable_surface && !SupportsExtension(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, true))
+ if (wstype == WindowSystemType::Windows &&
+ !SupportsExtension(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, true))
+ {
return false;
-#elif defined(VK_USE_PLATFORM_XCB_KHR)
- if (enable_surface && !SupportsExtension(VK_KHR_XCB_SURFACE_EXTENSION_NAME, true))
+ }
+#endif
+#if defined(VK_USE_PLATFORM_XLIB_KHR)
+ if (wstype == WindowSystemType::X11 &&
+ !SupportsExtension(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, true))
+ {
return false;
-#elif defined(VK_USE_PLATFORM_ANDROID_KHR)
- if (enable_surface && !SupportsExtension(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, true))
+ }
+#endif
+#if defined(VK_USE_PLATFORM_ANDROID_KHR)
+ if (wstype == WindowSystemType::Android &&
+ !SupportsExtension(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, true))
+ {
return false;
-#elif defined(VK_USE_PLATFORM_MACOS_MVK)
- if (enable_surface && !SupportsExtension(VK_MVK_MACOS_SURFACE_EXTENSION_NAME, true))
+ }
+#endif
+#if defined(VK_USE_PLATFORM_MACOS_MVK)
+ if (wstype == WindowSystemType::MacOS &&
+ !SupportsExtension(VK_MVK_MACOS_SURFACE_EXTENSION_NAME, true))
+ {
return false;
+ }
#endif
// VK_EXT_debug_report