Ensure render scale is initialized to 1 on the backend (#2543)

This commit is contained in:
gdkchan 2021-08-11 19:44:41 -03:00 committed by GitHub
parent 3148c0c21c
commit 0ba4ade8f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View file

@ -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)));
}