aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-08-11 19:44:41 -0300
committerGitHub <noreply@github.com>2021-08-11 19:44:41 -0300
commit0ba4ade8f1fa64e2bda5c4b1e0c5b37e10d51c80 (patch)
tree74653fad02702bc35cf7f006fcc9e470da217644
parent3148c0c21cb45a92ff77344027757fb4808bb3cb (diff)
Ensure render scale is initialized to 1 on the backend (#2543)
-rw-r--r--Ryujinx.Graphics.OpenGL/Pipeline.cs19
-rw-r--r--Ryujinx.Graphics.OpenGL/Renderer.cs1
-rw-r--r--Ryujinx.Graphics.Shader/SupportBuffer.cs2
3 files changed, 13 insertions, 9 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs
index 9c39f719..7c626f54 100644
--- a/Ryujinx.Graphics.OpenGL/Pipeline.cs
+++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs
@@ -76,13 +76,22 @@ namespace Ryujinx.Graphics.OpenGL
_componentMasks[index] = 0xf;
}
- var v4Zero = new Vector4<float> { X = 0f, Y = 0f, Z = 0f, W = 0f };
- new Span<Vector4<float>>(_renderScale).Fill(v4Zero);
+ var defaultScale = new Vector4<float> { X = 1f, Y = 0f, Z = 0f, W = 0f };
+ new Span<Vector4<float>>(_renderScale).Fill(defaultScale);
_tfbs = new BufferHandle[Constants.MaxTransformFeedbackBuffers];
_tfbTargets = new BufferRange[Constants.MaxTransformFeedbackBuffers];
}
+ public void Initialize()
+ {
+ _supportBuffer = Buffer.Create(SupportBuffer.RequiredSize);
+ GL.BindBufferBase(BufferRangeTarget.UniformBuffer, 0, Unsafe.As<BufferHandle, int>(ref _supportBuffer));
+
+ SetSupportBufferData<Vector4<int>>(SupportBuffer.FragmentIsBgraOffset, _fpIsBgra, SupportBuffer.FragmentIsBgraCount);
+ SetSupportBufferData<Vector4<float>>(SupportBuffer.FragmentRenderScaleOffset, _renderScale, SupportBuffer.RenderScaleMaxCount);
+ }
+
public void Barrier()
{
GL.MemoryBarrier(MemoryBarrierFlags.AllBarrierBits);
@@ -1207,12 +1216,6 @@ namespace Ryujinx.Graphics.OpenGL
private void SetSupportBufferData<T>(int offset, ReadOnlySpan<T> data, int count) where T : unmanaged
{
- if (_supportBuffer == BufferHandle.Null)
- {
- _supportBuffer = Buffer.Create(SupportBuffer.RequiredSize);
- GL.BindBufferBase(BufferRangeTarget.UniformBuffer, 0, Unsafe.As<BufferHandle, int>(ref _supportBuffer));
- }
-
Buffer.SetData(_supportBuffer, offset, MemoryMarshal.Cast<T, byte>(data.Slice(0, count)));
}
diff --git a/Ryujinx.Graphics.OpenGL/Renderer.cs b/Ryujinx.Graphics.OpenGL/Renderer.cs
index 22648fd1..01072176 100644
--- a/Ryujinx.Graphics.OpenGL/Renderer.cs
+++ b/Ryujinx.Graphics.OpenGL/Renderer.cs
@@ -144,6 +144,7 @@ namespace Ryujinx.Graphics.OpenGL
GL.Arb.MaxShaderCompilerThreads(Math.Min(Environment.ProcessorCount, 8));
}
+ _pipeline.Initialize();
_counters.Initialize();
}
diff --git a/Ryujinx.Graphics.Shader/SupportBuffer.cs b/Ryujinx.Graphics.Shader/SupportBuffer.cs
index 78f24401..f76d2c92 100644
--- a/Ryujinx.Graphics.Shader/SupportBuffer.cs
+++ b/Ryujinx.Graphics.Shader/SupportBuffer.cs
@@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Shader
public const int ComputeRenderScaleOffset = FragmentRenderScaleOffset + FieldSize; // Skip first scale that is used for the render target
// One for the render target, 32 for the textures, and 8 for the images.
- private const int RenderScaleMaxCount = 1 + 32 + 8;
+ public const int RenderScaleMaxCount = 1 + 32 + 8;
public const int RequiredSize = FragmentRenderScaleOffset + RenderScaleMaxCount * FieldSize;
}