I hadn't intended to do this so soon, but looking through the code in Host_Frame earlier on it struck me that sound was obviously candidate number 1 for multithreading: the S_Update function call from there runs in complete isolation and can be run parallel with the renderer.
A quick read up on critical sections and some experimental code later and DirectQ now has it's own sound thread. The really nice thing about sound is that even the calls from the menus are executed while the main host process has the critical section, so proper isolation was easy to achieve. I can now get rid of S_ExtraUpdate and all the baggage that goes with it, and I have a situation where if the renderer is running slowly it won't cause sound to stutter or break up.
Tuesday, January 5, 2010
Multithreaded DirectQ
Posted by
mhquake
at
5:36 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment