SOP:
simple moveKernel
#include "interpolate.h" float lerpConstant( constant float * in, int size, float pos); float3 getFloat3(global float * data, int i) { return (float3)(data[i*3+0], data[i*3+1], data[i*3+2]); } void setFloat3(global float * dataout, int i, float3 datain) { dataout[i*3+0] = datain.s0; dataout[i*3+1] = datain.s1; dataout[i*3+2] = datain.s2; } kernel void moveKernel( float time, int test_length, global float * test ) { int idx = get_global_id(0); if (idx >= test_length) return; float3 datain = getFloat3(test,idx); datain.s1 += time; setFloat3(test,idx, datain); }
binding:
<2>
时间: 2024-11-20 16:48:29