HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
vertical_sync_win32.hpp
1// Copyright Take Vos 2019-2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "vertical_sync_base.hpp"
8#include <span>
9#include <thread>
10#include <array>
11
12namespace tt {
13
15 enum class State {
16 ADAPTER_OPEN,
17 ADAPTER_CLOSED,
18 FALLBACK
19 };
20
21 State state;
22
23 void *gdi;
24 unsigned int adapter;
25 unsigned int videoPresentSourceID;
26
27 std::thread verticalSyncThreadID;
28 bool stop = false;
29
30 hires_utc_clock::time_point previousFrameTimestamp;
32 size_t frameDurationDataCounter = 0;
33
34 void openAdapter() noexcept;
35 void closeAdapter() noexcept;
36
39 [[nodiscard]] hires_utc_clock::duration averageFrameDuration(hires_utc_clock::time_point frameTimestamp) noexcept;
40
44 [[nodiscard]] hires_utc_clock::time_point wait() noexcept;
45
46 void verticalSyncThread() noexcept;
47
48public:
49 vertical_sync_win32(std::function<void(void *,hires_utc_clock::time_point)> callback, void *callbackData) noexcept;
51};
52
53}
Definition vertical_sync_base.hpp:12
Definition vertical_sync_win32.hpp:14