diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs | 30 |
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() |