-fixed: When performing a restart the SW scene drawer's resources should be reset because they are outside the control of higher level containers.

This commit is contained in:
Christoph Oelckers 2018-04-08 08:03:46 +02:00
parent 0a2c415dbe
commit 1897073b60
6 changed files with 18 additions and 1 deletions

View file

@ -2738,6 +2738,7 @@ void D_DoomMain (void)
M_SaveDefaults(NULL); // save config before the restart M_SaveDefaults(NULL); // save config before the restart
// delete all data that cannot be left until reinitialization // delete all data that cannot be left until reinitialization
screen->CleanForRestart();
V_ClearFonts(); // must clear global font pointers V_ClearFonts(); // must clear global font pointers
ColorSets.Clear(); ColorSets.Clear();
PainFlashes.Clear(); PainFlashes.Clear();

View file

@ -361,6 +361,13 @@ int FGLRenderer::ScreenToWindowY(int y)
// //
//=========================================================================== //===========================================================================
void FGLRenderer::ResetSWScene()
{
// force recreation of the SW scene drawer to ensure it gets a new set of resources.
if (swdrawer != nullptr) delete swdrawer;
swdrawer = nullptr;
}
void FGLRenderer::SetupLevel() void FGLRenderer::SetupLevel()
{ {
mVBO->CreateVBO(); mVBO->CreateVBO();

View file

@ -172,6 +172,7 @@ public:
void FlushTextures(); void FlushTextures();
void SetupLevel(); void SetupLevel();
void ResetSWScene();
void RenderScreenQuad(); void RenderScreenQuad();
void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D); void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D);

View file

@ -385,6 +385,12 @@ bool OpenGLFrameBuffer::SetContrast(float contrast)
// //
//=========================================================================== //===========================================================================
void OpenGLFrameBuffer::CleanForRestart()
{
if (GLRenderer)
GLRenderer->ResetSWScene();
}
void OpenGLFrameBuffer::UpdatePalette() void OpenGLFrameBuffer::UpdatePalette()
{ {
if (GLRenderer) if (GLRenderer)

View file

@ -39,6 +39,7 @@ public:
bool SetContrast(float contrast); bool SetContrast(float contrast);
void DoSetGamma(); void DoSetGamma();
void CleanForRestart() override;
void UpdatePalette() override; void UpdatePalette() override;
void GetFlashedPalette (PalEntry pal[256]) override; void GetFlashedPalette (PalEntry pal[256]) override;
PalEntry *GetPalette () override; PalEntry *GetPalette () override;

View file

@ -355,7 +355,8 @@ public:
// Set the rect defining the area affected by blending. // Set the rect defining the area affected by blending.
virtual void SetBlendingRect (int x1, int y1, int x2, int y2); virtual void SetBlendingRect (int x1, int y1, int x2, int y2);
virtual bool LegacyHardware() const { return false; } // only for reporting SM1.4 support to the stat collector // Delete any resources that need to be deleted after restarting with a different IWAD
virtual void CleanForRestart() {}
// Begin 2D drawing operations. // Begin 2D drawing operations.
// Returns true if hardware-accelerated 2D has been entered, false if not. // Returns true if hardware-accelerated 2D has been entered, false if not.