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;