Metal着色语言编程指南 二五

来源:互联网 发布:网络二层 三层区别 编辑:程序博客网 时间:2024/06/05 01:03

线程地址空间(Thread Address Space)

   thread地址空间修饰符表示其所修饰的地址为线程的私有空间, 仅仅在其被声明的线程可见, 在graphics和kernal函数内所声明的变量都是在线程地址空间上分配的。代码实例如下:

kernel void my_func(...){    // A float allocated in the per-thread address space    float x;    // A pointer to variable x in per-thread address space    thread float p = &x;    ...}


译自:https://developer.apple.com/library/ios/documentation/Metal/Reference/MetalShadingLanguageGuide/func-var-qual/func-var-qual.html#//apple_ref/doc/uid/TP40014364-CH4-SW2

2 0
原创粉丝点击