aboutsummaryrefslogtreecommitdiff
path: root/template/kernel.mako
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-21 20:41:11 +0200
committerAdrian Kummerlaender2019-06-21 20:41:11 +0200
commit1f5b9393f7317f7e505fd4f60991797fa273e3d2 (patch)
tree6f089cd7e99856b89c6158ac8f4729d2d40c0f0b /template/kernel.mako
parentdfcb729ff162aba45e3d83acf864fe1ff92e5a06 (diff)
downloadsymlbm_playground-1f5b9393f7317f7e505fd4f60991797fa273e3d2.tar
symlbm_playground-1f5b9393f7317f7e505fd4f60991797fa273e3d2.tar.gz
symlbm_playground-1f5b9393f7317f7e505fd4f60991797fa273e3d2.tar.bz2
symlbm_playground-1f5b9393f7317f7e505fd4f60991797fa273e3d2.tar.lz
symlbm_playground-1f5b9393f7317f7e505fd4f60991797fa273e3d2.tar.xz
symlbm_playground-1f5b9393f7317f7e505fd4f60991797fa273e3d2.tar.zst
symlbm_playground-1f5b9393f7317f7e505fd4f60991797fa273e3d2.zip
Gather interop moments in a more generic manner
i.e. return unshifted moments in a implicitly ordered float4 array. Cell positions are reconstructed by a vertex shaded analogously to how it is done in compustream.
Diffstat (limited to 'template/kernel.mako')
-rw-r--r--template/kernel.mako15
1 files changed, 11 insertions, 4 deletions
diff --git a/template/kernel.mako b/template/kernel.mako
index d9b1c80..417851a 100644
--- a/template/kernel.mako
+++ b/template/kernel.mako
@@ -115,10 +115,17 @@ __kernel void collect_gl_moments(__global __read_only float* f,
float4 data;
- data.x = 4.0*((float)(get_global_id(0))) + ${ccode(2000*moments_assignment[1].rhs)};
- data.y = 4.0*((float)(get_global_id(1))) + ${ccode(2000*moments_assignment[2].rhs)};
- data.z = 0.0;
- data.w = 1.0;
+% if descriptor.d == 2:
+ data.x = ${ccode(moments_assignment[0].rhs)};
+ data.y = ${ccode(moments_assignment[1].rhs)};
+ data.z = ${ccode(moments_assignment[2].rhs)};
+ data.w = sqrt(data.y*data.y + data.z*data.z);
+% elif descriptor.d == 3:
+ data.x = ${ccode(moments_assignment[0].rhs)};
+ data.y = ${ccode(moments_assignment[1].rhs)};
+ data.z = ${ccode(moments_assignment[2].rhs)};
+ data.w = ${ccode(moments_assignment[3].rhs)};
+% endif
moments[gid] = data;
}