16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

add gl::fence

This commit is contained in:
milek7
2018-10-21 00:38:39 +02:00
parent 7c9c19908a
commit cdd79e605c
3 changed files with 34 additions and 0 deletions

18
gl/fence.cpp Normal file
View File

@@ -0,0 +1,18 @@
#include "fence.h"
gl::fence::fence()
{
sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
}
gl::fence::~fence()
{
glDeleteSync(sync);
}
bool gl::fence::is_signalled()
{
GLint val;
glGetSynciv(sync, GL_SYNC_STATUS, 1, &val);
return val == GL_SIGNALED;
}

15
gl/fence.h Normal file
View File

@@ -0,0 +1,15 @@
#include "object.h"
namespace gl
{
class fence
{
GLsync sync;
public:
fence();
~fence();
bool is_signalled();
};
}