Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/csd_no_tex_vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/csd_vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions MarathonRecomp/gpu/shader/movie_vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
10 changes: 8 additions & 2 deletions MarathonRecomp/gpu/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ struct SharedConstants
uint32_t samplerIndices[16]{};
uint32_t booleans{};
uint32_t swappedTexcoords{};
float halfPixelOffsetX{};
float halfPixelOffsetY{};
float alphaThreshold{};
};

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/XenosRecomp
Loading