From 0259f552853a6c465aeccb894e85ad2e4407b205 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 26 Oct 2024 13:50:57 +0200 Subject: [PATCH] wsi: Pass window state to setWindowMode --- src/d3d9/d3d9_swapchain.cpp | 2 +- src/dxgi/dxgi_swapchain.cpp | 2 +- src/wsi/glfw/wsi_platform_glfw.h | 1 + src/wsi/glfw/wsi_window_glfw.cpp | 1 + src/wsi/sdl2/wsi_platform_sdl2.h | 1 + src/wsi/sdl2/wsi_window_sdl2.cpp | 1 + src/wsi/win32/wsi_platform_win32.h | 1 + src/wsi/win32/wsi_window_win32.cpp | 1 + src/wsi/wsi_platform.cpp | 3 ++- src/wsi/wsi_platform.h | 1 + src/wsi/wsi_window.h | 2 ++ 11 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index 749fb6ba5..b9b036e04 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -1331,7 +1331,7 @@ namespace dxvk { HMONITOR monitor = wsi::getDefaultMonitor(); - if (!wsi::setWindowMode(monitor, m_window, wsiMode)) + if (!wsi::setWindowMode(monitor, m_window, &m_windowState, wsiMode)) return D3DERR_NOTAVAILABLE; if (wsi::getCurrentDisplayMode(monitor, &wsiMode)) diff --git a/src/dxgi/dxgi_swapchain.cpp b/src/dxgi/dxgi_swapchain.cpp index 67e2a54cd..d329af39f 100644 --- a/src/dxgi/dxgi_swapchain.cpp +++ b/src/dxgi/dxgi_swapchain.cpp @@ -813,7 +813,7 @@ namespace dxvk { if (!selectedMode.RefreshRate.Denominator) selectedMode.RefreshRate.Denominator = 1; - if (!wsi::setWindowMode(outputDesc.Monitor, m_window, ConvertDisplayMode(selectedMode))) + if (!wsi::setWindowMode(outputDesc.Monitor, m_window, &m_windowState, ConvertDisplayMode(selectedMode))) return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE; DXGI_VK_MONITOR_DATA* monitorData = nullptr; diff --git a/src/wsi/glfw/wsi_platform_glfw.h b/src/wsi/glfw/wsi_platform_glfw.h index ee6261bae..5ef0cfc4d 100644 --- a/src/wsi/glfw/wsi_platform_glfw.h +++ b/src/wsi/glfw/wsi_platform_glfw.h @@ -75,6 +75,7 @@ namespace dxvk::wsi { virtual bool setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& mode); virtual bool enterFullscreenMode( diff --git a/src/wsi/glfw/wsi_window_glfw.cpp b/src/wsi/glfw/wsi_window_glfw.cpp index 357c427d2..28510f758 100644 --- a/src/wsi/glfw/wsi_window_glfw.cpp +++ b/src/wsi/glfw/wsi_window_glfw.cpp @@ -45,6 +45,7 @@ namespace dxvk::wsi { bool GlfwWsiDriver::setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& pMode) { const int32_t displayId = fromHmonitor(hMonitor); GLFWwindow* window = fromHwnd(hWindow); diff --git a/src/wsi/sdl2/wsi_platform_sdl2.h b/src/wsi/sdl2/wsi_platform_sdl2.h index bc29812a2..44f8836ed 100644 --- a/src/wsi/sdl2/wsi_platform_sdl2.h +++ b/src/wsi/sdl2/wsi_platform_sdl2.h @@ -73,6 +73,7 @@ namespace dxvk::wsi { virtual bool setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& mode); virtual bool enterFullscreenMode( diff --git a/src/wsi/sdl2/wsi_window_sdl2.cpp b/src/wsi/sdl2/wsi_window_sdl2.cpp index 90b6107bc..e0c48fdce 100644 --- a/src/wsi/sdl2/wsi_window_sdl2.cpp +++ b/src/wsi/sdl2/wsi_window_sdl2.cpp @@ -44,6 +44,7 @@ namespace dxvk::wsi { bool Sdl2WsiDriver::setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& pMode) { const int32_t displayId = fromHmonitor(hMonitor); SDL_Window* window = fromHwnd(hWindow); diff --git a/src/wsi/win32/wsi_platform_win32.h b/src/wsi/win32/wsi_platform_win32.h index 3fdbba019..3f03e64db 100644 --- a/src/wsi/win32/wsi_platform_win32.h +++ b/src/wsi/win32/wsi_platform_win32.h @@ -60,6 +60,7 @@ namespace dxvk::wsi { virtual bool setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& mode); virtual bool enterFullscreenMode( diff --git a/src/wsi/win32/wsi_window_win32.cpp b/src/wsi/win32/wsi_window_win32.cpp index b30608a2d..faf963d3f 100644 --- a/src/wsi/win32/wsi_window_win32.cpp +++ b/src/wsi/win32/wsi_window_win32.cpp @@ -134,6 +134,7 @@ namespace dxvk::wsi { bool Win32WsiDriver::setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& mode) { ::MONITORINFOEXW monInfo; monInfo.cbSize = sizeof(monInfo); diff --git a/src/wsi/wsi_platform.cpp b/src/wsi/wsi_platform.cpp index 76e72f022..cf1c2391c 100644 --- a/src/wsi/wsi_platform.cpp +++ b/src/wsi/wsi_platform.cpp @@ -80,8 +80,9 @@ namespace dxvk::wsi { bool setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& mode) { - return s_driver->setWindowMode(hMonitor, hWindow, mode); + return s_driver->setWindowMode(hMonitor, hWindow, pState, mode); } bool enterFullscreenMode( diff --git a/src/wsi/wsi_platform.h b/src/wsi/wsi_platform.h index 50794bf53..0cd3b9ef0 100644 --- a/src/wsi/wsi_platform.h +++ b/src/wsi/wsi_platform.h @@ -60,6 +60,7 @@ namespace dxvk::wsi { virtual bool setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& mode) = 0; virtual bool enterFullscreenMode( diff --git a/src/wsi/wsi_window.h b/src/wsi/wsi_window.h index ed0f87d88..a67283df1 100644 --- a/src/wsi/wsi_window.h +++ b/src/wsi/wsi_window.h @@ -58,12 +58,14 @@ namespace dxvk::wsi { * * \param [in] hMonitor The monitor * \param [in] hWindow The window (may be unused on some platforms) + * \param [in] pState The swapchain's window state * \param [in] mode The mode * \returns \c true on success, \c false on failure */ bool setWindowMode( HMONITOR hMonitor, HWND hWindow, + DxvkWindowState* pState, const WsiMode& mode); /**