From b380f292b47c8b1a3e1711a665a3469074715485 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 24 Jun 2017 19:58:14 +1000 Subject: Vulkan: Reload pipeline cache when relevant host config changes --- Source/Core/VideoBackends/Vulkan/Renderer.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'Source/Core/VideoBackends/Vulkan/Renderer.cpp') diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 9a26df8548..e2690ab253 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -114,7 +114,7 @@ bool Renderer::Initialize() } // Ensure all pipelines previously used by the game have been created. - StateTracker::GetInstance()->LoadPipelineUIDCache(); + StateTracker::GetInstance()->ReloadPipelineUIDCache(); // Initialize post processing. m_post_processor = std::make_unique(); @@ -1126,13 +1126,11 @@ void Renderer::CheckForSurfaceChange() void Renderer::CheckForConfigChanges() { // Save the video config so we can compare against to determine which settings have changed. - u32 old_multisamples = g_ActiveConfig.iMultisamples; + u32 old_host_bits = g_ActiveConfig.GetHostConfigBits(); int old_anisotropy = g_ActiveConfig.iMaxAnisotropy; - int old_stereo_mode = g_ActiveConfig.iStereoMode; int old_aspect_ratio = g_ActiveConfig.iAspectRatio; int old_efb_scale = g_ActiveConfig.iEFBScale; bool old_force_filtering = g_ActiveConfig.bForceFiltering; - bool old_ssaa = g_ActiveConfig.bSSAA; bool old_use_xfb = g_ActiveConfig.bUseXFB; bool old_use_realxfb = g_ActiveConfig.bUseRealXFB; @@ -1142,11 +1140,9 @@ void Renderer::CheckForConfigChanges() UpdateActiveConfig(); // Determine which (if any) settings have changed. - bool msaa_changed = old_multisamples != g_ActiveConfig.iMultisamples; - bool ssaa_changed = old_ssaa != g_ActiveConfig.bSSAA; + bool host_bits_changed = old_host_bits != g_ActiveConfig.GetHostConfigBits(); bool anisotropy_changed = old_anisotropy != g_ActiveConfig.iMaxAnisotropy; bool force_texture_filtering_changed = old_force_filtering != g_ActiveConfig.bForceFiltering; - bool stereo_changed = old_stereo_mode != g_ActiveConfig.iStereoMode; bool efb_scale_changed = old_efb_scale != g_ActiveConfig.iEFBScale; bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio; bool use_xfb_changed = old_use_xfb != g_ActiveConfig.bUseXFB; @@ -1164,23 +1160,21 @@ void Renderer::CheckForConfigChanges() // MSAA samples changed, we need to recreate the EFB render pass. // If the stereoscopy mode changed, we need to recreate the buffers as well. - if (msaa_changed || stereo_changed) + // SSAA changed on/off, we have to recompile shaders. + // Changing stereoscopy from off<->on also requires shaders to be recompiled. + if (host_bits_changed) { + OSD::AddMessage("Video config changed, reloading shaders.", OSD::Duration::NORMAL); g_command_buffer_mgr->WaitForGPUIdle(); FramebufferManager::GetInstance()->RecreateRenderPass(); FramebufferManager::GetInstance()->ResizeEFBTextures(); BindEFBToStateTracker(); - } - - // SSAA changed on/off, we can leave the buffers/render pass, but have to recompile shaders. - // Changing stereoscopy from off<->on also requires shaders to be recompiled. - if (msaa_changed || ssaa_changed || stereo_changed) - { - g_command_buffer_mgr->WaitForGPUIdle(); RecompileShaders(); FramebufferManager::GetInstance()->RecompileShaders(); + g_object_cache->ReloadShaderAndPipelineCaches(); g_object_cache->RecompileSharedShaders(); - StateTracker::GetInstance()->LoadPipelineUIDCache(); + StateTracker::GetInstance()->InvalidateShaderPointers(); + StateTracker::GetInstance()->ReloadPipelineUIDCache(); } // For vsync, we need to change the present mode, which means recreating the swap chain. -- cgit v1.2.3 From 3ea9d86faa2544b8c1c235db9456f271baf42fec Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 20 Jul 2017 17:10:02 +1000 Subject: ShaderGen: Pass host config to shader generation functions Also moves the host config checks to common. --- Source/Core/VideoBackends/Vulkan/Renderer.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Source/Core/VideoBackends/Vulkan/Renderer.cpp') diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index e2690ab253..599792d493 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -1126,7 +1126,6 @@ void Renderer::CheckForSurfaceChange() void Renderer::CheckForConfigChanges() { // Save the video config so we can compare against to determine which settings have changed. - u32 old_host_bits = g_ActiveConfig.GetHostConfigBits(); int old_anisotropy = g_ActiveConfig.iMaxAnisotropy; int old_aspect_ratio = g_ActiveConfig.iAspectRatio; int old_efb_scale = g_ActiveConfig.iEFBScale; @@ -1140,7 +1139,6 @@ void Renderer::CheckForConfigChanges() UpdateActiveConfig(); // Determine which (if any) settings have changed. - bool host_bits_changed = old_host_bits != g_ActiveConfig.GetHostConfigBits(); bool anisotropy_changed = old_anisotropy != g_ActiveConfig.iMaxAnisotropy; bool force_texture_filtering_changed = old_force_filtering != g_ActiveConfig.bForceFiltering; bool efb_scale_changed = old_efb_scale != g_ActiveConfig.iEFBScale; @@ -1162,9 +1160,8 @@ void Renderer::CheckForConfigChanges() // If the stereoscopy mode changed, we need to recreate the buffers as well. // SSAA changed on/off, we have to recompile shaders. // Changing stereoscopy from off<->on also requires shaders to be recompiled. - if (host_bits_changed) + if (CheckForHostConfigChanges()) { - OSD::AddMessage("Video config changed, reloading shaders.", OSD::Duration::NORMAL); g_command_buffer_mgr->WaitForGPUIdle(); FramebufferManager::GetInstance()->RecreateRenderPass(); FramebufferManager::GetInstance()->ResizeEFBTextures(); -- cgit v1.2.3