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

@ -169,6 +169,8 @@ void Gfx::PresentBackbuffer()
void Gfx::OnConfigChanged(u32 bits)
{
AbstractGfx::OnConfigChanged(bits);
// Quad-buffer changes require swap chain recreation.
if (bits & CONFIG_CHANGE_BIT_STEREO_MODE && m_swap_chain)
m_swap_chain->SetStereo(SwapChain::WantsStereo());

View File

@ -437,6 +437,8 @@ SurfaceInfo Gfx::GetSurfaceInfo() const
void Gfx::OnConfigChanged(u32 bits)
{
AbstractGfx::OnConfigChanged(bits);
// For quad-buffered stereo we need to change the layer count, so recreate the swap chain.
if (m_swap_chain && bits & CONFIG_CHANGE_BIT_STEREO_MODE)
{

View File

@ -273,6 +273,8 @@ void Metal::Gfx::WaitForGPUIdle()
void Metal::Gfx::OnConfigChanged(u32 bits)
{
AbstractGfx::OnConfigChanged(bits);
if (bits & CONFIG_CHANGE_BIT_VSYNC)
[m_layer setDisplaySyncEnabled:g_ActiveConfig.bVSyncActive];

View File

@ -436,6 +436,8 @@ void OGLGfx::PresentBackbuffer()
void OGLGfx::OnConfigChanged(u32 bits)
{
AbstractGfx::OnConfigChanged(bits);
if (bits & CONFIG_CHANGE_BIT_VSYNC && !DriverDetails::HasBug(DriverDetails::BUG_BROKEN_VSYNC))
m_main_gl_context->SwapInterval(g_ActiveConfig.bVSyncActive);

View File

@ -369,6 +369,8 @@ void VKGfx::CheckForSurfaceResize()
void VKGfx::OnConfigChanged(u32 bits)
{
AbstractGfx::OnConfigChanged(bits);
if (bits & CONFIG_CHANGE_BIT_HOST_CONFIG)
g_object_cache->ReloadPipelineCache();

View File

@ -239,7 +239,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
auto perf_query = std::make_unique<PerfQuery>();
auto bounding_box = std::make_unique<VKBoundingBox>();
return !InitializeShared(std::move(gfx), std::move(vertex_manager), std::move(perf_query),
return InitializeShared(std::move(gfx), std::move(vertex_manager), std::move(perf_query),
std::move(bounding_box));
}