diff --git a/MarathonRecomp/gpu/shader/csd_no_tex_vs.hlsl b/MarathonRecomp/gpu/shader/csd_no_tex_vs.hlsl index 48ec6af1a..1654e7343 100644 --- a/MarathonRecomp/gpu/shader/csd_no_tex_vs.hlsl +++ b/MarathonRecomp/gpu/shader/csd_no_tex_vs.hlsl @@ -43,7 +43,7 @@ void main( out float4 oColor0 : COLOR0, out float4 oColor1 : COLOR1) { - oPos.xy = (iPosition0.xy - 0.5) * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0); + oPos.xy = iPosition0.xy * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0); oPos.z = g_Z.x; oPos.w = 1.0; oTexCoord0 = iColor0.wxyz; diff --git a/MarathonRecomp/gpu/shader/csd_vs.hlsl b/MarathonRecomp/gpu/shader/csd_vs.hlsl index 114636841..90b561f5f 100644 --- a/MarathonRecomp/gpu/shader/csd_vs.hlsl +++ b/MarathonRecomp/gpu/shader/csd_vs.hlsl @@ -44,7 +44,7 @@ void main( out float4 oColor0 : COLOR0, out float4 oColor1 : COLOR1) { - oPos.xy = (iPosition0.xy - 0.5) * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0); + oPos.xy = iPosition0.xy * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0); oPos.z = g_Z.x; oPos.w = 1.0; oTexCoord0 = iColor0.wxyz; diff --git a/MarathonRecomp/gpu/shader/movie_vs.hlsl b/MarathonRecomp/gpu/shader/movie_vs.hlsl index c4e47c1ce..6d00919e1 100644 --- a/MarathonRecomp/gpu/shader/movie_vs.hlsl +++ b/MarathonRecomp/gpu/shader/movie_vs.hlsl @@ -4,6 +4,7 @@ Interpolators main(in VertexShaderInput In) { Interpolators Out; Out.ProjPos = In.ObjPos; + Out.ProjPos.xy += g_HalfPixelOffset * Out.ProjPos.w; Out.UV = In.UV; return Out; } diff --git a/MarathonRecomp/gpu/video.cpp b/MarathonRecomp/gpu/video.cpp index e71bfaa02..bf688988a 100644 --- a/MarathonRecomp/gpu/video.cpp +++ b/MarathonRecomp/gpu/video.cpp @@ -166,6 +166,8 @@ struct SharedConstants uint32_t samplerIndices[16]{}; uint32_t booleans{}; uint32_t swappedTexcoords{}; + float halfPixelOffsetX{}; + float halfPixelOffsetY{}; float alphaThreshold{}; }; @@ -3192,8 +3194,6 @@ static void FlushViewport() if (g_dirtyStates.viewport) { auto viewport = g_viewport; - viewport.x += 0.5f; - viewport.y += 0.5f; // if (viewport.minDepth > viewport.maxDepth) // std::swap(viewport.minDepth, viewport.maxDepth); @@ -3624,6 +3624,12 @@ static void SetFramebuffer(GuestSurface* renderTarget, GuestSurface* depthStenci g_framebuffer = nullptr; } + if (g_framebuffer != nullptr) + { + SetDirtyValue(g_dirtyStates.sharedConstants, g_sharedConstants.halfPixelOffsetX, 1.0f / float(g_framebuffer->getWidth())); + SetDirtyValue(g_dirtyStates.sharedConstants, g_sharedConstants.halfPixelOffsetY, -1.0f / float(g_framebuffer->getHeight())); + } + g_dirtyStates.renderTargetAndDepthStencil = settingForClear; } } diff --git a/tools/XenosRecomp b/tools/XenosRecomp index 77cead57c..e2f093da6 160000 --- a/tools/XenosRecomp +++ b/tools/XenosRecomp @@ -1 +1 @@ -Subproject commit 77cead57ccc804959430007d00e7a8a5708bfd71 +Subproject commit e2f093da6b12fc26924faef892416691f6982b1d