New painting problem

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

New painting problem

Postby Bird » Mon Oct 06, 2014 8:35 am

Hi Julio,

My plugin freezes up now using the latest Newton version when trying to paint new instances while the Newton engine is running.

To run the engine in LightWave, I repeatably call NewtonUpdateAsync() from a LW Timer callback and then later call NewtonWaitForUpdateToFinish() before updating the motions in LightWave. When I paint new instances while the engine is running, I do it on Newton's thread during a NewtonListener::postUpdate() in a listener I created with NewtonWorldAddPostListener().

This system has worked perfectly for me until now. Now it looks like painting is causing some sort of thread deadlock as soon as I press the mouse down to paint a new instance.

I don't use Ptheads anymore. Instead I use c11 std::threads
http://newtondynamics.com/forum/viewtopic.php?f=9&t=8657&p=55684&hilit=std%3A%3Athread+std%3A%3Athread+#p55684

-Bird
Bird
 
Posts: 437
Joined: Tue Nov 22, 2011 1:27 am

Re: New painting problem

Postby Julio Jerez » Mon Oct 06, 2014 11:05 am

Um

There was a chash bug on the AMP stiff, but I check in the fix,
on this file
C:\Development\newton-dynamics\coreLibrary_300\source\core\dgTypes.h

try commenting like 185 out
Code: Select all
#if ((defined (_WIN_32_VER) || defined (_WIN_64_VER)) && (_MSC_VER  >= 1700))
   /// starting Visual studio 2012 an up we cna use high performance computing using AMP
   //#define _NEWTON_AMP
#endif
Julio Jerez
Moderator
Moderator
 
Posts: 11040
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: New painting problem

Postby Bird » Mon Oct 06, 2014 11:51 am

I've tried that now but I'm still getting the deadlock

I tracked it down to the call I make to NewtonBodySetCollisionScale() after creating a new instance.

My plugin freezes when world->Sync () is called and it works fine if I comment out that line.

Code: Select all
void NewtonBodySetCollisionScale (const NewtonBody* const bodyPtr, dFloat scaleX, dFloat scaleY, dFloat scaleZ)
{
   TRACE_FUNCTION(__FUNCTION__);
   dgBody* const body = (dgBody *)bodyPtr;
   dgWorld* const world = body->GetWorld();
   NewtonCollision* const collision = NewtonBodyGetCollision(bodyPtr);

   world->Sync ();
   dgFloat32 mass = body->GetInvMass().m_w > dgFloat32 (0.0f) ? body->GetMass().m_w : dgFloat32 (0.0f);
   NewtonCollisionSetScale (collision, scaleX, scaleY, scaleZ);

   NewtonJoint* nextJoint;
   for (NewtonJoint* contactJoint = NewtonBodyGetFirstContactJoint(bodyPtr); contactJoint; contactJoint = nextJoint) {
      nextJoint = NewtonBodyGetNextContactJoint(bodyPtr, contactJoint);
      world->DestroyConstraint ((dgConstraint*)contactJoint);
   }
    NewtonBodySetMassProperties (bodyPtr, mass, collision);
   world->GetBroadPhase()->ResetEntropy ();
}
Bird
 
Posts: 437
Joined: Tue Nov 22, 2011 1:27 am

Re: New painting problem

Postby Julio Jerez » Mon Oct 06, 2014 12:17 pm

Oh I see, I added that tracking a bug, but yes that is a mistake, if it called form inside an update,
I will fix it,
Julio Jerez
Moderator
Moderator
 
Posts: 11040
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: New painting problem

Postby Julio Jerez » Mon Oct 06, 2014 4:17 pm

ok fixed it.
Julio Jerez
Moderator
Moderator
 
Posts: 11040
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: New painting problem

Postby Bird » Mon Oct 06, 2014 4:29 pm

Julio Jerez wrote:ok fixed it.


Got it. Thanks!

-Bird
Bird
 
Posts: 437
Joined: Tue Nov 22, 2011 1:27 am

Re: New painting problem

Postby manny » Tue Oct 07, 2014 2:07 pm

awesome, locking!
http://www.instaLOD.io - InstaLOD - State of the art 3D optimization
manny
Site Admin
Site Admin
 
Posts: 131
Joined: Tue Feb 11, 2014 6:49 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest