diff options
| author | Robin Kertels <robin.kertels@gmail.com> | 2023-03-19 23:25:00 +0100 |
|---|---|---|
| committer | Robin Kertels <robin.kertels@gmail.com> | 2023-03-20 00:41:16 +0100 |
| commit | 7703fef3a4bbf3a17630b959c4a4b39cf7c416f1 (patch) | |
| tree | 0f0e4adf8d5d2a054b7d5e428ec471692b906337 /Source/Core/VideoCommon/VertexLoaderManager.cpp | |
| parent | 002a96adb05366b12909d65023f74830bb6a082c (diff) | |
VideoCommon:VertexLoaderManager: Only update vertex format in shader manager if necessary.
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoaderManager.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index 49f139c208..0236201001 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -258,11 +258,6 @@ VertexLoaderBase* GetOrCreateLoader(int vtx_attr_group) static void CheckCPConfiguration(int vtx_attr_group) { - if (!g_needs_cp_xf_consistency_check) [[likely]] - return; - - g_needs_cp_xf_consistency_check = false; - // Validate that the XF input configuration matches the CP configuration u32 num_cp_colors = std::count_if( g_main_cp_state.vtx_desc.low.Color.begin(), g_main_cp_state.vtx_desc.low.Color.end(), @@ -359,20 +354,25 @@ int RunVertices(int vtx_attr_group, OpcodeDecoder::Primitive primitive, int coun // Doing early return for the opposite case would be cleaner // but triggers a false unreachable code warning in MSVC debug builds. - CheckCPConfiguration(vtx_attr_group); + if (g_needs_cp_xf_consistency_check) [[unlikely]] + { + CheckCPConfiguration(vtx_attr_group); + g_needs_cp_xf_consistency_check = false; + } // If the native vertex format changed, force a flush. if (loader->m_native_vertex_format != s_current_vtx_fmt || loader->m_native_components != g_current_components) [[unlikely]] { g_vertex_manager->Flush(); + + s_current_vtx_fmt = loader->m_native_vertex_format; + g_current_components = loader->m_native_components; + auto& system = Core::System::GetInstance(); + auto& vertex_shader_manager = system.GetVertexShaderManager(); + vertex_shader_manager.SetVertexFormat(loader->m_native_components, + loader->m_native_vertex_format->GetVertexDeclaration()); } - s_current_vtx_fmt = loader->m_native_vertex_format; - g_current_components = loader->m_native_components; - auto& system = Core::System::GetInstance(); - auto& vertex_shader_manager = system.GetVertexShaderManager(); - vertex_shader_manager.SetVertexFormat(loader->m_native_components, - loader->m_native_vertex_format->GetVertexDeclaration()); // CPUCull's performance increase comes from encoding fewer GPU commands, not sending less data // Therefore it's only useful to check if culling could remove a flush |
