From cff5f0e3c75c59d68ed738ba6d42866e60887f75 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 27 Mar 2018 16:48:33 +0200 Subject: [PATCH] - removed DFrameBuffer's locking mechanism. In its current form this is quite useless. What's really needed is to require a lock on the RenderBuffer for the 3D scene, but since this is not needed for the 2D stuff anymore it can be done far simpler. --- src/d_main.cpp | 8 +---- src/gl/system/gl_framebuffer.cpp | 1 - src/gl/system/gl_swframebuffer.cpp | 2 ++ src/gl/system/gl_swframebuffer.h | 2 -- src/gl/system/gl_wipe.cpp | 3 -- src/swrenderer/scene/r_scene.cpp | 4 --- src/v_video.cpp | 2 -- src/v_video.h | 4 +-- src/win32/fb_d3d9.cpp | 47 ------------------------------ src/win32/win32gliface.cpp | 23 --------------- src/win32/win32gliface.h | 4 --- src/win32/win32swiface.h | 3 -- 12 files changed, 5 insertions(+), 98 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index b101c555e..6002a5672 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -738,22 +738,17 @@ void D_Display () } setmodeneeded = false; - if (screen->Lock (false)) - { - V_SetBorderNeedRefresh(); - } + V_SetBorderNeedRefresh(); // [RH] Allow temporarily disabling wipes if (NoWipe) { - V_SetBorderNeedRefresh(); NoWipe--; wipe = false; wipegamestate = gamestate; } else if (gamestate != wipegamestate && gamestate != GS_FULLCONSOLE && gamestate != GS_TITLELEVEL) { // save the current screen if about to wipe - V_SetBorderNeedRefresh(); switch (wipegamestate) { default: @@ -992,7 +987,6 @@ void D_Display () void D_ErrorCleanup () { savegamerestore = false; - screen->Unlock (); bglobal.RemoveAllBots (true); D_QuitNetGame (); if (demorecording || demoplayback) diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 15b9aa306..490f31bd2 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -178,7 +178,6 @@ void OpenGLFrameBuffer::Update() GLRenderer->Flush(); Swap(); - Unlock(); CheckBench(); int initialWidth = IsFullscreen() ? VideoWidth : GetClientWidth(); diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index b92a36c86..17130e0aa 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -1115,6 +1115,7 @@ int OpenGLSWFrameBuffer::GetPageCount() // //========================================================================== +#if 0 bool OpenGLSWFrameBuffer::Lock(bool buffered) { if (m_Lock++ > 0) @@ -1181,6 +1182,7 @@ void OpenGLSWFrameBuffer::Unlock() } } } +#endif //========================================================================== // diff --git a/src/gl/system/gl_swframebuffer.h b/src/gl/system/gl_swframebuffer.h index de6a35e59..5123526df 100644 --- a/src/gl/system/gl_swframebuffer.h +++ b/src/gl/system/gl_swframebuffer.h @@ -33,8 +33,6 @@ public: ~OpenGLSWFrameBuffer(); virtual DCanvas *GetCanvas() { return RenderBuffer; } - bool Lock(bool buffered) override; - void Unlock() override; void Update() override; PalEntry *GetPalette() override; void GetFlashedPalette(PalEntry palette[256]) override; diff --git a/src/gl/system/gl_wipe.cpp b/src/gl/system/gl_wipe.cpp index db03f99c1..36b8ca815 100644 --- a/src/gl/system/gl_wipe.cpp +++ b/src/gl/system/gl_wipe.cpp @@ -187,7 +187,6 @@ void OpenGLFrameBuffer::WipeEndScreen() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - Unlock(); } //========================================================================== @@ -208,8 +207,6 @@ bool OpenGLFrameBuffer::WipeDo(int ticks) // Sanity checks. if (wipestartscreen != nullptr && wipeendscreen != nullptr) { - Lock(true); - gl_RenderState.EnableTexture(true); gl_RenderState.EnableFog(false); glDisable(GL_DEPTH_TEST); diff --git a/src/swrenderer/scene/r_scene.cpp b/src/swrenderer/scene/r_scene.cpp index 4deba320e..469b59033 100644 --- a/src/swrenderer/scene/r_scene.cpp +++ b/src/swrenderer/scene/r_scene.cpp @@ -374,9 +374,7 @@ namespace swrenderer R_ExecuteSetViewSize(MainThread()->Viewport->viewpoint, MainThread()->Viewport->viewwindow); float trueratio; ActiveRatio(width, height, &trueratio); - screen->Lock(true); viewport->SetViewport(MainThread(), width, height, trueratio); - screen->Unlock(); viewactive = savedviewactive; } @@ -389,9 +387,7 @@ namespace swrenderer int height = SCREENHEIGHT; float trueratio; ActiveRatio(width, height, &trueratio); - screen->Lock(true); viewport->SetViewport(MainThread(), SCREENWIDTH, SCREENHEIGHT, trueratio); - screen->Unlock(); } void RenderScene::Init() diff --git a/src/v_video.cpp b/src/v_video.cpp index fa01a8ec6..b8ea448b6 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -108,8 +108,6 @@ public: Height = height; } // These methods should never be called. - bool Lock(bool buffered) { DBGBREAK; return false; } - void Unlock() { DBGBREAK; } void Update() { DBGBREAK; } PalEntry *GetPalette() { DBGBREAK; return NULL; } void GetFlashedPalette(PalEntry palette[256]) { DBGBREAK; } diff --git a/src/v_video.h b/src/v_video.h index 1173de177..50d3d6cc3 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -296,8 +296,8 @@ public: // Access control virtual bool IsValid() = delete; - virtual bool Lock(bool buffered = true) = 0; // Returns true if the surface was lost since last time - virtual void Unlock() = 0; + virtual bool Lock(bool buffered = true) = delete; // Returns true if the surface was lost since last time + virtual void Unlock() = delete; // Make the surface visible. Also implies Unlock(). virtual void Update () = 0; diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 12e04f1b5..127561270 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -913,53 +913,6 @@ bool D3DFB::IsFullscreen () return !Windowed; } -//========================================================================== -// -// D3DFB :: Lock -// -//========================================================================== - -bool D3DFB::Lock (bool buffered) -{ - if (LockCount++ > 0) - { - return false; - } - assert (!In2D); - Accel2D = vid_hw2d; -#if 0 - Buffer = MemBuffer; -#endif - return false; -} - -//========================================================================== -// -// D3DFB :: Unlock -// -//========================================================================== - -void D3DFB::Unlock () -{ - LOG1 ("Unlock <%d>\n", LockCount); - - if (LockCount == 0) - { - return; - } - - if (UpdatePending && LockCount == 1) - { - Update (); - } - else if (--LockCount == 0) - { -#if 0 - Buffer = NULL; -#endif - } -} - //========================================================================== // // D3DFB :: Update diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 7bb64d2ed..0093961a2 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -1166,29 +1166,6 @@ void Win32GLFrameBuffer::SetGammaTable(uint16_t *tbl) // //========================================================================== -bool Win32GLFrameBuffer::Lock(bool buffered) -{ - m_Lock++; - //Buffer = MemBuffer; - return true; -} - -bool Win32GLFrameBuffer::Lock () -{ - return Lock(false); -} - -void Win32GLFrameBuffer::Unlock () -{ - m_Lock--; -} - -//========================================================================== -// -// -// -//========================================================================== - bool Win32GLFrameBuffer::IsFullscreen() { return m_Fullscreen; diff --git a/src/win32/win32gliface.h b/src/win32/win32gliface.h index d34d970b5..f57c52b90 100644 --- a/src/win32/win32gliface.h +++ b/src/win32/win32gliface.h @@ -54,10 +54,6 @@ public: int GetTrueHeight(); - bool Lock(bool buffered); - bool Lock (); - void Unlock(); - bool IsFullscreen(); diff --git a/src/win32/win32swiface.h b/src/win32/win32swiface.h index 12e2be755..d3c68d306 100644 --- a/src/win32/win32swiface.h +++ b/src/win32/win32swiface.h @@ -28,9 +28,6 @@ public: ~D3DFB (); virtual DCanvas *GetCanvas() { return RenderBuffer; } - - bool Lock (bool buffered); - void Unlock (); void Update (); void Flip (); PalEntry *GetPalette ();