mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
VideoCommon:VertexLoaderManager: Only update vertex format in shader manager if necessary.
This commit is contained in:
@ -258,11 +258,6 @@ VertexLoaderBase* GetOrCreateLoader(int vtx_attr_group)
|
|||||||
|
|
||||||
static void CheckCPConfiguration(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
|
// Validate that the XF input configuration matches the CP configuration
|
||||||
u32 num_cp_colors = std::count_if(
|
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(),
|
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
|
// Doing early return for the opposite case would be cleaner
|
||||||
// but triggers a false unreachable code warning in MSVC debug builds.
|
// 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 the native vertex format changed, force a flush.
|
||||||
if (loader->m_native_vertex_format != s_current_vtx_fmt ||
|
if (loader->m_native_vertex_format != s_current_vtx_fmt ||
|
||||||
loader->m_native_components != g_current_components) [[unlikely]]
|
loader->m_native_components != g_current_components) [[unlikely]]
|
||||||
{
|
{
|
||||||
g_vertex_manager->Flush();
|
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
|
// 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
|
// Therefore it's only useful to check if culling could remove a flush
|
||||||
|
Reference in New Issue
Block a user