Fix incorrect fragment origin when YNegate is enabled (#4673)

* Fix incorrect fragment origin when YNegate is enabled

* Shader cache version bump

* Do not update support buffer if shader does not read gl_FragCoord

* Pass unscaled viewport size to the support buffer
This commit is contained in:
gdkchan 2023-07-29 18:47:03 -03:00 committed by GitHub
parent eb528ae0f0
commit f95b7c5877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 207 additions and 26 deletions

View file

@ -112,6 +112,17 @@ namespace Ryujinx.Graphics.Gpu.Memory
MarkDirty(SupportBuffer.ViewportInverseOffset, SupportBuffer.FieldSize);
}
/// <summary>
/// Updates the viewport size vector.
/// </summary>
/// <param name="data">Viewport size vector</param>
private void UpdateViewportSize(Vector4<float> data)
{
_data.ViewportSize = data;
MarkDirty(SupportBuffer.ViewportSizeOffset, SupportBuffer.FieldSize);
}
/// <summary>
/// Sets the scale of all output render targets (they should all have the same scale).
/// </summary>
@ -192,6 +203,25 @@ namespace Ryujinx.Graphics.Gpu.Memory
}
}
/// <summary>
/// Sets the viewport size, used to invert the fragment coordinates Y value.
/// </summary>
/// <param name="viewportWidth">Value used as viewport width</param>
/// <param name="viewportHeight">Value used as viewport height</param>
public void SetViewportSize(float viewportWidth, float viewportHeight)
{
if (_data.ViewportSize.X != viewportWidth || _data.ViewportSize.Y != viewportHeight)
{
UpdateViewportSize(new Vector4<float>
{
X = viewportWidth,
Y = viewportHeight,
Z = 1,
W = 0
});
}
}
/// <summary>
/// Submits all pending buffer updates to the GPU.
/// </summary>