From 353ca8ec84b209f962978a81881544480ec4deb2 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Tue, 7 Dec 2021 01:03:22 +0530 Subject: [PATCH] Fix Viewport X/Y Translation The operands of the subtraction in the X/Y translation calculation were the wrong way around which led to negative translations that would translate the viewport off the screen. --- app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index 3242ab2b..349c8a33 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -284,13 +284,13 @@ namespace skyline::gpu::interconnect { */ void SetViewportX(size_t index, float scale, float translate) { auto &viewport{viewports.at(index)}; - viewport.x = scale - translate; // Counteract the addition of the half of the width (o_x) to the host translation + viewport.x = translate - scale; // Counteract the addition of the half of the width (o_x) to the host translation viewport.width = scale * 2.0f; // Counteract the division of the width (p_x) by 2 for the host scale } void SetViewportY(size_t index, float scale, float translate) { auto &viewport{viewports.at(index)}; - viewport.y = scale - translate; // Counteract the addition of the half of the height (p_y/2 is center) to the host translation (o_y) + viewport.y = translate - scale; // Counteract the addition of the half of the height (p_y/2 is center) to the host translation (o_y) viewport.height = scale * 2.0f; // Counteract the division of the height (p_y) by 2 for the host scale }