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