mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 22:01:46 +00:00
[client] egl: improved streaming texture syncronization
This commit is contained in:
parent
e93bd7a3bf
commit
6d2c464436
3 changed files with 20 additions and 15 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
fetch-4-gf7d2295dab+1
|
||||
fetch-4-ge93bd7a3bf+1
|
|
@ -19,6 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
|
||||
#include "texture.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/locking.h"
|
||||
#include "debug.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -44,14 +45,14 @@ struct EGL_Texture
|
|||
GLenum format;
|
||||
GLenum dataType;
|
||||
|
||||
bool hasPBO;
|
||||
GLuint pbo[2];
|
||||
int pboRIndex;
|
||||
int pboWIndex;
|
||||
int pboCount;
|
||||
size_t pboBufferSize;
|
||||
void * pboMap[2];
|
||||
GLsync pboSync[2];
|
||||
bool hasPBO;
|
||||
GLuint pbo[2];
|
||||
int pboRIndex;
|
||||
int pboWIndex;
|
||||
volatile int pboCount;
|
||||
size_t pboBufferSize;
|
||||
void * pboMap[2];
|
||||
GLsync pboSync[2];
|
||||
};
|
||||
|
||||
bool egl_texture_init(EGL_Texture ** texture)
|
||||
|
@ -259,7 +260,7 @@ bool egl_texture_update(EGL_Texture * texture, const uint8_t * buffer)
|
|||
|
||||
if (++texture->pboWIndex == 2)
|
||||
texture->pboWIndex = 0;
|
||||
++texture->pboCount;
|
||||
INTERLOCKED_INC(&texture->pboCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -303,7 +304,7 @@ enum EGL_TexStatus egl_texture_process(EGL_Texture * texture)
|
|||
|
||||
/* wait for the buffer to be ready */
|
||||
pos = texture->pboRIndex;
|
||||
switch(glClientWaitSync(texture->pboSync[pos], GL_SYNC_FLUSH_COMMANDS_BIT, 0))
|
||||
switch(glClientWaitSync(texture->pboSync[pos], 0, 0))
|
||||
{
|
||||
case GL_ALREADY_SIGNALED:
|
||||
case GL_CONDITION_SATISFIED:
|
||||
|
@ -337,7 +338,7 @@ enum EGL_TexStatus egl_texture_process(EGL_Texture * texture)
|
|||
/* advance the read index */
|
||||
if (++texture->pboRIndex == 2)
|
||||
texture->pboRIndex = 0;
|
||||
--texture->pboCount;
|
||||
INTERLOCKED_DEC(&texture->pboCount);
|
||||
|
||||
texture->ready = true;
|
||||
|
||||
|
|
|
@ -19,9 +19,13 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#pragma once
|
||||
|
||||
#if defined(__GCC__) || defined(__GNUC__)
|
||||
#define INTERLOCKED_AND8 __sync_fetch_and_and
|
||||
#define INTERLOCKED_OR8 __sync_fetch_and_or
|
||||
#define INTERLOCKED_AND8 __sync_fetch_and_and
|
||||
#define INTERLOCKED_OR8 __sync_fetch_and_or
|
||||
#define INTERLOCKED_INC(x) __sync_fetch_and_add((x), 1)
|
||||
#define INTERLOCKED_DEC(x) __sync_fetch_and_sub((x), 1)
|
||||
#else
|
||||
#define INTERLOCKED_OR8 InterlockedOr8
|
||||
#define INTERLOCKED_OR8 InterlockedOr8
|
||||
#define INTERLOCKED_AND8 InterlockedAnd8
|
||||
#define INTERLOCKED_INC InterlockedIncrement
|
||||
#define INTERLOCKED_DEC InterlockedDecrement
|
||||
#endif
|
Loading…
Reference in a new issue