From 3d7dbd6371dcaf307fe6dabc814215cb897e49b9 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 8 Aug 2021 09:26:36 +1000 Subject: [PATCH] [client] egl: `sync` is now an atomic, access it as such --- client/renderers/EGL/texture_buffer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/client/renderers/EGL/texture_buffer.c b/client/renderers/EGL/texture_buffer.c index 7b06f170..2de876c4 100644 --- a/client/renderers/EGL/texture_buffer.c +++ b/client/renderers/EGL/texture_buffer.c @@ -41,11 +41,9 @@ static void eglTexBuffer_cleanup(TextureBuffer * this) if (this->sampler) glDeleteSamplers(1, &this->sampler); - if (this->sync) - { - glDeleteSync(this->sync); - this->sync = 0; - } + GLsync sync = atomic_exchange(&this->sync, 0); + if (sync) + glDeleteSync(sync); } // common functions @@ -201,7 +199,7 @@ EGL_TexStatus eglTexBuffer_stream_process(EGL_Texture * texture) GLuint tex = this->tex[this->bufIndex]; EGL_TexBuffer * buffer = &this->buf[this->bufIndex]; - if (buffer->updated && this->sync == 0) + if (buffer->updated && atomic_load(&this->sync) == 0) { this->rIndex = this->bufIndex; if (++this->bufIndex == this->texCount)