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:
18
gl/fence.cpp
Normal file
18
gl/fence.cpp
Normal 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
15
gl/fence.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "object.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
class fence
|
||||
{
|
||||
GLsync sync;
|
||||
|
||||
public:
|
||||
fence();
|
||||
~fence();
|
||||
|
||||
bool is_signalled();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user