summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoaderManager.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2023-03-30 11:05:02 +0200
committerGitHub <noreply@github.com>2023-03-30 11:05:02 +0200
commit50a45bd6146796c201447a84cbf92f2e398043a1 (patch)
treef79e548f93243f04eec6f39925893bc06bfdf733 /Source/Core/VideoCommon/VertexLoaderManager.cpp
parent806ea59d77809aa7c6c17a4b61ae304b0f19e284 (diff)
parent93fce0e4b6cfdc67fca441bb7e2c9029bd4afe15 (diff)
Merge pull request #11673 from K0bin/vertex-loader-micro-opt
Vertex Loader Microoptimization
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoaderManager.cpp24
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