aboutsummaryrefslogtreecommitdiff
path: root/template/kernel.mako
diff options
context:
space:
mode:
Diffstat (limited to 'template/kernel.mako')
-rw-r--r--template/kernel.mako10
1 files changed, 8 insertions, 2 deletions
diff --git a/template/kernel.mako b/template/kernel.mako
index f6bac7f..1ee39cd 100644
--- a/template/kernel.mako
+++ b/template/kernel.mako
@@ -140,6 +140,7 @@ __kernel void collect_gl_moments(__global __read_only ${float_type}* f,
}
__kernel void update_particles(__global __read_only float4* moments,
+ __global __read_only int* material,
__global __write_only float4* particles)
{
const unsigned int pid = get_global_id(0);
@@ -150,8 +151,13 @@ __kernel void update_particles(__global __read_only float4* moments,
float4 moment = moments[gid];
- particle.x += moment.y;
- particle.y += moment.z;
+ if (material[gid] == 1) {
+ particle.x += moment.y;
+ particle.y += moment.z;
+ } else {
+ particle.x = particle.z;
+ particle.y = particle.w;
+ }
particles[pid] = particle;
}