cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Peterp
Journeyman III

Java Code to GPU

Hi,

i want to convert the following code to Brook+, is it possible?

 

 

 



 

for (int k = 0; k < MAX; k++)

{

for (int j = 0; j < MAX-1; j++)

{

Direction d0 = data

;

Direction d1 = data

[j+1];

double fr = speed * (d1.r - d0.r);

d0.Fr += fr;

d1.Fr -= fr;

}

}

 

I'm just reading the ATI Streaming Guide but i'm note sure about how to index the stream correct:

 

kernel void speed(int width, float a[], out float c[])

{

int index = instance().x;

float p1 = a[index];

float p2 = a[index+1];

float diff = 2.0f * (p2-p1);

c[index] = p1+diff;

c[index+1] = p2-diff;

}



 







0 Likes
0 Replies