From 86fcb28d4d4f15fe15e6a6f86381d4925e02bb9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 13 Aug 2023 18:13:03 +0200 Subject: [PATCH] Remove "bool retainControl_" for simplicity. Not needed. --- Common/GPU/OpenGL/GLRenderManager.cpp | 11 ++--------- Common/GPU/OpenGL/GLRenderManager.h | 4 +--- SDL/SDLGLGraphicsContext.cpp | 2 +- Windows/GPU/WindowsGLContext.cpp | 2 +- headless/SDLHeadlessHost.cpp | 2 +- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Common/GPU/OpenGL/GLRenderManager.cpp b/Common/GPU/OpenGL/GLRenderManager.cpp index 6026443f48..d9130dd4bb 100644 --- a/Common/GPU/OpenGL/GLRenderManager.cpp +++ b/Common/GPU/OpenGL/GLRenderManager.cpp @@ -354,8 +354,8 @@ void GLRenderManager::BeginFrame(bool enableProfiling) { frameData.profile.enabled = enableProfiling; { - VLOG("PUSH: BeginFrame (curFrame = %d, readyForFence = %d, time=%0.3f)", curFrame, (int)frameData.readyForFence, time_now_d()); std::unique_lock lock(frameData.fenceMutex); + VLOG("PUSH: BeginFrame (curFrame = %d, readyForFence = %d, time=%0.3f)", curFrame, (int)frameData.readyForFence, time_now_d()); while (!frameData.readyForFence) { frameData.fenceCondVar.wait(lock); } @@ -477,14 +477,8 @@ bool GLRenderManager::Run(GLRRenderThreadTask &task) { if (swapFunction_) { VLOG(" PULL: SwapFunction()"); swapFunction_(); - if (!retainControl_) { - // get out of here. - swapRequest = true; - } - } else { - VLOG(" PULL: SwapRequested"); - swapRequest = true; } + swapRequest = true; } else { frameData.skipSwap = false; } @@ -498,7 +492,6 @@ bool GLRenderManager::Run(GLRRenderThreadTask &task) { frameData.fenceCondVar.notify_one(); // At this point, we're done with this framedata (for now). } - break; case GLRRunType::SYNC: diff --git a/Common/GPU/OpenGL/GLRenderManager.h b/Common/GPU/OpenGL/GLRenderManager.h index 5cfc5711ed..5d3457d9ac 100644 --- a/Common/GPU/OpenGL/GLRenderManager.h +++ b/Common/GPU/OpenGL/GLRenderManager.h @@ -810,9 +810,8 @@ public: _dbg_assert_(foundCount == 1); } - void SetSwapFunction(std::function swapFunction, bool retainControl) { + void SetSwapFunction(std::function swapFunction) { swapFunction_ = swapFunction; - retainControl_ = retainControl; } void SetSwapIntervalFunction(std::function swapIntervalFunction) { @@ -891,7 +890,6 @@ private: std::function swapFunction_; std::function swapIntervalFunction_; - bool retainControl_ = false; GLBufferStrategy bufferStrategy_ = GLBufferStrategy::SUBDATA; int inflightFrames_ = MAX_INFLIGHT_FRAMES; diff --git a/SDL/SDLGLGraphicsContext.cpp b/SDL/SDLGLGraphicsContext.cpp index 91b89a4966..462cf25996 100644 --- a/SDL/SDLGLGraphicsContext.cpp +++ b/SDL/SDLGLGraphicsContext.cpp @@ -429,7 +429,7 @@ int SDLGLGraphicsContext::Init(SDL_Window *&window, int x, int y, int w, int h, #else SDL_GL_SwapWindow(window_); #endif - }, false); + }); renderManager_->SetSwapIntervalFunction([&](int interval) { INFO_LOG(G3D, "SDL SwapInterval: %d", interval); diff --git a/Windows/GPU/WindowsGLContext.cpp b/Windows/GPU/WindowsGLContext.cpp index 7aa965967c..a4aa0e511a 100644 --- a/Windows/GPU/WindowsGLContext.cpp +++ b/Windows/GPU/WindowsGLContext.cpp @@ -432,7 +432,7 @@ bool WindowsGLContext::InitFromRenderThread(std::string *error_message) { renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); renderManager_->SetInflightFrames(g_Config.iInflightFrames); SetGPUBackend(GPUBackend::OPENGL); - renderManager_->SetSwapFunction([&]() {::SwapBuffers(hDC); }, true); + renderManager_->SetSwapFunction([&]() {::SwapBuffers(hDC); }); if (wglSwapIntervalEXT) { // glew loads wglSwapIntervalEXT if available renderManager_->SetSwapIntervalFunction([&](int interval) { diff --git a/headless/SDLHeadlessHost.cpp b/headless/SDLHeadlessHost.cpp index c4cfbc616b..5d6fede8b8 100644 --- a/headless/SDLHeadlessHost.cpp +++ b/headless/SDLHeadlessHost.cpp @@ -165,7 +165,7 @@ bool GLDummyGraphicsContext::InitFromRenderThread(std::string *errorMessage) { _assert_(success); renderManager_->SetSwapFunction([&]() { SDL_GL_SwapWindow(screen_); - }, false); + }); return success; }