From eb181425b16567eea5c67d696f9236f868b40e92 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 12 Aug 2021 15:59:24 -0300 Subject: [PATCH] Fix size of cached compute shaders (#2548) * Fix size of cached compute shaders * Missed one --- Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index 5b08593e1d..91edbf2a71 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -179,7 +179,9 @@ namespace Ryujinx.Graphics.Gpu.Shader program = new ShaderProgram(entry.Header.Stage, ""); shaderProgramInfo = hostShaderEntries[0].ToShaderProgramInfo(); - ShaderCodeHolder shader = new ShaderCodeHolder(program, shaderProgramInfo, entry.Code); + byte[] code = entry.Code.AsSpan().Slice(0, entry.Header.Size - entry.Header.Cb1DataSize).ToArray(); + + ShaderCodeHolder shader = new ShaderCodeHolder(program, shaderProgramInfo, code); _cpProgramsDiskCache.Add(key, new ShaderBundle(hostProgram, shader)); @@ -214,7 +216,9 @@ namespace Ryujinx.Graphics.Gpu.Shader return true; // Exit early, the decoding step failed. } - ShaderCodeHolder shader = new ShaderCodeHolder(program, shaderProgramInfo, entry.Code); + byte[] code = entry.Code.AsSpan().Slice(0, entry.Header.Size - entry.Header.Cb1DataSize).ToArray(); + + ShaderCodeHolder shader = new ShaderCodeHolder(program, shaderProgramInfo, code); Logger.Info?.Print(LogClass.Gpu, $"Host shader {key} got invalidated, rebuilding from guest...");