Vishal
Vishal

Reputation: 160

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

Upvotes: 0

Views: 4042

Answers (2)

Tom Huntington
Tom Huntington

Reputation: 3425

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

Upvotes: 0

user2003412
user2003412

Reputation: 11

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.

Upvotes: 1

Related Questions