mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-04-21 18:30:51 +00:00
- allow to reload shaders on restart.
Works on OpenGL but not on Vulkan.
This commit is contained in:
parent
d83bf72926
commit
ddce4e6da3
6 changed files with 28 additions and 0 deletions
|
@ -2449,6 +2449,10 @@ void D_DoomMain (void)
|
|||
// This allocates a dummy framebuffer as a stand-in until V_Init2 is called.
|
||||
V_InitScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->ReloadState();
|
||||
}
|
||||
|
||||
GameConfig->DoKeySetup(gameinfo.ConfigName);
|
||||
|
||||
|
|
|
@ -101,6 +101,22 @@ OpenGLFrameBuffer::~OpenGLFrameBuffer()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// The entire state is encapsulated in GLRenderer, so deleting
|
||||
// and recreating that woll do what we need, most importantly
|
||||
// recompilation of the shaders.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void OpenGLFrameBuffer::ReloadState()
|
||||
{
|
||||
if (GLRenderer) delete GLRenderer;
|
||||
GLRenderer = new FGLRenderer(this);
|
||||
GLRenderer->Initialize(GetWidth(), GetHeight());
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Initializes the GL renderer
|
||||
|
|
|
@ -22,6 +22,7 @@ public:
|
|||
~OpenGLFrameBuffer();
|
||||
|
||||
void InitializeState() override;
|
||||
void ReloadState() override;
|
||||
void Update() override;
|
||||
|
||||
void CleanForRestart() override;
|
||||
|
|
|
@ -393,6 +393,7 @@ public:
|
|||
DFrameBuffer (int width=1, int height=1);
|
||||
virtual ~DFrameBuffer();
|
||||
virtual void InitializeState() = 0; // For stuff that needs 'screen' set.
|
||||
virtual void ReloadState() = 0;
|
||||
virtual bool IsVulkan() { return false; }
|
||||
|
||||
void SetSize(int width, int height);
|
||||
|
|
|
@ -184,6 +184,11 @@ void VulkanFrameBuffer::InitializeState()
|
|||
}
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::ReloadState()
|
||||
{
|
||||
InitializeState();
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::Update()
|
||||
{
|
||||
twoD.Reset();
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
void Update();
|
||||
|
||||
void InitializeState() override;
|
||||
void ReloadState() override;
|
||||
|
||||
void CleanForRestart() override;
|
||||
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
||||
|
|
Loading…
Reference in a new issue