Remove "bool retainControl_" for simplicity. Not needed.

This commit is contained in:
Henrik Rydgård 2023-08-13 18:13:03 +02:00
parent f7b8075d05
commit 86fcb28d4d
5 changed files with 6 additions and 15 deletions

View file

@ -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<std::mutex> 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:

View file

@ -810,9 +810,8 @@ public:
_dbg_assert_(foundCount == 1);
}
void SetSwapFunction(std::function<void()> swapFunction, bool retainControl) {
void SetSwapFunction(std::function<void()> swapFunction) {
swapFunction_ = swapFunction;
retainControl_ = retainControl;
}
void SetSwapIntervalFunction(std::function<void(int)> swapIntervalFunction) {
@ -891,7 +890,6 @@ private:
std::function<void()> swapFunction_;
std::function<void(int)> swapIntervalFunction_;
bool retainControl_ = false;
GLBufferStrategy bufferStrategy_ = GLBufferStrategy::SUBDATA;
int inflightFrames_ = MAX_INFLIGHT_FRAMES;

View file

@ -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);

View file

@ -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) {

View file

@ -165,7 +165,7 @@ bool GLDummyGraphicsContext::InitFromRenderThread(std::string *errorMessage) {
_assert_(success);
renderManager_->SetSwapFunction([&]() {
SDL_GL_SwapWindow(screen_);
}, false);
});
return success;
}