7 #include <gls/headercheck.hpp>
8 #include <gls/errorcheck.hpp>
9 #include <gls/objects/object.hpp>
33 check_gl_error( glDeleteSync( m_sync ) );
45 std::swap( m_sync, other.m_sync );
56 std::swap( m_sync, other.m_sync );
90 check_gl_error( glDeleteSync( m_sync ) );
91 m_sync = check_gl_error( glFenceSync( GL_SYNC_GPU_COMMANDS_COMPLETE, 0 ) );
110 bool wait( GLuint64 timeout ) {
111 auto result = check_gl_error( glClientWaitSync( m_sync, GL_SYNC_FLUSH_COMMANDS_BIT, timeout ) );
113 auto signaled = ( ( result == GL_ALREADY_SIGNALED ) || ( result == GL_CONDITION_SATISFIED ) );
145 check_gl_error( glFlush() );
146 check_gl_error( glWaitSync( m_sync, 0, GL_TIMEOUT_IGNORED ) );
bool wait(GLuint64 timeout)
Wait for the sync to expire.
Definition: sync.hpp:110
void insert()
Insert into the command queue.
Definition: sync.hpp:89
sync(sync &&other)
Move constructor.
Definition: sync.hpp:42
void server_wait()
Make server execution wait for this sync to expire.
Definition: sync.hpp:144
sync & operator=(sync &&other)
Move assignment operator.
Definition: sync.hpp:55
Class encapsulating an OpenGL sync object.
Definition: sync.hpp:17
~sync()
Destructor.
Definition: sync.hpp:32
Definition: buffer.hpp:12
GLsync name() const
Retrieve the OpenGL name of this sync object.
Definition: sync.hpp:77
bool expired()
Check if the current sync object has expired.
Definition: sync.hpp:130
sync()
Default constructor.
Definition: sync.hpp:23