summaryrefslogtreecommitdiff
path: root/src/modules/compose
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-09-04 20:45:42 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-09-04 20:54:50 -0700
commit6d6c14180096fc4417aeecd489146e0f6fe6f721 (patch)
tree9dcc9ac0e90eb2b369a6651559b8a086203e480b /src/modules/compose
parentbab16b070f95687ec11d43e55f3dd6e69f96a576 (diff)
modules/flow: implement threaded rendering
This exploits the just added multipass rendering support. In the first pass, the flow-field is sampled and applied to the elements, with every thread operating on its own subset of the elements list. Since the flow-field sampling is all read-only, it's perfectly safe too do in parallel. Nothing is drawn in the first pass, it's only the elements updating according to the flow-field which is performed. In the second pass, the elements are rendered in parallel using the slice_per_cpu fragmenter. Since the elements are kept on a simple array, with no spatial indexing, every thread must visit every element. Since the fragmenter used divides the frame into horizontal slices, every thread needing to reject elements not overlapping its region can take some shortcuts in easily identifying elements entirely outside its region. But the whole 3d->2d projection step must still be performed for every element's current position and +n_iters final position for the frame, which does have a divide unfortunately. Nonetheless, this change improves frame rates substantially on my 2c/4t i7 X230 as benchmarked w/--video=mem,1366x768: --seed=0x64fa9508 '--module=rtv,channels=flow,duration=3,context_duration=3,caption_duration=0,log_channels=on,snow_duration=0,snow_module=none' '--video=mem,size=1366x768' rtv channel settings: 'flow,size=4,count=40000,speed=.8' FPS: 261 FPS: 265 rtv channel settings: 'flow,size=4,count=1000,speed=.9' FPS: 1153 FPS: 3204 FPS: 2934 rtv channel settings: 'flow,size=8,count=5000,speed=.9' FPS: 2923 FPS: 1634 FPS: 1592 rtv channel settings: 'flow,size=2,count=50000,speed=.4' FPS: 1006 FPS: 219 FPS: 268 rtv channel settings: 'flow,size=16,count=30000,speed=.8' FPS: 304 FPS: 350 FPS: 343 rtv channel settings: 'flow,size=16,count=30000,speed=.02' FPS: 379 FPS: 503 FPS: 472 rtv channel settings: 'flow,size=8,count=1000,speed=.16' FPS: 1393 FPS: 3822 FPS: 3876 --- Prior to this commit: --seed=0x64fa9508 '--module=rtv,channels=flow,duration=3,context_duration=3,caption_duration=0,log_channels=on,snow_duration=0,snow_module=none' '--video=mem,size=1366x768' rtv channel settings: 'flow,size=4,count=40000,speed=.8' FPS: 53 FPS: 53 rtv channel settings: 'flow,size=4,count=1000,speed=.9' FPS: 426 FPS: 1366 FPS: 1335 rtv channel settings: 'flow,size=8,count=5000,speed=.9' FPS: 1097 FPS: 368 FPS: 367 rtv channel settings: 'flow,size=2,count=50000,speed=.4' FPS: 279 FPS: 73 FPS: 74 rtv channel settings: 'flow,size=16,count=30000,speed=.8' FPS: 71 FPS: 71 FPS: 70 rtv channel settings: 'flow,size=16,count=30000,speed=.02' FPS: 136 FPS: 305 FPS: 305 rtv channel settings: 'flow,size=8,count=1000,speed=.16' FPS: 972 FPS: 2593 FPS: 2634
Diffstat (limited to 'src/modules/compose')
0 files changed, 0 insertions, 0 deletions
© All Rights Reserved