VideoCommon: trigger mod calls in TextureCacheBase (efb/xfb calls), VertexManagerBase (draw calls), and VertexShaderManager (projection calls)

This commit is contained in:
iwubcode
2022-03-05 14:52:43 -06:00
parent 62c186e14b
commit 892678648e
10 changed files with 142 additions and 28 deletions

View File

@ -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<std::string>& 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<GraphicsModAction*> 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();