summaryrefslogtreecommitdiff
path: root/src/opencl_mesh_kit.hpp
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2013-04-19 20:46:21 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2013-04-19 20:46:21 +0000
commitf88f52617be9966cddd3ec28d590704fb8a615eb (patch)
tree943ff25992e8e5721a28a18925f5acd634358ec1 /src/opencl_mesh_kit.hpp
parent151d0ff1af64b058f37610e61c6de7e7845416d2 (diff)
download2013-gpudataviz-f88f52617be9966cddd3ec28d590704fb8a615eb.tar.gz
2013-gpudataviz-f88f52617be9966cddd3ec28d590704fb8a615eb.tar.bz2
2013-gpudataviz-f88f52617be9966cddd3ec28d590704fb8a615eb.zip
Ajout option -Werror et affichage lorsque ca compile pas.origin/trunk
Amelioration des kernels en conséquence. Bugfix avec le sizeof(source) qui prennait un caractère de trop (le '\0') git-svn-id: file:///var/svn/2013-gpudataviz/trunk@31 371a6b4a-a258-45f8-9dcc-bdd82ce0ac9d
Diffstat (limited to 'src/opencl_mesh_kit.hpp')
-rw-r--r--src/opencl_mesh_kit.hpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/opencl_mesh_kit.hpp b/src/opencl_mesh_kit.hpp
index 5efd30e..29e8d64 100644
--- a/src/opencl_mesh_kit.hpp
+++ b/src/opencl_mesh_kit.hpp
@@ -52,18 +52,12 @@ const char kernel_src_zero_z[]=STRINGIFY(
__kernel void zero_z(__global float4 *pos, unsigned int width, unsigned int height, float time) {
unsigned int nx = get_global_id(0);
unsigned int ny = get_global_id(1);
- /* calculate uv coordinates of the mesh point [0.0;1.0] */
- float u = nx / (float) width;
- float v = ny / (float) height;
- /* calculate centered normalized coordinates [-1.0;1.0] */
- float x = u*2.0-1.0;
- float y = v*2.0-1.0;
- /* Calculate the desirated value of the mesh point */
- float z = 0.0f;
- /* We only use normalized quaterinons here */
- float w = 1.0f;
- /* Write output vertex (centered) */
- pos[ny*width+nx] = (float4)(x, y, z, w);
+ float4 out;
+ out.x = nx / (float) width * 2.0f - 1.0f;
+ out.y = ny / (float) height * 2.0f - 1.0f;
+ out.z = 0.0f;
+ out.w = 1.0f;
+ pos[ny*width+nx] = out;
}
);