缓存(Buffer)
Metal 着色语言中的缓存(buffer)指的是指向内建类型或者用户自定义类型, 并且被定义在device 或者 constant 的地址空间。 (关于device, constant 可以参看 Address Space Qualifiers for Variables and Arguments for a full description of these address qualifiers)。 缓存可以在程序中声明或者用在函数的参数传递上。
举例如下:
device float4 *device_buffer;
struct my_user_data {
float4 a;
float b;
int2 c;
};
constant my_user_data *user_data;