diff options
| author | riperiperi <rhy3756547@hotmail.com> | 2020-02-03 19:11:22 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-03 20:11:22 +0100 |
| commit | a0e6647860b689cd2c3d865e6b235b12ec96b89a (patch) | |
| tree | f9971370f18c50c4163c8a0c0a0224a9ce0f427c /Ryujinx.Graphics.Gpu/Shader | |
| parent | 796e5d14b4fadc15439d273f8ff8f9e9afc4033a (diff) | |
Compare shader code using a span instead of individual reads. (#917)
* Compare shader code using a span instead of individual reads.
* Add comment for new parameter.
* Remove unnecessary Math.Min
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Shader')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index 8aa9b1c7..fc4bf778 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -235,15 +235,9 @@ namespace Ryujinx.Graphics.Gpu.Shader return false; } - for (int index = 0; index < shader.Code.Length; index++) - { - if (_context.MemoryAccessor.ReadInt32(gpuVa + (ulong)index * 4) != shader.Code[index]) - { - return true; - } - } + ReadOnlySpan<byte> memoryCode = _context.MemoryAccessor.GetSpan(gpuVa, (ulong)shader.Code.Length * 4); - return false; + return !MemoryMarshal.Cast<byte, int>(memoryCode).SequenceEqual(shader.Code); } /// <summary> |
