Multi threading off then on
I'm using Win32 SYNCHRONIZATION_BARRIER objects that block a thread's execution until I need it. So I can spawn some worker threads to divide up the work of finding the first collision time. This gives a substantial performance boost over trying to find the first collision time in a single thread. The worker threads wait at the SYNCHRONIZATION_BARRIER until the main thread is ready for them.
In the video, the first run is a single thread. the update time approaches 80ms. Then I switch to 12 threads and the update time is around 20 ms. Not bad considering there are 360 balls doing a bad n^2 algorithm. I want to eventually do spatial partitioning, like BVH.
I'm also looking for more places I can implement multi threading instead of it only being used to find collision results.
The code is only updating one ball at a time to have perfect accuracy, thats why it gets so slow with only a relatively low amount of balls.
Other Videos By Michael Lundgren (GoldenShadow)
2023-02-22 | Prototype Anti-Satellite Missile |
2023-02-07 | Launch Window Calculator |
2022-12-16 | The Long Dark Bear attack |
2022-11-22 | Rimworld Crazed Rhino pack vs Uranium Slug Turrets and a minefield |
2022-10-21 | Hive Sweeper |
2022-10-02 | The game is getting sticky. Added cue stick |
2022-09-27 | Collision avoidance on scratch recovery |
2022-09-25 | Camera Smoothing and mouse aiming polish |
2022-09-22 | Mouse Pointer Aiming (Finally) |
2022-09-21 | Breaking the triangle |
2022-09-20 | Multi threading off then on |
2022-09-15 | Filling up the side pocket to max capacity |
2022-09-14 | Accidently wrote color on the shadow map in the ball shader and got this cool result. |
2022-09-14 | DX11 Milestone - Shadow Mapping |
2022-09-13 | Figured out how to use Render to Texture |
2022-09-12 | PoolBall Follow Camera transfers ownership on contact |
2022-09-07 | Basic Texture PoolTable Model |
2022-09-05 | Untextured Pool Table Model WIP |
2022-08-31 | 1:1 collision with Imported geometry |
2022-08-30 | Triangle racking |
2022-08-29 | First triangle collision test |