1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 14:52:10 +01:00

[dxgi] Delay qualifying foreground loss as occlusion

This commit is contained in:
Paul Gofman 2024-09-26 20:03:22 -06:00 committed by Philip Rebohle
parent 4ed50ec6be
commit a172cab34f
2 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,9 @@
namespace dxvk::wsi { namespace dxvk::wsi {
class Win32WsiDriver : public WsiDriver { class Win32WsiDriver : public WsiDriver {
private:
uint64_t m_lastForegroundTimestamp = 0;
public: public:
// Platform // Platform
virtual std::vector<const char *> getInstanceExtensions(); virtual std::vector<const char *> getInstanceExtensions();

View File

@ -193,6 +193,7 @@ namespace dxvk::wsi {
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE); SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
m_lastForegroundTimestamp = 0;
return true; return true;
} }
@ -260,7 +261,12 @@ namespace dxvk::wsi {
bool Win32WsiDriver::isOccluded(HWND hWindow) { bool Win32WsiDriver::isOccluded(HWND hWindow) {
return ::GetForegroundWindow() != hWindow; if (::GetForegroundWindow() == hWindow)
{
m_lastForegroundTimestamp = GetTickCount64();
return false;
}
return m_lastForegroundTimestamp && GetTickCount64() - m_lastForegroundTimestamp > 100;
} }