diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-11-02 21:42:25 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-11-02 21:42:25 -0400 |
| commit | 995207c93e0af09bbb8243d9857095682c2a2713 (patch) | |
| tree | 1eb69a17ecf4590669a05ae3bf731f07b510e109 | |
| parent | 225a5bd113600a12cf37992ba377a95ba5e6fa3e (diff) | |
| download | balls-995207c93e0af09bbb8243d9857095682c2a2713.zip | |
move(): optimize memory access
| -rw-r--r-- | balls.cl | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -15,10 +15,13 @@ float volume(float radius); __kernel void move(__global float2 *positions, __global float2 *velocities) { size_t id; + float2 v; id = get_global_id(0); - velocities[id].y -= G / FPS; - positions[id] += velocities[id] / FPS; + v = velocities[id]; + v.y -= G / FPS; + positions[id] += v / FPS; + velocities[id] = v; } __kernel void |