diff --git a/lib/win/ApplicationWin32.cpp b/lib/win/ApplicationWin32.cpp index 50b5e10..41dcc85 100644 --- a/lib/win/ApplicationWin32.cpp +++ b/lib/win/ApplicationWin32.cpp @@ -126,7 +126,7 @@ public: bool noD3d = false; #if BOO_HAS_VULKAN - bool useVulkan = false; + bool useVulkan = true; #endif if (!gfxApi.empty()) { #if BOO_HAS_VULKAN @@ -165,6 +165,32 @@ public: #endif } +#if BOO_HAS_VULKAN + if (useVulkan) { + HMODULE vulkanLib = LoadLibraryW(L"vulkan-1.dll"); + if (vulkanLib) { + m_getVkProc = (PFN_vkGetInstanceProcAddr)GetProcAddress(vulkanLib, "vkGetInstanceProcAddr"); + if (m_getVkProc) { + /* Check device support for vulkan */ + if (g_VulkanContext.m_instance == VK_NULL_HANDLE) { + auto appName = getUniqueName(); + if (g_VulkanContext.initVulkan(WCSTMBS(appName.data()).c_str(), m_getVkProc)) { + if (g_VulkanContext.enumerateDevices()) { + /* Obtain DXGI Factory */ + HRESULT hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory1), &m_3dCtx.m_vulkanDxFactory); + if (FAILED(hr)) + Log.report(logvisor::Fatal, FMT_STRING("unable to create DXGI factory")); + + Log.report(logvisor::Info, FMT_STRING("initialized Vulkan renderer")); + return; + } + } + } + } + } + } +#endif + HMODULE d3d11lib = nullptr; if (!noD3d) d3d11lib = LoadLibraryW(L"D3D11.dll"); @@ -241,32 +267,6 @@ public: return; } -#if BOO_HAS_VULKAN - if (useVulkan) { - HMODULE vulkanLib = LoadLibraryW(L"vulkan-1.dll"); - if (vulkanLib) { - m_getVkProc = (PFN_vkGetInstanceProcAddr)GetProcAddress(vulkanLib, "vkGetInstanceProcAddr"); - if (m_getVkProc) { - /* Check device support for vulkan */ - if (g_VulkanContext.m_instance == VK_NULL_HANDLE) { - auto appName = getUniqueName(); - if (g_VulkanContext.initVulkan(WCSTMBS(appName.data()).c_str(), m_getVkProc)) { - if (g_VulkanContext.enumerateDevices()) { - /* Obtain DXGI Factory */ - HRESULT hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory1), &m_3dCtx.m_vulkanDxFactory); - if (FAILED(hr)) - Log.report(logvisor::Fatal, FMT_STRING("unable to create DXGI factory")); - - Log.report(logvisor::Info, FMT_STRING("initialized Vulkan renderer")); - return; - } - } - } - } - } - } -#endif - #if BOO_HAS_GL /* Finally try OpenGL */ {