mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-24 09:20:16 +00:00
Don't leak GL fences
This commit is contained in:
parent
b911183d22
commit
6cfd34ab30
@ -1851,6 +1851,18 @@ void *rglFenceSync(GLenum condition, GLbitfield flags)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.2
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglDeleteSync(GLsync sync) {
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES3)
|
||||
glDeleteSync(sync);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
|
@ -161,6 +161,7 @@ RETRO_BEGIN_DECLS
|
||||
#define glClearBufferfi rglClearBufferfi
|
||||
#define glWaitSync rglWaitSync
|
||||
#define glFenceSync rglFenceSync
|
||||
#define glDeleteSync rglDeleteSync
|
||||
#define glBufferStorage rglBufferStorage
|
||||
#define glFlushMappedBufferRange rglFlushMappedBufferRange
|
||||
#define glClientWaitSync rglClientWaitSync
|
||||
@ -400,6 +401,7 @@ void rglTexSubImage2D( GLenum target,
|
||||
const GLvoid * pixels);
|
||||
void rglDeleteVertexArrays(GLsizei n, const GLuint *arrays);
|
||||
void *rglFenceSync(GLenum condition, GLbitfield flags);
|
||||
void rglDeleteSync(GLsync sync);
|
||||
void rglWaitSync(void *sync, GLbitfield flags, uint64_t timeout);
|
||||
void rglBufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data, GLbitfield flags);
|
||||
void rglFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
|
||||
|
@ -33,12 +33,19 @@ struct Storage {
|
||||
{
|
||||
}
|
||||
|
||||
~Storage() {
|
||||
if (this->fence) {
|
||||
glDeleteSync(this->fence);
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the buffer to be ready for reuse
|
||||
void sync() {
|
||||
if (this->fence) {
|
||||
glWaitSync(this->fence, 0, GL_TIMEOUT_IGNORED);
|
||||
get_error();
|
||||
glDeleteSync(this->fence);
|
||||
this->fence = NULL;
|
||||
get_error();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user