From baa63a0011be59598cc90cb46904dfc6a7f25d94 Mon Sep 17 00:00:00 2001 From: Gabriel A Date: Fri, 17 Nov 2023 20:53:08 -0300 Subject: [PATCH] Improvements --- .../Shader/DiskCache/DiskCacheGpuAccessor.cs | 4 +++- src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs | 4 +++- .../H264/SpsAndPpsReconstruction.cs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs index 2943a3cc5..b73cf5996 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs @@ -139,7 +139,9 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// public ReadOnlySpan QueryTransformFeedbackVaryingLocations(int bufferIndex) { - return MemoryMarshal.Cast(_oldSpecState.TransformFeedbackDescriptors[bufferIndex].VaryingLocations); + int varyingCount = _oldSpecState.TransformFeedbackDescriptors[bufferIndex].VaryingCount; + + return MemoryMarshal.Cast(_oldSpecState.TransformFeedbackDescriptors[bufferIndex].VaryingLocations)[..Math.Min(128, varyingCount)]; } /// diff --git a/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs b/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs index 3367166f9..d503ff288 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs @@ -179,7 +179,9 @@ namespace Ryujinx.Graphics.Gpu.Shader /// public ReadOnlySpan QueryTransformFeedbackVaryingLocations(int bufferIndex) { - return MemoryMarshal.Cast(_state.TransformFeedbackDescriptors[bufferIndex].VaryingLocations); + int varyingCount = _state.TransformFeedbackDescriptors[bufferIndex].VaryingCount; + + return MemoryMarshal.Cast(_state.TransformFeedbackDescriptors[bufferIndex].VaryingLocations)[..Math.Min(128, varyingCount)]; } /// diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs index 944211798..1b4004718 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/H264/SpsAndPpsReconstruction.cs @@ -138,7 +138,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264 3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4, }; - private static void WriteScalingList(ref H264BitStreamWriter writer, Span list) + private static void WriteScalingList(ref H264BitStreamWriter writer, ReadOnlySpan list) { ReadOnlySpan scan = list.Length == 16 ? ZigZagScan : ZigZagDirect;