aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Engine/Compute.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-12-09 18:57:49 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commitad3bc2531ba920d479691e4bd9d9e03373bb28b2 (patch)
tree36ffb015785f68d9f5d13c92f1b8bb9d97de7eb4 /Ryujinx.Graphics.Gpu/Engine/Compute.cs
parent66d91cbc6cdd0310c567eb9f979458bd80ea0269 (diff)
Ensure a valid shared memory size is used
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/Compute.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Compute.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Compute.cs b/Ryujinx.Graphics.Gpu/Engine/Compute.cs
index 61e6b326..bbf1eeaa 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Compute.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Compute.cs
@@ -20,9 +20,12 @@ 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);
+
ComputeShader cs = _shaderCache.GetComputeShader(
shaderGpuVa,
- dispatchParams.SharedMemorySize & 0xffff,
+ sharedMemorySize,
dispatchParams.UnpackBlockSizeX(),
dispatchParams.UnpackBlockSizeY(),
dispatchParams.UnpackBlockSizeZ());