1
我试图在金属着色器中包含一个头文件。 对于原型就是这样,金属:未知的类型名称float4
float4 someFunction(float4 v);
我收到此错误信息,
Unknown type name 'float4'; did you mean 'float'?
似乎并不知道这是一个着色器程序头......虽然其他错误提示它。举例来说,如果我没有在这里指定的地址空间,
static float someK = 2.0;
我得到这个错误,
Global variables must have a constant address space qualifier
可固定如果我添加
constant static float someK = 2.0;
如果我使用参考文献,我也得到这些类型的错误,
Reference type must include device, threadgroup, constant, or thread address space qualifier
所以它看起来好像编译器知道它是着色器。为什么它不知道float4? :(
感谢我并不需要包括在metal_stdlib!我的头文件,但我没有意识到我需要在矢量类型头的金属名称空间...愚蠢的!再次感谢:) – endavid
这不适合我 - 最近有什么变化?它工作在一个普通的头部,但不是在Swift和Metal中使用的桥头。 – bsabiston