From dc9e2fa0aa2d82a3683790b9c9cb50232123ff06 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Sun, 9 Feb 2025 23:30:51 +0300 Subject: [PATCH] Disable primitive 2D pixel snapping & enforce linear only above 720p. --- UnleashedRecomp/patches/aspect_ratio_patches.cpp | 6 ------ UnleashedRecomp/patches/video_patches.cpp | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/UnleashedRecomp/patches/aspect_ratio_patches.cpp b/UnleashedRecomp/patches/aspect_ratio_patches.cpp index e8aa84ad..ee10db8c 100644 --- a/UnleashedRecomp/patches/aspect_ratio_patches.cpp +++ b/UnleashedRecomp/patches/aspect_ratio_patches.cpp @@ -1198,12 +1198,6 @@ PPC_FUNC(sub_830D1EF0) y = g_aspectRatioOffsetY + (y + 0.5f) * g_aspectRatioScale; } - if (Config::AspectRatio != EAspectRatio::OriginalNarrow) - { - x = round(x); - y = round(y); - } - vertex[i].x = ((x - 0.5f) / Video::s_viewportWidth) * 2.0f - 1.0f; vertex[i].y = ((y - 0.5f) / Video::s_viewportHeight) * -2.0f + 1.0f; } diff --git a/UnleashedRecomp/patches/video_patches.cpp b/UnleashedRecomp/patches/video_patches.cpp index e57fcf26..a2320b37 100644 --- a/UnleashedRecomp/patches/video_patches.cpp +++ b/UnleashedRecomp/patches/video_patches.cpp @@ -76,8 +76,12 @@ PPC_FUNC(sub_830D25D8) auto device = reinterpret_cast(base + PPC_LOAD_U32(ctx.r4.u32)); // Set first sampler to use linear filtering. - device->samplerStates[0].data[3] = (device->samplerStates[0].data[3].get() & ~0x1f80000) | 0x1280000; - device->dirtyFlags[3] = device->dirtyFlags[3].get() | 0x80000000ull; + // NOTE: We only check for height here since all 2D primitives get centered. + if (Video::s_viewportHeight > 720) + { + device->samplerStates[0].data[3] = (device->samplerStates[0].data[3].get() & ~0x1f80000) | 0x1280000; + device->dirtyFlags[3] = device->dirtyFlags[3].get() | 0x80000000ull; + } __imp__sub_830D25D8(ctx, base); }