HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RE_Sync.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: RE_Sync.h ( RE Library, C++)
7
*
8
* COMMENTS:
9
* Implements the GL_ARB_sync extension, which can be used to wait until
10
* a certain GL command has been processed by the server. Either the client
11
* or the server can wait. In the case of the client, the thread making
12
* GL calls will be suspended until the sync command is processed. For the
13
* Server, the GL command stream is suspended until the sync command is
14
* processed.
15
*
16
* Sync objects can be used to synchronize multiple contexts as well,
17
* which is useful for the loader/renderer paradigm.
18
*
19
*
20
* RE_RenderWait implements a client sync.
21
* RE_CommandSync implements a server sync.
22
*/
23
#ifndef RE_Sync_h
24
#define RE_Sync_h
25
26
#include "
RE_API.h
"
27
#include <
UT/UT_NonCopyable.h
>
28
#include <
UT/UT_UniquePtr.h
>
29
#include <
SYS/SYS_Types.h
>
30
31
class
re_OGLSync;
32
class
RE_Render
;
33
34
class
RE_API
RE_RenderWait
35
{
36
public
:
37
RE_RenderWait
();
38
~
RE_RenderWait
();
39
40
UT_NON_COPYABLE
(
RE_RenderWait
)
41
42
// Inserts a sync command into the GL render stream.
43
bool
insertSyncPoint(
RE_Render
*
r
);
44
45
// Checks to see if a sync point has been created. Useful for syncing
46
// multiple threads, as the client thread may not have created the sync yet
47
// that another thread waits on.
48
bool
doesSyncPointExist
()
const
{
return
mySyncObject !=
nullptr
; }
49
50
// All of the wait and sync methods returns true if the sync point was
51
// reached. They will return false if an error occurred, if the timeout
52
// expires, or if the sync has not be already set with insertSyncPoint().
53
54
// Checks if the point has been reached, or returns false immediately.
55
bool
poll(
RE_Render
*r);
56
57
// Waits indefinitely for the sync point to be reached.
58
bool
wait
(
RE_Render
*r);
59
60
// Waits until sync point is hit or the timeout expires.
61
bool
wait
(
RE_Render
*r,
uint64
timeout_in_ns);
62
63
// resets the sync object for reuse, so that previous results aren't
64
// mistakenly interpreted as complete.
65
void
reset
();
66
67
private
:
68
UT_UniquePtr<re_OGLSync>
mySyncObject;
69
};
70
71
72
class
RE_API
RE_CommandSync
73
{
74
public
:
75
RE_CommandSync
();
76
~
RE_CommandSync
();
77
78
UT_NON_COPYABLE
(
RE_CommandSync
)
79
80
// Inserts a sync point into the command stream. Will return false if the
81
// sync extension is not supported, otherwise true.
82
bool
insertSyncPoint(
RE_Render
*
r
);
83
84
// Inserts a wait point into the command stream, which waits until the
85
// previous sync point has completed. Will return false if no sync point
86
// was previously set.
87
bool
insertWaitPoint(
RE_Render
*r);
88
89
void
reset
();
90
91
private
:
92
UT_UniquePtr<re_OGLSync>
mySyncObject;
93
};
94
95
#endif
RE_API.h
RE_API
#define RE_API
Definition:
RE_API.h:10
uint64
unsigned long long uint64
Definition:
SYS_Types.h:117
RE_RenderWait::doesSyncPointExist
bool doesSyncPointExist() const
Definition:
RE_Sync.h:48
UT_UniquePtr
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition:
UT_UniquePtr.h:39
SYS_Types.h
RE_RenderWait
Definition:
RE_Sync.h:34
reset
GLboolean reset
Definition:
glad.h:5138
RE_Render
Definition:
RE_Render.h:29
UT_NON_COPYABLE
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
Definition:
UT_NonCopyable.h:31
RE_CommandSync
Definition:
RE_Sync.h:72
UT_NonCopyable.h
wait
*tasks wait()
UT_UniquePtr.h
r
GLboolean r
Definition:
glcorearb.h:1222
RE
RE_Sync.h
Generated on Wed Aug 27 2025 03:08:15 for HDK by
1.8.6