aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-07-29 18:47:03 -0300
committerGitHub <noreply@github.com>2023-07-29 18:47:03 -0300
commitf95b7c58779f01d9077996da67953d8d9acd058c (patch)
treeb0be466b2e52f966620aa2e0acb4524d28da1b22 /src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
parenteb528ae0f05f057e671eb9e92f44f1caa9bcc84b (diff)
Fix incorrect fragment origin when YNegate is enabled (#4673)1.1.970
* 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
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
index 50c042fb..b236476e 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
@@ -113,6 +113,17 @@ namespace Ryujinx.Graphics.Gpu.Memory
}
/// <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>
/// <param name="scale">Scale value</param>
@@ -193,6 +204,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>
public void Commit()