Explorar el Código

Ensure a valid shared memory size is used

gdkchan hace 6 años
padre
commit
ad3bc2531b
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      Ryujinx.Graphics.Gpu/Engine/Compute.cs

+ 4 - 1
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());