| … | … | @@ -139,7 +139,11 @@ class Session: |
| 139 | 139 | self.width = 0 |
| 140 | 140 | self.height = 0 |
| 141 | 141 | self.last_view = None |
| 142 | | self.dispatch_count = 0 |
| 142 | # Two counters, deliberately. `dispatch_cnt` goes into the kernel's hash |
| 143 | # and must NEVER repeat, or a restarted accumulation replays the identical |
| 144 | # sample set. `since_reset` decides when to re-seed the point state. |
| 145 | self.dispatch_count = 0 # monotonic, feeds the RNG |
| 146 | self.since_reset = 0 # zeroed by invalidate() |
| 143 | 147 | self.frames = 0 |
| 144 | 148 | |
| 145 | 149 | self.kernel, self.drain, self.library = ifs_render._build_shaders( |
| … | … | @@ -297,7 +301,11 @@ class Session: |
| 297 | 301 | self.histogram.clear(format='UINT', value=(0, 0, 0, 0)) |
| 298 | 302 | self.accum.clear(format='FLOAT', value=(0.0, 0.0, 0.0, 0.0)) |
| 299 | 303 | self.state.clear(format='FLOAT', value=(0.0, 0.0, 0.0, 0.0)) |
| 300 | | self.dispatch_count = 0 |
| 304 | # dispatch_count is NOT reset: it is hash input, and rewinding it makes |
| 305 | # every restart draw the same points. Under continuous camera motion that |
| 306 | # is a fixed constellation sliding across the screen rather than the |
| 307 | # fractal - which is what fly mode looked like. |
| 308 | self.since_reset = 0 |
| 301 | 309 | |
| 302 | 310 | # -------------------------------------------------------------------- camera |
| 303 | 311 | |
| … | … | @@ -369,7 +377,7 @@ class Session: |
| 369 | 377 | frame = gpu.types.GPUUniformBuf(ifs_host.pack_frame( |
| 370 | 378 | seed=0x9E3779B9, width=self.width, height=self.height, |
| 371 | 379 | dispatch_cnt=self.dispatch_count, |
| 372 | | reset_points_state=1 if self.dispatch_count == 0 else 0, |
| 380 | reset_points_state=1 if self.since_reset == 0 else 0, |
| 373 | 381 | invocation_iters=self.iters_per_frame)) |
| 374 | 382 | |
| 375 | 383 | self.kernel.bind() |
| … | … | @@ -382,6 +390,7 @@ class Session: |
| 382 | 390 | self.kernel.uniform_block(name, ubo) |
| 383 | 391 | gpu.compute.dispatch(self.kernel, ifs_render.WORKGROUPS, 1, 1) |
| 384 | 392 | self.dispatch_count += 1 |
| 393 | self.since_reset += 1 |
| 385 | 394 | |
| 386 | 395 | self.drain.bind() |
| 387 | 396 | self.drain.image('histogram_img', self.histogram) |
| … | … | @@ -420,7 +429,7 @@ class Session: |
| 420 | 429 | |
| 421 | 430 | @property |
| 422 | 431 | def iterations(self): |
| 423 | | return self.dispatch_count * self.iters_per_frame * ifs_render.INVOCATIONS |
| 432 | return self.since_reset * self.iters_per_frame * ifs_render.INVOCATIONS |
| 424 | 433 | |
| 425 | 434 | |
| 426 | 435 | def start(document_path, iters_per_frame=400): |