summaryrefslogtreecommitdiff
path: root/gpu.py
diff options
context:
space:
mode:
Diffstat (limited to 'gpu.py')
-rw-r--r--gpu.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/gpu.py b/gpu.py
index 5ad195d..7e45c3d 100644
--- a/gpu.py
+++ b/gpu.py
@@ -207,13 +207,20 @@ class GPU(object):
self.print_device_usage()
def reset_colors(self):
- self.colors_gpu.set(self.geometry.colors.astype(np.uint32))
+ self.colors_gpu.set_async(self.geometry.colors.astype(np.uint32))
- def color_solids(self, solid_ids, colors):
- solid_ids_gpu = gpuarray.to_gpu(np.array(solid_ids, dtype=np.int32))
+ def color_solids(self, solid_hit, colors):
+ solid_hit_gpu = gpuarray.to_gpu(np.array(solid_hit, dtype=np.bool))
solid_colors_gpu = gpuarray.to_gpu(np.array(colors, dtype=np.uint32))
- self.geo_funcs.color_solids(np.int32(solid_ids_gpu.size), np.uint32(self.triangles_gpu.size), self.solid_id_map_gpu, solid_ids_gpu, solid_colors_gpu, block=(self.nthread_per_block,1,1), grid=(solid_ids_gpu.size//self.nthread_per_block+1,1))
+ for first_triangle, triangles_this_round, blocks in chunk_iterator(self.triangles_gpu.size, self.nthread_per_block, self.max_blocks):
+ self.geo_funcs.color_solids(np.int32(first_triangle),
+ np.int32(triangles_this_round),
+ self.solid_id_map_gpu,
+ solid_hit_gpu,
+ solid_colors_gpu,
+ block=(self.nthread_per_block,1,1),
+ grid=(blocks,1))
self.context.synchronize()
def setup_propagate(self, seed=1):