Skip to content

Commit

Permalink
Merge pull request #12023 from iwubcode/graphics_mod_action_copies
Browse files Browse the repository at this point in the history
VideoCommon: don't do pointer copies during graphics mod callback iteration
  • Loading branch information
AdmiralCurtiss committed Jul 3, 2023
2 parents 6d7bf60 + a2ad3ca commit da1a3d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Source/Core/VideoCommon/TextureCacheBase.cpp
Expand Up @@ -1322,7 +1322,7 @@ TCacheEntry* TextureCacheBase::LoadImpl(const TextureInfo& texture_info, bool fo
entry->texture_info_name = texture_info.CalculateTextureName().GetFullName();

GraphicsModActionData::TextureLoad texture_load{entry->texture_info_name};
for (const auto action :
for (const auto& action :
g_graphics_mod_manager->GetTextureLoadActions(entry->texture_info_name))
{
action->OnTextureLoad(&texture_load);
Expand Down Expand Up @@ -2274,7 +2274,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
info.m_texture_format = baseFormat;
if (is_xfb_copy)
{
for (const auto action : g_graphics_mod_manager->GetXFBActions(info))
for (const auto& action : g_graphics_mod_manager->GetXFBActions(info))
{
action->OnXFB();
}
Expand All @@ -2283,7 +2283,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
{
bool skip = false;
GraphicsModActionData::EFB efb{tex_w, tex_h, &skip, &scaled_tex_w, &scaled_tex_h};
for (const auto action : g_graphics_mod_manager->GetEFBActions(info))
for (const auto& action : g_graphics_mod_manager->GetEFBActions(info))
{
action->OnEFB(&efb);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/VertexManagerBase.cpp
Expand Up @@ -566,7 +566,7 @@ void VertexManagerBase::Flush()
{
bool skip = false;
GraphicsModActionData::DrawStarted draw_started{&skip};
for (const auto action : g_graphics_mod_manager->GetDrawStartedActions(texture_name))
for (const auto& action : g_graphics_mod_manager->GetDrawStartedActions(texture_name))
{
action->OnDrawStarted(&draw_started);
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/VideoCommon/VertexShaderManager.cpp
Expand Up @@ -406,14 +406,14 @@ void VertexShaderManager::SetConstants(const std::vector<std::string>& textures)
std::vector<GraphicsModAction*> projection_actions;
if (g_ActiveConfig.bGraphicMods)
{
for (const auto action : g_graphics_mod_manager->GetProjectionActions(xfmem.projection.type))
for (const auto& action : g_graphics_mod_manager->GetProjectionActions(xfmem.projection.type))
{
projection_actions.push_back(action);
}

for (const auto& texture : textures)
{
for (const auto action :
for (const auto& action :
g_graphics_mod_manager->GetProjectionTextureActions(xfmem.projection.type, texture))
{
projection_actions.push_back(action);
Expand All @@ -430,7 +430,7 @@ void VertexShaderManager::SetConstants(const std::vector<std::string>& textures)
auto corrected_matrix = LoadProjectionMatrix();

GraphicsModActionData::Projection projection{&corrected_matrix};
for (auto action : projection_actions)
for (const auto& action : projection_actions)
{
action->OnProjection(&projection);
}
Expand Down

0 comments on commit da1a3d3

Please sign in to comment.