From 892678648eee7a1724b790fba0aa312e0fe8c728 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 5 Mar 2022 14:52:43 -0600 Subject: VideoCommon: trigger mod calls in TextureCacheBase (efb/xfb calls), VertexManagerBase (draw calls), and VertexShaderManager (projection calls) --- Source/Core/VideoCommon/VertexShaderManager.cpp | 29 +++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp') diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 6a7636d587..680d1ad3ee 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -85,7 +85,7 @@ void VertexShaderManager::Dirty() // Syncs the shader constant buffers with xfmem // TODO: A cleaner way to control the matrices without making a mess in the parameters field -void VertexShaderManager::SetConstants() +void VertexShaderManager::SetConstants(const std::vector& textures) { if (constants.missing_color_hex != g_ActiveConfig.iMissingColorValue) { @@ -302,7 +302,27 @@ void VertexShaderManager::SetConstants() g_stats.AddScissorRect(); } - if (bProjectionChanged || g_freelook_camera.GetController()->IsDirty()) + std::vector projection_actions; + if (g_ActiveConfig.bGraphicMods) + { + for (const auto action : + g_renderer->GetGraphicsModManager().GetProjectionActions(xfmem.projection.type)) + { + projection_actions.push_back(action); + } + + for (const auto& texture : textures) + { + for (const auto action : g_renderer->GetGraphicsModManager().GetProjectionTextureActions( + xfmem.projection.type, texture)) + { + projection_actions.push_back(action); + } + } + } + + if (bProjectionChanged || g_freelook_camera.GetController()->IsDirty() || + !projection_actions.empty()) { bProjectionChanged = false; @@ -384,6 +404,11 @@ void VertexShaderManager::SetConstants() if (g_freelook_camera.IsActive() && xfmem.projection.type == ProjectionType::Perspective) corrected_matrix *= g_freelook_camera.GetView(); + for (auto action : projection_actions) + { + action->OnProjection(&corrected_matrix); + } + memcpy(constants.projection.data(), corrected_matrix.data.data(), 4 * sizeof(float4)); g_freelook_camera.GetController()->SetClean(); -- cgit v1.2.3