From 3331fedab79d68352f0e609a7d649c905950655e Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 15 Sep 2022 00:03:41 +0200 Subject: [PATCH] OpenXR - Better variable/methods naming --- Common/GPU/OpenGL/GLRenderManager.cpp | 16 ++++++++-------- Common/GPU/OpenGL/GLRenderManager.h | 1 + Common/VR/PPSSPPVR.cpp | 4 ++-- Common/VR/PPSSPPVR.h | 8 ++++---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Common/GPU/OpenGL/GLRenderManager.cpp b/Common/GPU/OpenGL/GLRenderManager.cpp index a179697f3a..ae5cb9dd17 100644 --- a/Common/GPU/OpenGL/GLRenderManager.cpp +++ b/Common/GPU/OpenGL/GLRenderManager.cpp @@ -200,7 +200,6 @@ bool GLRenderManager::ThreadFrame() { std::unique_lock lock(mutex_); if (!run_) return false; - bool vrlock = false; // In case of syncs or other partial completion, we keep going until we complete a frame. do { @@ -237,11 +236,11 @@ bool GLRenderManager::ThreadFrame() { firstFrame = false; } - // Creation of OpenXR frame. This updates user's head pose and VR timestamps. - // For fluent rendering, the time between PreVRRender and PostVRRender must be really short. - if (IsVRBuild() && !vrlock) { - if (PreVRRender()) { - vrlock = true; + // Start of an OpenXR frame. This updates user's head pose and VR timestamps. + // For fluent rendering, delay between StartVRRender and FinishVRRender must be very short. + if (IsVRBuild() && !vrRenderStarted) { + if (StartVRRender()) { + vrRenderStarted = true; } else { return false; } @@ -254,8 +253,9 @@ bool GLRenderManager::ThreadFrame() { } while (!nextFrame); // Post OpenXR frame on a screen. - if (IsVRBuild() && vrlock) { - PostVRRender(); + if (IsVRBuild() && vrRenderStarted) { + FinishVRRender(); + vrRenderStarted = false; } return true; diff --git a/Common/GPU/OpenGL/GLRenderManager.h b/Common/GPU/OpenGL/GLRenderManager.h index 5423262c98..719603863e 100644 --- a/Common/GPU/OpenGL/GLRenderManager.h +++ b/Common/GPU/OpenGL/GLRenderManager.h @@ -1041,6 +1041,7 @@ private: bool nextFrame = false; bool firstFrame = true; + bool vrRenderStarted = false; GLDeleter deleter_; bool skipGLCalls_ = false; diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index 71b4919bf1..1e0931ebfe 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -220,7 +220,7 @@ void BindVRFramebuffer() { VR_BindFramebuffer(VR_GetEngine()); } -bool PreVRRender() { +bool StartVRRender() { if (!VR_GetConfig(VR_CONFIG_VIEWPORT_VALID)) { VR_InitRenderer(VR_GetEngine(), IsMultiviewSupported()); VR_SetConfig(VR_CONFIG_VIEWPORT_VALID, true); @@ -245,7 +245,7 @@ bool PreVRRender() { return false; } -void PostVRRender() { +void FinishVRRender() { VR_FinishFrame(VR_GetEngine()); } diff --git a/Common/VR/PPSSPPVR.h b/Common/VR/PPSSPPVR.h index e7151130ea..cf385735db 100644 --- a/Common/VR/PPSSPPVR.h +++ b/Common/VR/PPSSPPVR.h @@ -15,8 +15,8 @@ void UpdateVRScreenKey(const KeyInput &key); // VR rendering integration void BindVRFramebuffer(); -bool PreVRRender(); -void PostVRRender(); +bool StartVRRender(); +void FinishVRRender(); void PreVRFrameRender(int fboIndex); void PostVRFrameRender(); int GetVRFBOIndex(); @@ -38,8 +38,8 @@ inline void UpdateVRScreenKey(const KeyInput &key) {} // VR rendering integration inline void BindVRFramebuffer() {} -inline bool PreVRRender() { return false; } -inline void PostVRRender() {} +inline bool StartVRRender() { return false; } +inline void FinishVRRender() {} inline void PreVRFrameRender(int fboIndex) {} inline void PostVRFrameRender() {} inline int GetVRFBOIndex() { return 0; }