From ffe35f73af226a863da5e18cc5f2c94bda08fbdd Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Wed, 4 Nov 2015 22:29:18 +0100 Subject: [PATCH] Fix viewport vertical positioning, fixing #8165. However, God Eater bloom breaks. Why?? --- GPU/GLES/StateMapping.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index e5137924be..3a48c5e49d 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -835,22 +835,19 @@ void TransformDrawEngine::ApplyDrawState(int prim) { // This means that to get the analogue glViewport we must: float vpX0 = vpXCenter - offsetX - fabsf(vpXScale); - float vpY0 = vpYCenter - offsetY + fabsf(vpYScale); // Need to account for sign of Y + float vpY0 = vpYCenter - offsetY - fabsf(vpYScale); // Need to account for sign of Y gstate_c.vpWidth = vpXScale * 2.0f; gstate_c.vpHeight = -vpYScale * 2.0f; float vpWidth = fabsf(gstate_c.vpWidth); float vpHeight = fabsf(gstate_c.vpHeight); + // This multiplication should probably be done after viewport clipping. Would let us very slightly simplify the clipping logic? vpX0 *= renderWidthFactor; vpY0 *= renderHeightFactor; vpWidth *= renderWidthFactor; vpHeight *= renderHeightFactor; - // Flip vpY0 to match the OpenGL coordinate system. - // TODO: This makes no sense anymore, in "flipped space". - vpY0 = renderHeight - vpY0; - // We used to apply the viewport here via glstate, but there are limits which vary by driver. // This may mean some games won't work, or at least won't work at higher render resolutions. // So we apply it in the shader instead.