Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>. |
||
3 | * It is copyright by its individual contributors, as recorded in the |
||
4 | * project's Git history. See COPYING.txt at the top level for license |
||
5 | * terms and a link to the Git history. |
||
6 | */ |
||
7 | |||
8 | /* OpenGL Synchronization code: |
||
9 | * either use fence sync objects or glFinish() to prevent the GPU from |
||
10 | * lagging behind too much. |
||
11 | */ |
||
12 | |||
13 | #pragma once |
||
14 | |||
15 | #include <memory> |
||
16 | #include "maths.h" |
||
17 | #include "args.h" |
||
18 | #include "ogl_extensions.h" |
||
19 | |||
20 | namespace dcx { |
||
21 | |||
22 | #if DXX_USE_OGL |
||
23 | class ogl_sync { |
||
24 | class sync_deleter |
||
25 | { |
||
26 | public: |
||
27 | typedef GLsync pointer; |
||
28 | void operator()(pointer p) const; |
||
29 | }; |
||
30 | private: |
||
31 | SyncGLMethod method; |
||
32 | fix wait_timeout; |
||
33 | std::unique_ptr<GLsync, sync_deleter> fence; |
||
34 | public: |
||
35 | ogl_sync(); |
||
36 | ~ogl_sync(); |
||
37 | |||
38 | void before_swap(); |
||
39 | void after_swap(); |
||
40 | void init(SyncGLMethod sync_method, int wait); |
||
41 | void deinit(); |
||
42 | }; |
||
43 | #endif |
||
44 | |||
45 | } |