by anothertime12 » Sat Sep 26, 2020 6:43 am
Hi All - apologies for these text dump of a post.
I've been using the new compilations that JernejL kindly provided but I'm still getting all the same issues I used to.
All the settings are the same as the example I posted a while ago.
I'm setting:
NewtonSetSolverIterations(,8);
NewtonSetNumberOfSubsteps(,5);
NewtonSetThreadsCount(,1);
NewtonUpdate is being called 60 times per second.
The gravity being applied is 9.8 * 2 (felt right for this game).
Ball and world material (every object currently uses the same material):
NewtonMaterialSetDefaultElasticity(,0.25f);
NewtonMaterialSetDefaultFriction(,2.1f,0.9f);
NewtonMaterialSetDefaultSoftness(,0.25f);
I used to set a surface thickness of 0.1f but I don't now.
I have also been told that newton requires you to force the floating point control word.. I'm not keen on this but I have tried wrapping all my calls to NewtonUpdate so that every frame it's guaranteed to be set, IE:
_controlfp_s(NULL,_MCW_EM,_MCW_EM);
NewtonUpdate(,1.0f/60.0f);
The issue I'm getting is - sometimes when rolling around the level I get a hard crash inside the newton.dll as described below:
> newton.dll!dgCollisionConvexPolygon::CalculateContactToConvexHullContinue(const dgWorld * const world=0x04794c20, const dgCollisionInstance * const parentMesh=0x0479bda0, dgCollisionParamProxy & proxy={...}) Line 567 + 0x1d bytes C++
newton.dll!dgWorld::CalculateConvexToNonConvexContactsContinue(dgCollisionParamProxy & proxy={...}) Line 2041 C++
newton.dll!dgWorld::CalculateConvexToNonConvexContacts(dgCollisionParamProxy & proxy={...}) Line 1779 + 0x11 bytes C++
newton.dll!dgWorld::ConvexContacts(dgBroadPhase::dgPair * const pair=0x0479c650, dgCollisionParamProxy & proxy={...}) Line 1183 + 0x5 bytes C++
newton.dll!dgWorld::CalculateContacts(dgBroadPhase::dgPair * const pair=0x0479c650, int threadIndex=0, bool ccdMode=true, bool intersectionTestOnly=false) Line 1289 C++
newton.dll!dgWorld::CollideContinue(const dgCollisionInstance * const collisionSrcA=0x04ce4580, const dgMatrix & matrixA={...}, const dgVector & velocA={...}, const dgVector & omegaA={...}, const dgCollisionInstance * const collisionSrcB=0x04ce4700, const dgMatrix & matrixB={...}, const dgVector & velocB={...}, const dgVector & omegaB={...}, float & retTimeStep=0.0033333185, dgTriplex * const points=0x0479f490, dgTriplex * const normals=0x0479f3d0, float * const penetration=0x0479f550, __int64 * const attibuteA=0x0479f2d0, __int64 * const attibuteB=0x0479f350, int maxContacts=6, int threadIndex=0) Line 1403 C++
newton.dll!dgContact::EstimateCCD(float timestep=0.00000000) Line 214 + 0x53 bytes C++
newton.dll!dgWorldDynamicUpdate::BuildClusters(float timestep=0.00000000) Line 389 + 0x13 bytes C++
newton.dll!dgWorldDynamicUpdate::UpdateDynamics(float timestep=0.00000000) Line 110 C++
newton.dll!dgWorld::StepDynamics(float timestep=0.00000000) Line 940 C++
newton.dll!dgWorld::RunStep() Line 1002 C++
newton.dll!dgWorld::TickCallback(int threadID=1474240929) Line 1035 C++
newton.dll!dgMutexThread::Execute(int threadID=1) Line 59 C++
newton.dll!dgThread::dgThreadSystemCallback(void * threadData=0x04c7d330) Line 202 C++
newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Go() Line 187 + 0xb bytes C++
newton.dll!_Call_func(void * _Data=0x0018fbd0) Line 28 + 0xb bytes C++
newton.dll!_callthreadstartex() Line 376 + 0x6 bytes C
newton.dll!_threadstartex(void * ptd=0x04c63a28) Line 354 + 0x5 bytes C
The actual offending line seems to be a SIMD / SSE division part way into the function - there's an exception on a divss:
73045F80 ja dgCollisionConvexPolygon::CalculateContactToConvexHullContinue+2B5h (73045F85h)
73045F82 movaps xmm2,xmm0
73045F85 movaps xmm6,xmmword ptr [ebp-450h]
73045F8C movaps xmm7,xmmword ptr [ebp-480h]
73045F93 movaps xmm1,xmmword ptr [ebp-440h]
73045F9A shufps xmm2,xmm2,0
73045F9E mulps xmm2,xmmword ptr [ebp-4A0h]
73045FA5 mulps xmm1,xmm2
73045FA8 movaps xmm0,xmm2
73045FAB mulps xmm0,xmm7
73045FAE movaps xmm3,xmm2
73045FB1 mulps xmm3,xmm6
73045FB4 haddps xmm1,xmm1
73045FB8 haddps xmm0,xmm0
73045FBC haddps xmm3,xmm3
73045FC0 haddps xmm1,xmm1
73045FC4 haddps xmm0,xmm0
73045FC8 haddps xmm3,xmm3
73045FCC movaps xmmword ptr [ebp-470h],xmm2
73045FD3 xorps xmm2,xmm2
73045FD6 unpcklps xmm1,xmm2
73045FD9 unpcklps xmm3,xmm0
73045FDC movaps xmm0,xmmword ptr [__xmm@1e3ce5081e3ce5081e3ce5081e3ce508 (73095660h)]
73045FE3 unpcklps xmm3,xmm1
73045FE6 subps xmm3,xmmword ptr [__xmm@00000000000000000000000000000000 (730953E0h)]
73045FED movaps xmm1,xmmword ptr [dgVector::m_one (730BFFB0h)]
73045FF4 andps xmm3,xmmword ptr [dgVector::m_triplexMask (730BFF80h)]
73045FFB movaps xmm2,xmm3
73045FFE xorps xmm0,xmm3
73046001 andps xmm2,xmmword ptr [dgVector::m_signMask (730BFF90h)]
73046008 cmpltps xmm2,xmmword ptr [__xmm@322bcc77322bcc77322bcc77322bcc77 (73095690h)]
73046010 andps xmm0,xmm2
73046013 xorps xmm0,xmm3
73046016 xorps xmm3,xmm3
73046019 divps xmm1,xmm0
7304601C movaps xmm0,xmm3
7304601F andps xmm1,xmmword ptr [dgVector::m_triplexMask (730BFF80h)]
73046026 movaps xmmword ptr [ebp-450h],xmm1
7304602D movaps xmm1,xmm5
73046030 cmpleps xmm1,xmm3
73046034 cmpleps xmm0,xmm4
73046038 orps xmm1,xmm0
7304603B andps xmm1,xmm2
7304603E movmskps eax,xmm1
73046041 test al,7
73046043 je dgCollisionConvexPolygon::CalculateContactToConvexHullContinue+37Fh (7304604Fh)
73046045 movss xmm4,dword ptr [__real@3f99999a (7309515Ch)]
7304604D jmp dgCollisionConvexPolygon::CalculateContactToConvexHullContinue+3ECh (730460BCh)
7304604F subps xmm4,xmm3
73046052 movaps xmm2,xmmword ptr [__xmm@3f8000003f8000003f8000003f800000 (730957C0h)]
73046059 subps xmm5,xmm3
7304605C mulps xmm4,xmmword ptr [ebp-450h]
73046063 mulps xmm5,xmmword ptr [ebp-450h]
7304606A movaps xmm0,xmm4
7304606D minps xmm0,xmm5
73046070 maxps xmm4,xmm5
73046073 maxps xmm3,xmm0
73046076 minps xmm2,xmm4
73046079 movaps xmm0,xmm3
7304607C shufps xmm0,xmm3,0D2h
73046080 maxps xmm3,xmm0
73046083 movaps xmm0,xmm2
73046086 shufps xmm0,xmm2,0D2h
7304608A minps xmm2,xmm0
7304608D movaps xmm0,xmm3
73046090 shufps xmm0,xmm3,0D2h
73046094 maxps xmm3,xmm0
73046097 movaps xmm0,xmm2
7304609A shufps xmm0,xmm2,0D2h
7304609E movaps xmm4,xmm3
730460A1 minps xmm2,xmm0
730460A4 movaps xmm0,xmmword ptr [__xmm@3f99999a3f99999a3f99999a3f99999a (730957E0h)]
730460AB cmpltps xmm4,xmm2
730460AF xorps xmm0,xmm3
730460B2 andps xmm4,xmm0
730460B5 xorps xmm4,xmmword ptr [__xmm@3f99999a3f99999a3f99999a3f99999a (730957E0h)]
730460BC movss xmm0,dword ptr [__real@3f800000 (73095138h)]
730460C4 xor edx,edx
730460C6 comiss xmm0,xmm4
730460C9 jbe 730467DF
730460CF movaps xmm1,xmmword ptr [ebp-490h]
730460D6 addps xmm1,xmmword ptr [ebp-4B0h]
730460DD movaps xmm4,xmmword ptr [ebp-470h]
730460E4 movaps xmm2,xmm4
730460E7 mulps xmm1,xmmword ptr [dgVector::m_half (730BFFD0h)]
730460EE movaps xmm3,xmm1
730460F1 movaps xmm0,xmm1
730460F4 shufps xmm0,xmm1,0
730460F8 shufps xmm3,xmm1,55h
730460FC mulps xmm3,xmmword ptr [ebp-440h]
73046103 mulps xmm0,xmm6
73046106 shufps xmm1,xmm1,0AAh
7304610A mulps xmm1,xmm7
7304610D addps xmm3,xmm0
73046110 movaps xmm0,xmmword ptr [edi+0A0h]
73046117 mulps xmm2,xmm0
7304611A addps xmm3,xmm1
7304611D movaps xmmword ptr [ebp-480h],xmm2
73046124 addps xmm3,xmmword ptr [ebp-500h]
7304612B movaps xmm1,xmm3
7304612E movaps xmmword ptr [ebp-450h],xmm3
73046135 subps xmm1,xmmword ptr [edi+0B0h]
7304613C mulps xmm1,xmm0
7304613F movaps xmm0,xmm2
73046142 haddps xmm0,xmm2
73046146 haddps xmm1,xmm1
7304614A haddps xmm0,xmm0
7304614E haddps xmm1,xmm1
73046152 divss xmm1,xmm0 <- issue occurs here
My processor should support the SSE and AVX variants of this instruction so I assume it's dividing by zero - it's a float point trap exception rather than instruction decoding one.