- 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.
This commit is contained in:
Christoph Oelckers 2018-03-27 16:48:33 +02:00
parent c06ad5c59c
commit cff5f0e3c7
12 changed files with 5 additions and 98 deletions

View file

@ -738,22 +738,17 @@ void D_Display ()
} }
setmodeneeded = false; setmodeneeded = false;
if (screen->Lock (false))
{
V_SetBorderNeedRefresh(); V_SetBorderNeedRefresh();
}
// [RH] Allow temporarily disabling wipes // [RH] Allow temporarily disabling wipes
if (NoWipe) if (NoWipe)
{ {
V_SetBorderNeedRefresh();
NoWipe--; NoWipe--;
wipe = false; wipe = false;
wipegamestate = gamestate; wipegamestate = gamestate;
} }
else if (gamestate != wipegamestate && gamestate != GS_FULLCONSOLE && gamestate != GS_TITLELEVEL) else if (gamestate != wipegamestate && gamestate != GS_FULLCONSOLE && gamestate != GS_TITLELEVEL)
{ // save the current screen if about to wipe { // save the current screen if about to wipe
V_SetBorderNeedRefresh();
switch (wipegamestate) switch (wipegamestate)
{ {
default: default:
@ -992,7 +987,6 @@ void D_Display ()
void D_ErrorCleanup () void D_ErrorCleanup ()
{ {
savegamerestore = false; savegamerestore = false;
screen->Unlock ();
bglobal.RemoveAllBots (true); bglobal.RemoveAllBots (true);
D_QuitNetGame (); D_QuitNetGame ();
if (demorecording || demoplayback) if (demorecording || demoplayback)

View file

@ -178,7 +178,6 @@ void OpenGLFrameBuffer::Update()
GLRenderer->Flush(); GLRenderer->Flush();
Swap(); Swap();
Unlock();
CheckBench(); CheckBench();
int initialWidth = IsFullscreen() ? VideoWidth : GetClientWidth(); int initialWidth = IsFullscreen() ? VideoWidth : GetClientWidth();

View file

@ -1115,6 +1115,7 @@ int OpenGLSWFrameBuffer::GetPageCount()
// //
//========================================================================== //==========================================================================
#if 0
bool OpenGLSWFrameBuffer::Lock(bool buffered) bool OpenGLSWFrameBuffer::Lock(bool buffered)
{ {
if (m_Lock++ > 0) if (m_Lock++ > 0)
@ -1181,6 +1182,7 @@ void OpenGLSWFrameBuffer::Unlock()
} }
} }
} }
#endif
//========================================================================== //==========================================================================
// //

View file

@ -33,8 +33,6 @@ public:
~OpenGLSWFrameBuffer(); ~OpenGLSWFrameBuffer();
virtual DCanvas *GetCanvas() { return RenderBuffer; } virtual DCanvas *GetCanvas() { return RenderBuffer; }
bool Lock(bool buffered) override;
void Unlock() override;
void Update() override; void Update() override;
PalEntry *GetPalette() override; PalEntry *GetPalette() override;
void GetFlashedPalette(PalEntry palette[256]) override; void GetFlashedPalette(PalEntry palette[256]) override;

View file

@ -187,7 +187,6 @@ void OpenGLFrameBuffer::WipeEndScreen()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 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_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 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. // Sanity checks.
if (wipestartscreen != nullptr && wipeendscreen != nullptr) if (wipestartscreen != nullptr && wipeendscreen != nullptr)
{ {
Lock(true);
gl_RenderState.EnableTexture(true); gl_RenderState.EnableTexture(true);
gl_RenderState.EnableFog(false); gl_RenderState.EnableFog(false);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);

View file

@ -374,9 +374,7 @@ namespace swrenderer
R_ExecuteSetViewSize(MainThread()->Viewport->viewpoint, MainThread()->Viewport->viewwindow); R_ExecuteSetViewSize(MainThread()->Viewport->viewpoint, MainThread()->Viewport->viewwindow);
float trueratio; float trueratio;
ActiveRatio(width, height, &trueratio); ActiveRatio(width, height, &trueratio);
screen->Lock(true);
viewport->SetViewport(MainThread(), width, height, trueratio); viewport->SetViewport(MainThread(), width, height, trueratio);
screen->Unlock();
viewactive = savedviewactive; viewactive = savedviewactive;
} }
@ -389,9 +387,7 @@ namespace swrenderer
int height = SCREENHEIGHT; int height = SCREENHEIGHT;
float trueratio; float trueratio;
ActiveRatio(width, height, &trueratio); ActiveRatio(width, height, &trueratio);
screen->Lock(true);
viewport->SetViewport(MainThread(), SCREENWIDTH, SCREENHEIGHT, trueratio); viewport->SetViewport(MainThread(), SCREENWIDTH, SCREENHEIGHT, trueratio);
screen->Unlock();
} }
void RenderScene::Init() void RenderScene::Init()

View file

@ -108,8 +108,6 @@ public:
Height = height; Height = height;
} }
// These methods should never be called. // These methods should never be called.
bool Lock(bool buffered) { DBGBREAK; return false; }
void Unlock() { DBGBREAK; }
void Update() { DBGBREAK; } void Update() { DBGBREAK; }
PalEntry *GetPalette() { DBGBREAK; return NULL; } PalEntry *GetPalette() { DBGBREAK; return NULL; }
void GetFlashedPalette(PalEntry palette[256]) { DBGBREAK; } void GetFlashedPalette(PalEntry palette[256]) { DBGBREAK; }

View file

@ -296,8 +296,8 @@ public:
// Access control // Access control
virtual bool IsValid() = delete; virtual bool IsValid() = delete;
virtual bool Lock(bool buffered = true) = 0; // Returns true if the surface was lost since last time virtual bool Lock(bool buffered = true) = delete; // Returns true if the surface was lost since last time
virtual void Unlock() = 0; virtual void Unlock() = delete;
// Make the surface visible. Also implies Unlock(). // Make the surface visible. Also implies Unlock().
virtual void Update () = 0; virtual void Update () = 0;

View file

@ -913,53 +913,6 @@ bool D3DFB::IsFullscreen ()
return !Windowed; 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 // D3DFB :: Update

View file

@ -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() bool Win32GLFrameBuffer::IsFullscreen()
{ {
return m_Fullscreen; return m_Fullscreen;

View file

@ -54,10 +54,6 @@ public:
int GetTrueHeight(); int GetTrueHeight();
bool Lock(bool buffered);
bool Lock ();
void Unlock();
bool IsFullscreen(); bool IsFullscreen();

View file

@ -28,9 +28,6 @@ public:
~D3DFB (); ~D3DFB ();
virtual DCanvas *GetCanvas() { return RenderBuffer; } virtual DCanvas *GetCanvas() { return RenderBuffer; }
bool Lock (bool buffered);
void Unlock ();
void Update (); void Update ();
void Flip (); void Flip ();
PalEntry *GetPalette (); PalEntry *GetPalette ();