HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
ttauri
GUI
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
12
namespace
tt {
13
14
class
vertical_sync_win32
final :
public
vertical_sync_base
{
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;
31
std::array<hires_utc_clock::duration,15>
frameDurationData;
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
48
public
:
49
vertical_sync_win32
(
std::function
<
void
(
void
*,
hires_utc_clock::time_point
)> callback,
void
*callbackData)
noexcept
;
50
~vertical_sync_win32
();
51
};
52
53
}
tt::vertical_sync_base
Definition
vertical_sync_base.hpp:12
tt::vertical_sync_win32
Definition
vertical_sync_win32.hpp:14
std::array
std::chrono::duration< rep, period >
std::function
std::thread
std::chrono::time_point
Generated on Mon Apr 22 2024 12:53:54 for HikoGUI by
1.10.0