Xcode 自动生成用于将 OpenCL 内核提交到调度队列的代码,但它似乎生成了无法为我的内核之一编译的无效代码。问题在于结构定义:
typedef struct {
float4 position; ///< The point position.
float4 velocity; ///< The point velocity.
float intensity; ///< The point intensity.
int links[6]; ///< The point links specified as indexes for other points in the array.
float align; ///< Dummy for alignment.
} PointElement;
此代码由 Xcode 生成:
typedef struct {
cl_float4 position;
cl_float4 velocity;
cl_float intensity;
int [6] links;
cl_float align;
} _PointElement_unalign;
我不是晦涩的 C 语法变体专家,但它肯定int [6] links;
不是有效的 C,因此无法编译。
为什么 Xcode 会这样做?我自己做错了什么还是这是一个错误?