AlgebraMaster

Modern C++ 创造非凡 . 改变世界

导航

Houdini OpenCL

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);
}
View Code

binding:

 

 

 

<2>

posted on 2017-08-29 13:05  gearslogy  阅读(678)  评论(0编辑  收藏  举报