Also use events for config changed

This commit is contained in:
Scott Mansell 2023-01-31 00:49:23 +13:00
parent 0da69055d9
commit 3ae78b8e76
11 changed files with 46 additions and 13 deletions

View file

@ -16,6 +16,11 @@
std::unique_ptr<AbstractGfx> g_gfx;
AbstractGfx::AbstractGfx()
{
ConfigChangedEvent::Register([this](u32 bits) { OnConfigChanged(bits); }, "AbstractGfx");
}
bool AbstractGfx::IsHeadless() const
{
return true;
@ -132,6 +137,16 @@ std::unique_ptr<VideoCommon::AsyncShaderCompiler> AbstractGfx::CreateAsyncShader
return std::make_unique<VideoCommon::AsyncShaderCompiler>();
}
void AbstractGfx::OnConfigChanged(u32 changed_bits)
{
// If there's any shader changes, wait for the GPU to finish before destroying anything.
if (changed_bits & (CONFIG_CHANGE_BIT_HOST_CONFIG | CONFIG_CHANGE_BIT_MULTISAMPLES))
{
WaitForGPUIdle();
SetPipeline(nullptr);
}
}
bool AbstractGfx::UseGeometryShaderForUI() const
{
// OpenGL doesn't render to a 2-layer backbuffer like D3D/Vulkan for quad-buffered stereo,