From bc360584a3a8a8902f50642496b2d1287e5088ac Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 2 Jul 2022 14:49:51 -0500 Subject: VideoCommon: add structures to graphics mods to allow for future adding or removing parameters with less code overhead --- .../Runtime/Actions/ScaleAction.cpp | 48 ++++++++++++++-------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp') diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp index d0cac24acb..305cd8b737 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp @@ -30,30 +30,46 @@ ScaleAction::ScaleAction(Common::Vec3 scale) : m_scale(scale) { } -void ScaleAction::OnEFB(bool*, u32 texture_width, u32 texture_height, u32* scaled_width, - u32* scaled_height) +void ScaleAction::OnEFB(GraphicsModActionData::EFB* efb) { - if (scaled_width && m_scale.x > 0) - *scaled_width = texture_width * m_scale.x; + if (!efb) [[unlikely]] + return; + + if (!efb->scaled_width) [[unlikely]] + return; + + if (!efb->scaled_height) [[unlikely]] + return; + + if (m_scale.x > 0) + *efb->scaled_width = efb->texture_width * m_scale.x; - if (scaled_height && m_scale.y > 0) - *scaled_height = texture_height * m_scale.y; + if (m_scale.y > 0) + *efb->scaled_height = efb->texture_height * m_scale.y; } -void ScaleAction::OnProjection(Common::Matrix44* matrix) +void ScaleAction::OnProjection(GraphicsModActionData::Projection* projection) { - if (!matrix) + if (!projection) [[unlikely]] return; - auto& the_matrix = *matrix; - the_matrix.data[0] = the_matrix.data[0] * m_scale.x; - the_matrix.data[5] = the_matrix.data[5] * m_scale.y; + + if (!projection->matrix) [[unlikely]] + return; + + auto& matrix = *projection->matrix; + matrix.data[0] = matrix.data[0] * m_scale.x; + matrix.data[5] = matrix.data[5] * m_scale.y; } -void ScaleAction::OnProjectionAndTexture(Common::Matrix44* matrix) +void ScaleAction::OnProjectionAndTexture(GraphicsModActionData::Projection* projection) { - if (!matrix) + if (!projection) [[unlikely]] return; - auto& the_matrix = *matrix; - the_matrix.data[0] = the_matrix.data[0] * m_scale.x; - the_matrix.data[5] = the_matrix.data[5] * m_scale.y; + + if (!projection->matrix) [[unlikely]] + return; + + auto& matrix = *projection->matrix; + matrix.data[0] = matrix.data[0] * m_scale.x; + matrix.data[5] = matrix.data[5] * m_scale.y; } -- cgit v1.2.3