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 <
SYS/SYS_Types.h
>
27
#include "
RE_API.h
"
28
29
class
re_OGLSync;
30
class
RE_Render
;
31
32
class
RE_API
RE_RenderWait
33
{
34
public
:
35
RE_RenderWait
();
36
~
RE_RenderWait
();
37
38
// Inserts a sync command into the GL render stream.
39
bool
insertSyncPoint(
RE_Render
*
r
);
40
41
// Checks to see if a sync point has been created. Useful for syncing
42
// multiple threads, as the client thread may not have created the sync yet
43
// that another thread waits on.
44
bool
doesSyncPointExist
()
const
{
return
mySyncObject !=
nullptr
; }
45
46
// All of the wait and sync methods returns true if the sync point was
47
// reached. They will return false if an error occurred, if the timeout
48
// expires, or if the sync has not be already set with insertSyncPoint().
49
50
// Checks if the point has been reached, or returns false immediately.
51
bool
poll(
RE_Render
*r);
52
53
// Waits indefinitely for the sync point to be reached.
54
bool
wait
(
RE_Render
*r);
55
56
// Waits until sync point is hit or the timeout expires.
57
bool
wait
(
RE_Render
*r,
uint64
timeout_in_ns);
58
59
// resets the sync object for reuse, so that previous results aren't
60
// mistakenly interpreted as complete.
61
void
reset
();
62
63
private
:
64
re_OGLSync *mySyncObject;
65
};
66
67
68
class
RE_API
RE_CommandSync
69
{
70
public
:
71
RE_CommandSync
();
72
~
RE_CommandSync
();
73
74
// Inserts a sync point into the command stream. Will return false if the
75
// sync extension is not supported, otherwise true.
76
bool
insertSyncPoint(
RE_Render
*
r
);
77
78
// Inserts a wait point into the command stream, which waits until the
79
// previous sync point has completed. Will return false if no sync point
80
// was previously set.
81
bool
insertWaitPoint(
RE_Render
*r);
82
83
void
reset
();
84
private
:
85
re_OGLSync *mySyncObject;
86
};
87
88
#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:44
SYS_Types.h
RE_RenderWait
Definition:
RE_Sync.h:32
reset
GLboolean reset
Definition:
glad.h:5138
RE_Render
Definition:
RE_Render.h:29
RE_CommandSync
Definition:
RE_Sync.h:68
wait
*tasks wait()
r
GLboolean r
Definition:
glcorearb.h:1222
RE
RE_Sync.h
Generated on Thu Nov 21 2024 02:45:38 for HDK by
1.8.6