From 7054cc235a4427a33db0dc7d25fd8cb104e5f378 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 23 Nov 2024 23:41:10 +0100 Subject: [PATCH] [dxvk] Always disable exclusive fullscreen --- src/d3d11/d3d11_swapchain.cpp | 9 --------- src/d3d11/d3d11_swapchain.h | 2 -- src/d3d9/d3d9_swapchain.cpp | 9 --------- src/d3d9/d3d9_swapchain.h | 2 -- src/dxvk/dxvk_presenter.cpp | 21 ++++++++++----------- src/dxvk/dxvk_presenter.h | 7 ++----- 6 files changed, 12 insertions(+), 38 deletions(-) diff --git a/src/d3d11/d3d11_swapchain.cpp b/src/d3d11/d3d11_swapchain.cpp index d1c66090e..a9320ae2b 100644 --- a/src/d3d11/d3d11_swapchain.cpp +++ b/src/d3d11/d3d11_swapchain.cpp @@ -502,7 +502,6 @@ namespace dxvk { presenterDesc.imageExtent = { m_desc.Width, m_desc.Height }; presenterDesc.imageCount = PickImageCount(m_desc.BufferCount + 1); presenterDesc.numFormats = PickFormats(m_desc.Format, presenterDesc.formats); - presenterDesc.fullScreenExclusive = PickFullscreenMode(); VkResult vr = m_presenter->recreateSwapChain(presenterDesc); @@ -537,7 +536,6 @@ namespace dxvk { presenterDesc.imageExtent = { m_desc.Width, m_desc.Height }; presenterDesc.imageCount = PickImageCount(m_desc.BufferCount + 1); presenterDesc.numFormats = PickFormats(m_desc.Format, presenterDesc.formats); - presenterDesc.fullScreenExclusive = PickFullscreenMode(); m_presenter = new Presenter(m_device, m_frameLatencySignal, presenterDesc); m_presenter->setFrameRateLimit(m_targetFrameRate, GetActualFrameLatency()); @@ -758,13 +756,6 @@ namespace dxvk { } - VkFullScreenExclusiveEXT D3D11SwapChain::PickFullscreenMode() { - return m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH - ? VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT - : VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT; - } - - std::string D3D11SwapChain::GetApiName() const { Com device; m_parent->QueryInterface(__uuidof(IDXGIDXVKDevice), reinterpret_cast(&device)); diff --git a/src/d3d11/d3d11_swapchain.h b/src/d3d11/d3d11_swapchain.h index fa3c64c2c..0c474baf5 100644 --- a/src/d3d11/d3d11_swapchain.h +++ b/src/d3d11/d3d11_swapchain.h @@ -170,8 +170,6 @@ namespace dxvk { uint32_t PickImageCount( UINT Preferred); - VkFullScreenExclusiveEXT PickFullscreenMode(); - std::string GetApiName() const; }; diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index a0e354206..af10e686e 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -952,7 +952,6 @@ namespace dxvk { presenterDesc.imageExtent = GetPresentExtent(); presenterDesc.imageCount = PickImageCount(m_presentParams.BackBufferCount + 1); presenterDesc.numFormats = PickFormats(EnumerateFormat(m_presentParams.BackBufferFormat), presenterDesc.formats); - presenterDesc.fullScreenExclusive = PickFullscreenMode(); VkResult vr = m_wctx->presenter->recreateSwapChain(presenterDesc); @@ -985,7 +984,6 @@ namespace dxvk { presenterDesc.imageExtent = GetPresentExtent(); presenterDesc.imageCount = PickImageCount(m_presentParams.BackBufferCount + 1); presenterDesc.numFormats = PickFormats(EnumerateFormat(m_presentParams.BackBufferFormat), presenterDesc.formats); - presenterDesc.fullScreenExclusive = PickFullscreenMode(); m_wctx->presenter = new Presenter(m_device, m_wctx->frameLatencySignal, presenterDesc); } @@ -1406,13 +1404,6 @@ namespace dxvk { } - VkFullScreenExclusiveEXT D3D9SwapChainEx::PickFullscreenMode() { - return m_dialog - ? VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT - : VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT; - } - - std::string D3D9SwapChainEx::GetApiName() { if (m_apiName == nullptr) { return this->GetParent()->IsExtended() ? "D3D9Ex" : "D3D9"; diff --git a/src/d3d9/d3d9_swapchain.h b/src/d3d9/d3d9_swapchain.h index e26a97a38..7f3e1f128 100644 --- a/src/d3d9/d3d9_swapchain.h +++ b/src/d3d9/d3d9_swapchain.h @@ -247,8 +247,6 @@ namespace dxvk { VkExtent2D GetPresentExtent(); - VkFullScreenExclusiveEXT PickFullscreenMode(); - std::string GetApiName(); const Com& GetFrontBuffer() const { diff --git a/src/dxvk/dxvk_presenter.cpp b/src/dxvk/dxvk_presenter.cpp index bb8f2c387..84599baa9 100644 --- a/src/dxvk/dxvk_presenter.cpp +++ b/src/dxvk/dxvk_presenter.cpp @@ -171,7 +171,7 @@ namespace dxvk { return VK_ERROR_SURFACE_LOST_KHR; VkSurfaceFullScreenExclusiveInfoEXT fullScreenExclusiveInfo = { VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT }; - fullScreenExclusiveInfo.fullScreenExclusive = desc.fullScreenExclusive; + fullScreenExclusiveInfo.fullScreenExclusive = VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT; VkPhysicalDeviceSurfaceInfo2KHR surfaceInfo = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR }; surfaceInfo.surface = m_surface; @@ -211,13 +211,13 @@ namespace dxvk { } // Select format based on swap chain properties - if ((status = getSupportedFormats(formats, desc.fullScreenExclusive))) + if ((status = getSupportedFormats(formats))) return status; m_info.format = pickFormat(formats.size(), formats.data(), desc.numFormats, desc.formats); // Select a present mode for the current sync interval - if ((status = getSupportedPresentModes(modes, desc.fullScreenExclusive))) + if ((status = getSupportedPresentModes(modes))) return status; m_info.presentMode = pickPresentMode(modes.size(), modes.data(), m_info.syncInterval); @@ -300,7 +300,7 @@ namespace dxvk { m_info.imageCount = pickImageCount(minImageCount, maxImageCount, desc.imageCount); VkSurfaceFullScreenExclusiveInfoEXT fullScreenInfo = { VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT }; - fullScreenInfo.fullScreenExclusive = desc.fullScreenExclusive; + fullScreenInfo.fullScreenExclusive = VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT; VkSwapchainPresentModesCreateInfoEXT modeInfo = { VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODES_CREATE_INFO_EXT }; modeInfo.presentModeCount = compatibleModes.size(); @@ -333,8 +333,7 @@ namespace dxvk { "\n Color space: ", m_info.format.colorSpace, "\n Present mode: ", m_info.presentMode, " (dynamic: ", (dynamicModes.empty() ? "no)" : "yes)"), "\n Buffer size: ", m_info.imageExtent.width, "x", m_info.imageExtent.height, - "\n Image count: ", m_info.imageCount, - "\n Exclusive FS: ", desc.fullScreenExclusive)); + "\n Image count: ", m_info.imageCount)); if ((status = m_vkd->vkCreateSwapchainKHR(m_vkd->device(), &swapInfo, nullptr, &m_swapchain))) @@ -414,7 +413,7 @@ namespace dxvk { return false; std::vector surfaceFormats; - getSupportedFormats(surfaceFormats, VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT); + getSupportedFormats(surfaceFormats); for (const auto& surfaceFormat : surfaceFormats) { if (surfaceFormat.colorSpace == colorspace) @@ -454,11 +453,11 @@ namespace dxvk { } - VkResult Presenter::getSupportedFormats(std::vector& formats, VkFullScreenExclusiveEXT fullScreenExclusive) const { + VkResult Presenter::getSupportedFormats(std::vector& formats) const { uint32_t numFormats = 0; VkSurfaceFullScreenExclusiveInfoEXT fullScreenInfo = { VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT }; - fullScreenInfo.fullScreenExclusive = fullScreenExclusive; + fullScreenInfo.fullScreenExclusive = VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT; VkPhysicalDeviceSurfaceInfo2KHR surfaceInfo = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, &fullScreenInfo }; surfaceInfo.surface = m_surface; @@ -496,11 +495,11 @@ namespace dxvk { } - VkResult Presenter::getSupportedPresentModes(std::vector& modes, VkFullScreenExclusiveEXT fullScreenExclusive) const { + VkResult Presenter::getSupportedPresentModes(std::vector& modes) const { uint32_t numModes = 0; VkSurfaceFullScreenExclusiveInfoEXT fullScreenInfo = { VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT }; - fullScreenInfo.fullScreenExclusive = fullScreenExclusive; + fullScreenInfo.fullScreenExclusive = VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT; VkPhysicalDeviceSurfaceInfo2KHR surfaceInfo = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, &fullScreenInfo }; surfaceInfo.surface = m_surface; diff --git a/src/dxvk/dxvk_presenter.h b/src/dxvk/dxvk_presenter.h index 9b65d31a9..50c54d47b 100644 --- a/src/dxvk/dxvk_presenter.h +++ b/src/dxvk/dxvk_presenter.h @@ -32,7 +32,6 @@ namespace dxvk { uint32_t imageCount; uint32_t numFormats; VkSurfaceFormatKHR formats[4]; - VkFullScreenExclusiveEXT fullScreenExclusive; }; /** @@ -262,12 +261,10 @@ namespace dxvk { const PresenterDesc& desc); VkResult getSupportedFormats( - std::vector& formats, - VkFullScreenExclusiveEXT fullScreenExclusive) const; + std::vector& formats) const; VkResult getSupportedPresentModes( - std::vector& modes, - VkFullScreenExclusiveEXT fullScreenExclusive) const; + std::vector& modes) const; VkResult getSwapImages( std::vector& images);