From c989e5c50c432b7df78a8e6e1dc92cca1057767b Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 1 Oct 2019 11:42:59 +1000 Subject: [PATCH 1/2] ShaderCache: Recompile shared pipelines on shader cache reload Fixes broken stereoscopy when switching on/off at runtime. --- Source/Core/VideoCommon/ShaderCache.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index e3066520fb..3900aaea42 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -70,6 +70,9 @@ void ShaderCache::Reload() ClosePipelineUIDCache(); ClearCaches(); + if (!CompileSharedPipelines()) + PanicAlert("Failed to compile shared pipelines after reload."); + if (g_ActiveConfig.bShaderCache) LoadCaches(); @@ -369,6 +372,23 @@ void ShaderCache::ClearCaches() ClearShaderCache(m_uber_vs_cache); ClearShaderCache(m_uber_ps_cache); + m_screen_quad_vertex_shader.reset(); + m_texture_copy_vertex_shader.reset(); + m_efb_copy_vertex_shader.reset(); + m_texcoord_geometry_shader.reset(); + m_color_geometry_shader.reset(); + m_texture_copy_pixel_shader.reset(); + m_color_pixel_shader.reset(); + + m_efb_copy_to_vram_pipelines.clear(); + m_efb_copy_to_ram_pipelines.clear(); + m_copy_rgba8_pipeline.reset(); + m_rgba8_stereo_copy_pipeline.reset(); + for (auto& pipeline : m_palette_conversion_pipelines) + pipeline.reset(); + m_texture_reinterpret_pipelines.clear(); + m_texture_decoding_shaders.clear(); + SETSTAT(g_stats.num_pixel_shaders_created, 0); SETSTAT(g_stats.num_pixel_shaders_alive, 0); SETSTAT(g_stats.num_vertex_shaders_created, 0); From 135f0a1385b25ff549b064e0782128fe11d55fdc Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 1 Oct 2019 11:44:29 +1000 Subject: [PATCH 2/2] ShaderCache: EFB2RAM pipelines should not use a geometry shader Only the left eye is used when creating the RAM copy. --- Source/Core/VideoCommon/ShaderCache.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index 3900aaea42..8c184c7256 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -1188,10 +1188,7 @@ const AbstractPipeline* ShaderCache::GetEFBCopyToRAMPipeline(const EFBCopyParams } AbstractPipelineConfig config = {}; - config.vertex_format = nullptr; config.vertex_shader = m_screen_quad_vertex_shader.get(); - config.geometry_shader = - UseGeometryShaderForEFBCopies() ? m_texcoord_geometry_shader.get() : nullptr; config.pixel_shader = shader.get(); config.rasterization_state = RenderState::GetNoCullRasterizationState(PrimitiveType::Triangles); config.depth_state = RenderState::GetNoDepthTestingDepthState();