mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[client] egl: there should only ever be a single sync object
This commit is contained in:
parent
7912d268e9
commit
14839dc54e
@ -40,6 +40,12 @@ static void eglTexBuffer_cleanup(TextureBuffer * this)
|
||||
|
||||
if (this->sampler)
|
||||
glDeleteSamplers(1, &this->sampler);
|
||||
|
||||
if (this->sync)
|
||||
{
|
||||
glDeleteSync(this->sync);
|
||||
this->sync = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// common functions
|
||||
@ -186,7 +192,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 && buffer->sync == 0)
|
||||
if (buffer->updated && this->sync == 0)
|
||||
{
|
||||
this->rIndex = this->bufIndex;
|
||||
if (++this->bufIndex == this->texCount)
|
||||
@ -212,7 +218,7 @@ EGL_TexStatus eglTexBuffer_stream_process(EGL_Texture * texture_)
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
buffer->sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
this->sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
glFlush();
|
||||
}
|
||||
|
||||
@ -226,15 +232,14 @@ EGL_TexStatus eglTexBuffer_stream_bind(EGL_Texture * texture_)
|
||||
if (this->rIndex == -1)
|
||||
return EGL_TEX_STATUS_NOTREADY;
|
||||
|
||||
EGL_TexBuffer * buffer = &this->buf[this->rIndex];
|
||||
if (buffer->sync)
|
||||
if (this->sync)
|
||||
{
|
||||
switch(glClientWaitSync(buffer->sync, 0, 20000000)) // 20ms
|
||||
switch(glClientWaitSync(this->sync, 0, 20000000)) // 20ms
|
||||
{
|
||||
case GL_ALREADY_SIGNALED:
|
||||
case GL_CONDITION_SATISFIED:
|
||||
glDeleteSync(buffer->sync);
|
||||
buffer->sync = 0;
|
||||
glDeleteSync(this->sync);
|
||||
this->sync = 0;
|
||||
break;
|
||||
|
||||
case GL_TIMEOUT_EXPIRED:
|
||||
@ -242,8 +247,8 @@ EGL_TexStatus eglTexBuffer_stream_bind(EGL_Texture * texture_)
|
||||
|
||||
case GL_WAIT_FAILED:
|
||||
case GL_INVALID_VALUE:
|
||||
glDeleteSync(buffer->sync);
|
||||
buffer->sync = 0;
|
||||
glDeleteSync(this->sync);
|
||||
this->sync = 0;
|
||||
DEBUG_GL_ERROR("glClientWaitSync failed");
|
||||
return EGL_TEX_STATUS_ERROR;
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ typedef struct TextureBuffer
|
||||
GLuint tex[2];
|
||||
GLuint sampler;
|
||||
EGL_TexBuffer buf[2];
|
||||
int bufFree;
|
||||
GLsync sync;
|
||||
LG_Lock copyLock;
|
||||
int bufIndex;
|
||||
int rIndex;
|
||||
|
@ -124,12 +124,6 @@ void eglTexUtilFreeBuffers(EGL_TexBuffer * buffers, int count)
|
||||
|
||||
eglTexUtilUnmapBuffer(buffer);
|
||||
glDeleteBuffers(1, &buffer->pbo);
|
||||
if (buffer->sync)
|
||||
{
|
||||
glDeleteSync(buffer->sync);
|
||||
buffer->sync = 0;
|
||||
}
|
||||
|
||||
buffer->pbo = 0;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ typedef struct EGL_TexBuffer
|
||||
size_t size;
|
||||
GLuint pbo;
|
||||
void * map;
|
||||
GLsync sync;
|
||||
bool updated;
|
||||
}
|
||||
EGL_TexBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user