Access vector type OpenCL

后端 未结 6 898
礼貌的吻别
礼貌的吻别 2020-12-14 11:53

I have a variable whithin a kernel like:

int16 element;

I would like to know if there is a way to adress the third int in element like

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 12:44

    No that's not possible. At least not dynamically at runtime. But you can use an "compile-time"-index to access a component:

    float4 v;
    v.s0 == v.x; // is true
    v.s01 == v.xy // also true
    

    See http://www.khronos.org/registry/cl/specs/opencl-1.1.pdf Section 6.1.7

提交回复
热议问题