Re: [Plib-users] Threading
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2001-04-12 00:38:14
|
"Curtis L. Olson" wrote: > > Those things are tricky and not 100% guaranteed - but for what you describe, > > there shouldn't be a problem. > > We have just begun to explore the idea of updating the scene graph > tree in a seperate thread from the main render thread. Clearly you > must never do anything in the update thread that could ever trigger an > opengl command (such as loading/registering a texture for example.) > > However, other than that we have been surprised that it has worked > pretty well and is very robust. Bear in mind that the PROBABILITY of a failure when you have a threading error can be very small - so it's crucial that you *know* that you are solidly "safe-by-design" because testing won't show up the problem in any reasonable amount of time and debuggers are largely useless. Particularly: * Don't add or remove entries from ssgBranch nodes during ssgCullAndDraw or the LOS/HAT routines. For scenery paging (which I'm guessing is what Curt is doing here), you can build up a scenery tile in your parallel thread (being careful about the texture load thing) - BUT connect that into the scene graph when the tile is fully loaded - and do it in the rendering thread - so you *know* that it's definitely not doing anything while it's making the connection. I generally build a pair of FIFO's between the rendering and paging threads, passing the addresses of completed terrain tiles in one direction and in the other direction, send the addresses of tiles that have already been disconnected from the scene graph (by the renderer) and which need to be physically deleted by the pager to save time. > Do know that threads are not necessarily nirvana, and unless you > really know what you are doing and exactly what the threading will > accomplish for you in advance, I'd recommend staying away from them as > long as you can. Yes. Without question. -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net http://freeglut.sourceforge.net |