From 35d1e1e9d5f6998020cff8f683db6c39e106ffed Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 30 Mar 2015 08:47:55 +0200 Subject: [PATCH] Add input lag reduction test --HG-- branch : opengl3 --- code/nel/src/3d/driver/opengl3/driver_opengl.cpp | 6 ++++++ code/nel/src/3d/driver/opengl3/driver_opengl.h | 1 + 2 files changed, 7 insertions(+) diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp index 55bd2422b..0bf8378e2 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp @@ -690,6 +690,12 @@ bool CDriverGL3::swapBuffers() // Check all vertex buffer to see which one are lost updateLostBuffers(); + +#if NL3D_GL3_SYNC_IMMEDIATE + // Sync on the current buffer + nlassert(_SwapBufferSync[syncI]); + nglClientWaitSync(_SwapBufferSync[syncI], 0, 1000000000ULL); +#endif // Check in flight buffers, also checks the current one for (size_t i = 0; i < NL3D_GL3_FRAME_QUEUE_MAX; ++i) diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.h b/code/nel/src/3d/driver/opengl3/driver_opengl.h index 5a46fc0ae..1842db4ad 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.h @@ -84,6 +84,7 @@ using NLMISC::CVector; #define NL3D_GL3_BUFFER_NOT_IN_FLIGHT (std::numeric_limits::max()) #define NL3D_GL3_FRAME_QUEUE_MAX (2) // Maximum is three frames processing (2 frames backlog + current frame) #define NL3D_GL3_BUFFER_QUEUE_MAX (NL3D_GL3_FRAME_QUEUE_MAX + 1) // Additional buffer for current working +#define NL3D_GL3_SYNC_IMMEDIATE 0 // Don't allow frame processing backlog if set to 1. Reduce input lag. Testing only namespace NL3D { namespace NLDRIVERGL3 {