]> git.sesse.net Git - nageru/blob - ref_counted_gl_sync.h
Update the commented-out phase timing code for some renamed variables.
[nageru] / ref_counted_gl_sync.h
1 #ifndef _REF_COUNTED_GL_SYNC_H
2 #define _REF_COUNTED_GL_SYNC_H 1
3
4 // A wrapper around GLsync (OpenGL fences) that is automatically refcounted.
5 // Useful since we sometimes want to use the same fence two entirely different
6 // places. (We could set two fences at the same time, but they are not an
7 // unlimited hardware resource, so it would be a bit wasteful.)
8
9 #include <epoxy/gl.h>
10 #include <memory>
11
12 typedef std::shared_ptr<__GLsync> RefCountedGLsyncBase;
13
14 class RefCountedGLsync : public RefCountedGLsyncBase {
15 public:
16         RefCountedGLsync() {}
17
18         RefCountedGLsync(GLenum condition, GLbitfield flags) 
19                 : RefCountedGLsyncBase(glFenceSync(condition, flags), glDeleteSync) {}
20 };
21
22 #endif  // !defined(_REF_COUNTED_GL_SYNC_H)