mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[client] use glFinish to prevent buffering and re-enable by default
This commit is contained in:
parent
116926f7c0
commit
b3aadccfc4
@ -40,9 +40,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#define MOUSE_TEXTURE 1
|
#define MOUSE_TEXTURE 1
|
||||||
#define TEXTURE_COUNT 2
|
#define TEXTURE_COUNT 2
|
||||||
|
|
||||||
static PFNGLXGETVIDEOSYNCSGIPROC glXGetVideoSyncSGI = NULL;
|
|
||||||
static PFNGLXWAITVIDEOSYNCSGIPROC glXWaitVideoSyncSGI = NULL;
|
|
||||||
|
|
||||||
struct Options
|
struct Options
|
||||||
{
|
{
|
||||||
bool mipmap;
|
bool mipmap;
|
||||||
@ -55,7 +52,7 @@ static struct Options defaultOptions =
|
|||||||
{
|
{
|
||||||
.mipmap = true,
|
.mipmap = true,
|
||||||
.vsync = true,
|
.vsync = true,
|
||||||
.preventBuffer = false,
|
.preventBuffer = true,
|
||||||
.amdPinnedMem = true,
|
.amdPinnedMem = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -99,7 +96,6 @@ struct Inst
|
|||||||
void * decoderFrames[BUFFER_COUNT];
|
void * decoderFrames[BUFFER_COUNT];
|
||||||
GLuint textures[TEXTURE_COUNT];
|
GLuint textures[TEXTURE_COUNT];
|
||||||
|
|
||||||
uint gpuFrameCount;
|
|
||||||
bool fpsTexture;
|
bool fpsTexture;
|
||||||
uint64_t lastFrameTime;
|
uint64_t lastFrameTime;
|
||||||
uint64_t renderTime;
|
uint64_t renderTime;
|
||||||
@ -165,19 +161,6 @@ bool opengl_initialize(void * opaque, Uint32 * sdlFlags)
|
|||||||
if (!this)
|
if (!this)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!glXGetVideoSyncSGI)
|
|
||||||
{
|
|
||||||
glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC )glXGetProcAddress((const GLubyte *)"glXGetVideoSyncSGI" );
|
|
||||||
glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)glXGetProcAddress((const GLubyte *)"glXWaitVideoSyncSGI");
|
|
||||||
|
|
||||||
if (!glXGetVideoSyncSGI || !glXWaitVideoSyncSGI)
|
|
||||||
{
|
|
||||||
glXGetVideoSyncSGI = NULL;
|
|
||||||
DEBUG_ERROR("Failed to get proc addresses");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*sdlFlags = SDL_WINDOW_OPENGL;
|
*sdlFlags = SDL_WINDOW_OPENGL;
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
return true;
|
return true;
|
||||||
@ -424,14 +407,8 @@ bool opengl_render(void * opaque, SDL_Window * window)
|
|||||||
|
|
||||||
if (this->opt.preventBuffer)
|
if (this->opt.preventBuffer)
|
||||||
{
|
{
|
||||||
unsigned int before, after;
|
|
||||||
glXGetVideoSyncSGI(&before);
|
|
||||||
SDL_GL_SwapWindow(window);
|
SDL_GL_SwapWindow(window);
|
||||||
|
glFinish();
|
||||||
// wait for the swap to happen to ensure we dont buffer frames
|
|
||||||
glXGetVideoSyncSGI(&after);
|
|
||||||
if (before == after)
|
|
||||||
glXWaitVideoSyncSGI(1, 0, &before);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SDL_GL_SwapWindow(window);
|
SDL_GL_SwapWindow(window);
|
||||||
@ -799,7 +776,6 @@ static bool configure(struct Inst * this, SDL_Window *window)
|
|||||||
|
|
||||||
this->resizeWindow = true;
|
this->resizeWindow = true;
|
||||||
this->drawStart = nanotime();
|
this->drawStart = nanotime();
|
||||||
glXGetVideoSyncSGI(&this->gpuFrameCount);
|
|
||||||
|
|
||||||
this->configured = true;
|
this->configured = true;
|
||||||
this->reconfigure = false;
|
this->reconfigure = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user