aboutsummaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-20 15:43:58 +0200
committerAdrian Kummerlaender2019-06-20 15:43:58 +0200
commitdfcb729ff162aba45e3d83acf864fe1ff92e5a06 (patch)
tree01ac11491c4b29f70a007e7e4af783ea05d580d3 /template
parentce971fa70059079ca2328f5fbf49a751c4833399 (diff)
downloadsymlbm_playground-dfcb729ff162aba45e3d83acf864fe1ff92e5a06.tar
symlbm_playground-dfcb729ff162aba45e3d83acf864fe1ff92e5a06.tar.gz
symlbm_playground-dfcb729ff162aba45e3d83acf864fe1ff92e5a06.tar.bz2
symlbm_playground-dfcb729ff162aba45e3d83acf864fe1ff92e5a06.tar.lz
symlbm_playground-dfcb729ff162aba45e3d83acf864fe1ff92e5a06.tar.xz
symlbm_playground-dfcb729ff162aba45e3d83acf864fe1ff92e5a06.tar.zst
symlbm_playground-dfcb729ff162aba45e3d83acf864fe1ff92e5a06.zip
Prototype OpenGL interoperation
Diffstat (limited to 'template')
-rw-r--r--template/kernel.mako25
1 files changed, 25 insertions, 0 deletions
diff --git a/template/kernel.mako b/template/kernel.mako
index 1790f88..d9b1c80 100644
--- a/template/kernel.mako
+++ b/template/kernel.mako
@@ -97,3 +97,28 @@ __kernel void collect_moments(__global __read_only float* f,
moments[${pop_offset(i)} + gid] = ${ccode(expr.rhs)};
% endfor
}
+
+__kernel void collect_gl_moments(__global __read_only float* f,
+ __global __write_only float4* moments)
+{
+ const unsigned int gid = ${gid()};
+
+ __global __read_only float* preshifted_f = f + gid;
+
+% for i in range(0,descriptor.q):
+ const float f_curr_${i} = preshifted_f[${pop_offset(i)}];
+% endfor
+
+% for i, expr in enumerate(moments_subexpr):
+ const float ${expr[0]} = ${ccode(expr[1])};
+% endfor
+
+ 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;
+
+ moments[gid] = data;
+}