mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
add gl::fence
This commit is contained in:
@@ -108,6 +108,7 @@ set(SOURCES
|
||||
"gl/cubemap.cpp"
|
||||
"gl/glsl_common.cpp"
|
||||
"gl/buffer.cpp"
|
||||
"gl/fence.cpp"
|
||||
|
||||
"imgui/imgui.cpp"
|
||||
"imgui/imgui_demo.cpp"
|
||||
|
||||
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