From 0c855cdd6d61c349464104b7cfedfdb2e408f700 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Fri, 20 May 2022 17:17:52 +0100 Subject: [PATCH] GS: Update interlacing on Metal --- pcsx2/GS/Renderers/Metal/GSDeviceMTL.mm | 1 - pcsx2/GS/Renderers/Metal/GSMTLSharedHeader.h | 1 - pcsx2/GS/Renderers/Metal/interlace.metal | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pcsx2/GS/Renderers/Metal/GSDeviceMTL.mm b/pcsx2/GS/Renderers/Metal/GSDeviceMTL.mm index aff0af6ea4..4d74a61910 100644 --- a/pcsx2/GS/Renderers/Metal/GSDeviceMTL.mm +++ b/pcsx2/GS/Renderers/Metal/GSDeviceMTL.mm @@ -500,7 +500,6 @@ void GSDeviceMTL::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool GSMTLInterlacePSUniform cb = {}; cb.ZrH = {0, 1.f / s.y}; - cb.hH = s.y / 2; DoStretchRect(sTex, sRect, dTex, dRect, m_interlace_pipeline[shader], linear, shader > 1 ? LoadAction::DontCareIfFull : LoadAction::Load, &cb, sizeof(cb)); }} diff --git a/pcsx2/GS/Renderers/Metal/GSMTLSharedHeader.h b/pcsx2/GS/Renderers/Metal/GSMTLSharedHeader.h index 4f8718ab7a..ae886b8add 100644 --- a/pcsx2/GS/Renderers/Metal/GSMTLSharedHeader.h +++ b/pcsx2/GS/Renderers/Metal/GSMTLSharedHeader.h @@ -42,7 +42,6 @@ struct GSMTLConvertPSUniform struct GSMTLInterlacePSUniform { vector_float2 ZrH; - float hH; }; struct GSMTLMainVSUniform diff --git a/pcsx2/GS/Renderers/Metal/interlace.metal b/pcsx2/GS/Renderers/Metal/interlace.metal index 061e5e5d22..8ab2afe89d 100644 --- a/pcsx2/GS/Renderers/Metal/interlace.metal +++ b/pcsx2/GS/Renderers/Metal/interlace.metal @@ -20,7 +20,7 @@ using namespace metal; fragment float4 ps_interlace0(ConvertShaderData data [[stage_in]], ConvertPSRes res, constant GSMTLInterlacePSUniform& uniform [[buffer(GSMTLBufferIndexUniforms)]]) { - if (fract(data.t.y * uniform.hH) - 0.5f < 0.f) + if ((int(data.p.y) & 1) == 0) discard_fragment(); return res.sample(data.t); } @@ -28,7 +28,7 @@ fragment float4 ps_interlace0(ConvertShaderData data [[stage_in]], ConvertPSRes fragment float4 ps_interlace1(ConvertShaderData data [[stage_in]], ConvertPSRes res, constant GSMTLInterlacePSUniform& uniform [[buffer(GSMTLBufferIndexUniforms)]]) { - if (0.5f - fract(data.t.y * uniform.hH) < 0.f) + if ((int(data.p.y) & 1) != 0) discard_fragment(); return res.sample(data.t); }