From 3323a3a042c85ce88926771159fc041b5576de60 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 9 Dec 2019 19:23:44 -0300 Subject: [PATCH] Use correct shared memory size (in words, not bytes) --- Ryujinx.Graphics.Gpu/Engine/Compute.cs | 2 +- Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Ryujinx.Graphics.Gpu/Engine/Compute.cs b/Ryujinx.Graphics.Gpu/Engine/Compute.cs index bbf1eeaae..46857b33c 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Compute.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Compute.cs @@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Gpu.Engine ulong shaderGpuVa = shaderBaseAddress.Pack() + (uint)dispatchParams.ShaderOffset; // Note: A size of 0 is also invalid, the size must be at least 1. - int sharedMemorySize = Math.Clamp(dispatchParams.SharedMemorySize & 0xffff, 1, _context.Capabilities.MaximumComputeSharedMemorySize); + int sharedMemorySize = Math.Clamp(dispatchParams.SharedMemorySize & 0xffff, 4, _context.Capabilities.MaximumComputeSharedMemorySize); ComputeShader cs = _shaderCache.GetComputeShader( shaderGpuVa, diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index 7b9c20eb1..d54c19420 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -212,7 +212,7 @@ namespace Ryujinx.Graphics.Gpu.Shader int[] codeCached = MemoryMarshal.Cast(code.Slice(0, program.Size)).ToArray(); - program.Replace(DefineNames.SharedMemorySize, sharedMemorySize.ToString(CultureInfo.InvariantCulture)); + program.Replace(DefineNames.SharedMemorySize, (sharedMemorySize / 4).ToString(CultureInfo.InvariantCulture)); program.Replace(DefineNames.LocalSizeX, localSizeX.ToString(CultureInfo.InvariantCulture)); program.Replace(DefineNames.LocalSizeY, localSizeY.ToString(CultureInfo.InvariantCulture));