简体   繁体   中英

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

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 .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM