'Unity Metal: Compute shader has 1024 threads in a thread group which is more than the supported max of 512 in this device

I'm compiling a code for unity ios build and keep getting the following error

Metal: Compute shader has 1024 threads in a thread group which is more than the supported max of 512 in this device

pls help me in resolving this error.

thanks



Solution 1:[1]

It means your shader trying to use more threads than iOS supported.

To solve it just reduce using threads in the compute shader by changing this line in your compute shader

[numthreads(32,32,1)]

to

[numthreads(8,8,1)]

and also in your c# script

_shader.Dispatch(CSMain, 32, 32, 1); to _shader.Dispatch(CSMain, 8, 8, 1);

for more information about thread numbers, check this msdn link.

Solution 2:[2]

I'm not an IOS developer, but looking into this there is a function to see if your shader features are supported on the current device https://developer.apple.com/documentation/metalperformanceshaders/1618849-mpssupportsmtldevice

You can also see what devices support which shader features here https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AmirHossein
Solution 2 Tom Huntington