Refactor Pacer to handle both blocking and non-blocking VsyncSources

This commit is contained in:
Cameron Gutman
2022-11-12 15:08:50 -06:00
parent 8e3e19a7f7
commit 6ae6218043
6 changed files with 170 additions and 129 deletions
@@ -35,17 +35,18 @@ public:
virtual ~DxVsyncSource();
virtual bool initialize(SDL_Window* window, int displayFps);
virtual bool initialize(SDL_Window* window, int) override;
virtual bool isAsync() override;
virtual void waitForVsync() override;
private:
static int vsyncThread(void* context);
Pacer* m_Pacer;
SDL_Thread* m_Thread;
SDL_atomic_t m_Stopping;
HMODULE m_Gdi32Handle;
HWND m_Window;
int m_DisplayFps;
HMONITOR m_LastMonitor;
D3DKMT_WAITFORVERTICALBLANKEVENT m_WaitForVblankEventParams;
PFND3DKMTOPENADAPTERFROMHDC m_D3DKMTOpenAdapterFromHdc;
PFND3DKMTCLOSEADAPTER m_D3DKMTCloseAdapter;