diff --git a/GPU/Common/GPUStateUtils.cpp b/GPU/Common/GPUStateUtils.cpp index 534f117bad..a9f99f793f 100644 --- a/GPU/Common/GPUStateUtils.cpp +++ b/GPU/Common/GPUStateUtils.cpp @@ -581,7 +581,9 @@ void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, flo renderHeightFactor = renderHeight / 272.0f; } - // negative offsets we take care of in the projection matrix. + // We take care negative offsets of in the projection matrix. + // These come from split framebuffers (Killzone). + // TODO: Might be safe to do get rid of this here and do the same for positive offsets? renderX = std::max(gstate_c.curRTOffsetX, 0); renderY = std::max(gstate_c.curRTOffsetY, 0); diff --git a/GPU/Common/ShaderUniforms.cpp b/GPU/Common/ShaderUniforms.cpp index 3e5424713d..c3480e6fef 100644 --- a/GPU/Common/ShaderUniforms.cpp +++ b/GPU/Common/ShaderUniforms.cpp @@ -152,10 +152,11 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView if (!useBufferedRendering && g_display_rotation != DisplayRotation::ROTATE_0) { proj_through = proj_through * g_display_rot_matrix; } + + // Negative RT offsets come from split framebuffers (Killzone) if (gstate_c.curRTOffsetX < 0 || gstate_c.curRTOffsetY < 0) { - Matrix4x4 xlate; - xlate.setTranslation(Lin::Vec3(2.0f * gstate_c.curRTOffsetX / (int)gstate_c.curRTWidth, 2.0f * gstate_c.curRTOffsetY / (int)gstate_c.curRTHeight, 0.0f)); - proj_through = proj_through * xlate; + proj_through.wx += 2.0f * (float)gstate_c.curRTOffsetX / (float)gstate_c.curRTWidth; + proj_through.wy += 2.0f * (float)gstate_c.curRTOffsetY / (float)gstate_c.curRTHeight; } CopyMatrix4x4(ub->proj_through, proj_through.getReadPtr());