Browse Source

Read previous volume value early

Tomas Farago 9 years ago
parent
commit
e015fd9521
1 changed files with 2 additions and 5 deletions
  1. 2 5
      src/kernels/templates/common.in

+ 2 - 5
src/kernels/templates/common.in

@@ -19,16 +19,13 @@ kernel void backproject_burst_{0} (
     int idy = get_global_id (1);
     int idz = get_global_id (2);
     float result, tmp, tmp_x, tmp_y;
+    float old = cumulate ? volume[idz * real_size.x * real_size.y + idy * real_size.x + idx] : 0.0f;
     float2 pixel;
     float3 voxel;
 
     if (idx < real_size.x && idy < real_size.y && idz < real_size.z) {{
 {3}
 
-        if (cumulate) {{
-            volume[idz * real_size.x * real_size.y + idy * real_size.x + idx] += result;
-        }} else {{
-            volume[idz * real_size.x * real_size.y + idy * real_size.x + idx] = result;
-        }}
+        volume[idz * real_size.x * real_size.y + idy * real_size.x + idx] = old + result;
     }}
 }}