From: Hedayat V. <hed...@ai...> - 2008-03-08 17:42:04
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html style="direction: ltr;"> <head> <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> </head> <body style="direction: ltr;" bgcolor="#ffffff" text="#000000"> <span>Hi Yuan,<br> <br> <style type="text/css">blockquote {color: navy !important; background-color: RGB(245,245,245) !important; padding: 0 15 10 15 !important; margin: 15 0 0 0; border-left: #1010ff 2px solid;} blockquote blockquote {color: maroon !important; background-color: RGB(235,235,235) !important; border-left-color:maroon !important} blockquote blockquote blockquote {color: green !important; background-color: RGB(225,225,225) !important; border-left-color:teal !important} blockquote blockquote blockquote blockquote {color: purple !important; background-color: RGB(215,215,215) !important; border-left-color: purple !important} blockquote blockquote blockquote blockquote blockquote {color: teal !important; background-color: RGB(205,205,205) !important; border-left-color: green !important}</style><i><b>"Yuan Xu" <a class="moz-txt-link-rfc2396E" href="mailto:xuy...@gm..."><xuy...@gm...></a></b></i> wrote on 03/08/2008 08:27:05 AM:</span><br> <blockquote style="border-left: 2px solid rgb(16, 16, 255); color: navy; background-color: rgb(245, 245, 245); padding-left: 15px;" cite="mid:18a...@ma..." type="cite"> <pre wrap="">Hi Hedayat, Thanks for your reply. [...] GameControlServer should be updated after the PostPhysicsUpdate. So the loop of the main thread should be: mSceneServer->PrePhysicsUpdate mSceneServer->PhysicsUpdate mSceneServer->PostPhysicsUpdate GameControlServer->Update </pre> </blockquote> Done. Thanks! <br> <blockquote style="border-left: 2px solid rgb(16, 16, 255); color: navy; background-color: rgb(245, 245, 245); padding-left: 15px;" cite="mid:18a...@ma..." type="cite"> <blockquote type="cite"> <pre wrap=""> I'm using Mesa 7.0.1 with nvidia binary driver 169.09 and the problem still exists. Yes, the main reason was rendering, but there is another problem too. FRP sensor calls dJointGetFeedback(). ODE is not thread safe and this call will generate segmentation faults some times. Also, this call should happen before next physics update since the feedback information will not be available then (I think!). </pre> </blockquote> <pre wrap=""><!----> Bad news, the OpenGL should be thread-safe. </pre> </blockquote> Yes :(. But Mesa might be thread safe now. Since I've installed nvidia binary drivers, simspark uses nvidia OpenGL libraries instead of using Mesa. So, I can't say anything about mesa, but nvidia opengl is not thread safe.<br> <br> <blockquote style="border-left: 2px solid rgb(16, 16, 255); color: navy; background-color: rgb(245, 245, 245); padding-left: 15px;" cite="mid:18a...@ma..." type="cite"> <pre wrap=""> You can call dJointGetFeedback() in PostPhysicsUpdateInternal(), and cache the feedback information. It just likes cache the actions and realize them in PrePhysicsUpdateInternal(). </pre> </blockquote> <br> Good suggestion. I never liked creating feedback structs using new, and I've changed the code so the dJointFeedbacks are now stored inside ForceResistancePerceptor and no ODE calls are necessary anymore. It solved the problem.<br> <br> <blockquote style="border-left: 2px solid rgb(16, 16, 255); color: navy; background-color: rgb(245, 245, 245); padding-left: 15px;" cite="mid:18a...@ma..." type="cite"> <pre wrap=""><!----> Ah, I see! It is OK, and much simpler and clear than the old code, great job! </pre> </blockquote> Thanks! :)<br> <blockquote style="border-left: 2px solid rgb(16, 16, 255); color: navy; background-color: rgb(245, 245, 245); padding-left: 15px;" cite="mid:18a...@ma..." type="cite"> <pre wrap="">But there may be a small problem in current code: The scene tree should not be accessed by the main thread and SimCtrThreads at the same time. (May be the problem will come after you remove the Step().) So when call the follow functions, the SimCtrThreads should be blocked. mSceneServer->PrePhysicsUpdate mSceneServer->PostPhysicsUpdate GameControlServer->Update So the lines in RunMultiThreaded() needs adjustment, I think it is easy for you. </pre> </blockquote> I thought that I can call mSceneServer->PrePhysicsUpdate() in parallel :(. This is really bad! This function should be called after EndCycle() functions which run in parallel now. So, protecting mSceneServer->PrePhysicsUpdate() needs two more wait() calls. I wonder if this can be worse than calling EndCycle() and mSceneServer->PrePhysicsUpdate() functions in the main thread!<br> <br> The interesting (not much!) point is that I have not encountered any problems by calling mSceneServer->PrePhysicsUpdate() in parallel till now! Is there any conflicts between mSceneServer->PrePhysicsUpdate() and EndCycle() functions in the current code?! <br> <br> I've committed my changes. Any suggestions/comments are highly appreciated!<br> <br> Thanks,<br> Hedayat<br> </body> </html> |