1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "libvideostitch/status.hpp"
namespace VideoStitch {
namespace GPU {
/** Events inform observers that a GPU Stream has reached a point of computation.
* Event objects can be created by calling Stream::record().
*
* Block host: the CPU can wait for an Event to be triggered by calling .synchronize()
*
* Block GPU: Streams can be configured to wait for Events to trigger before continuing
* their computations (see Stream API waitOnEvent).
*/
class Event {
public:
/** Let the current CPU thread wait until the GPU Stream
* has reached the point where the Event was recorded.
*/
Status synchronize();
~Event();
Event(const Event& other);
void swap(Event& other) { std::swap(pimpl, other.pimpl); }
Event operator=(Event other) {
swap(other);
return *this;
}
/* Default constructed, empty wrapper.
* Not a valid GPU Event. Can not be used to do GPU synchronization.
* Use Stream::recordEvent() to create an Event.
*/
Event();
class DeviceEvent;
private:
DeviceEvent* pimpl;
explicit Event(DeviceEvent* pimpl);
public:
/** Provide the GPU backend implementation with simple access to the underlying data structure. */
const DeviceEvent& get() const;
};
} // namespace GPU
} // namespace VideoStitch