diff options
Try out deferred particle streaming
i.e. apply direct Euler multiple times for each moment collection
-rw-r--r-- | channel_2d_gl_interop.py | 4 | ||||
-rw-r--r-- | simulation.py | 9 |
2 files changed, 5 insertions, 8 deletions
diff --git a/channel_2d_gl_interop.py b/channel_2d_gl_interop.py index 69af67b..a47d6c0 100644 --- a/channel_2d_gl_interop.py +++ b/channel_2d_gl_interop.py @@ -180,6 +180,10 @@ particles = Particles( def on_display(): for i in range(0,updates_per_frame): lattice.evolve() + + lattice.collect_gl_moments() + + for i in range(0,updates_per_frame): lattice.update_gl_particles(particles) lattice.sync() diff --git a/simulation.py b/simulation.py index b9df3f0..f8ce4eb 100644 --- a/simulation.py +++ b/simulation.py @@ -235,14 +235,7 @@ class Lattice: self.queue, self.grid.size(), self.layout, self.memory.cl_pop_a, self.memory.cl_material, self.memory.cl_gl_moments) def update_gl_particles(self, particles): - cl.enqueue_acquire_gl_objects(self.queue, [self.memory.cl_gl_moments, particles.cl_gl_particles]) - - if self.tick: - self.program.collect_gl_moments( - self.queue, self.grid.size(), self.layout, self.memory.cl_pop_b, self.memory.cl_material, self.memory.cl_gl_moments) - else: - self.program.collect_gl_moments( - self.queue, self.grid.size(), self.layout, self.memory.cl_pop_a, self.memory.cl_material, self.memory.cl_gl_moments) + cl.enqueue_acquire_gl_objects(self.queue, [particles.cl_gl_particles]) self.program.update_particles( self.queue, (particles.count,1), None, self.memory.cl_gl_moments, self.memory.cl_material, particles.cl_gl_particles) |