HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
TTauri
GUI
VerticalSync_win32.hpp
1
// Copyright 2019 Pokitec
2
// All rights reserved.
3
4
#pragma once
5
6
#include "TTauri/GUI/VerticalSync_base.hpp"
7
#include <nonstd/span>
8
#include <thread>
9
10
namespace
tt {
11
12
class
VerticalSync_win32
final :
public
VerticalSync_base
{
13
enum class
State {
14
ADAPTER_OPEN,
15
ADAPTER_CLOSED,
16
FALLBACK
17
};
18
19
State state;
20
21
void
*gdi;
22
unsigned
int
adapter;
23
unsigned
int
videoPresentSourceID;
24
25
std::thread
verticalSyncThreadID;
26
bool
stop =
false
;
27
28
hires_utc_clock::time_point
previousFrameTimestamp;
29
std::array<hires_utc_clock::duration,15>
frameDurationData;
30
size_t
frameDurationDataCounter = 0;
31
32
void
openAdapter()
noexcept
;
33
void
closeAdapter()
noexcept
;
34
37
[[nodiscard]]
hires_utc_clock::duration
averageFrameDuration(
hires_utc_clock::time_point
frameTimestamp)
noexcept
;
38
42
[[nodiscard]]
hires_utc_clock::time_point
wait()
noexcept
;
43
44
void
verticalSyncThread()
noexcept
;
45
46
public
:
47
VerticalSync_win32
(
std::function
<
void
(
void
*,
hires_utc_clock::time_point
)> callback,
void
*callbackData)
noexcept
;
48
~VerticalSync_win32
();
49
};
50
51
}
tt::VerticalSync_base
Definition
VerticalSync_base.hpp:9
tt::VerticalSync_win32
Definition
VerticalSync_win32.hpp:12
std::array
std::chrono::duration
std::function
std::thread
std::chrono::time_point
Generated on Mon Apr 22 2024 12:53:56 for HikoGUI by
1.10.0