aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcl/particles/particles.cl
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-04-17 10:53:25 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-04-17 09:43:36 +0000
commit5051c63b3b818f5fb0ed9f92e74b916ea9d4e723 (patch)
treec44cd5f423d8e6a8217e7f7557ed9cd79c136bf6 /examples/quickcl/particles/particles.cl
parent6d073d4e070790d4e9ef707a9deef975e9f70695 (diff)
Long live QtQuickCL!
Change-Id: I16954f50c631441189dd450980da2c3266a68c71 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'examples/quickcl/particles/particles.cl')
-rw-r--r--examples/quickcl/particles/particles.cl13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/quickcl/particles/particles.cl b/examples/quickcl/particles/particles.cl
new file mode 100644
index 0000000..47a8013
--- /dev/null
+++ b/examples/quickcl/particles/particles.cl
@@ -0,0 +1,13 @@
+kernel void updateParticles(global float *buf, float t, float dt, global float *info)
+{
+ int idx = get_global_id(0) * 2;
+ if (t < 0.000001f) {
+ buf[idx] = -1.0f;
+ buf[idx + 1] = -1.0f;
+ } else {
+ float2 dir = (float2)(info[idx], info[idx + 1]);
+ float2 speed = (float2)(info[idx + 2], info[idx + 3]);
+ buf[idx] += dir.x * dt * speed.x;
+ buf[idx + 1] += dir.y * dt * speed.y;
+ }
+}