简体   繁体   English

Unity Metal:计算着色器在一个线程组中有 1024 个线程,超过了该设备支持的最大值 512

[英]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我正在为 unity ios build 编译代码并不断收到以下错误

Metal: Compute shader has 1024 threads in a thread group which is more than the supported max of 512 in this device金属:计算着色器在一个线程组中有 1024 个线程,超过了此设备支持的最大值 512

pls help me in resolving this error.请帮我解决这个错误。

thanks谢谢

It means your shader trying to use more threads than iOS supported. 这意味着您的着色器试图使用比iOS支持更多的线程。

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 以及在您的C#脚本中

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

for more information about thread numbers, check this msdn link . 有关线程号的更多信息,请检查此msdn 链接

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我不是 IOS 开发人员,但查看这个有一个 function 以查看当前设备是否支持您的着色器功能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您还可以在此处查看哪些设备支持哪些着色器功能https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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