MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / NpWriteCheck

Method NpWriteCheck

physx/source/physx/src/NpWriteCheck.cpp:37–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35using namespace physx;
36
37NpWriteCheck::NpWriteCheck(NpScene* scene, const char* functionName, bool allowReentry)
38: mScene(scene), mName(functionName), mAllowReentry(allowReentry), mErrorCount(0)
39{
40 if (mScene)
41 {
42 switch (mScene->startWrite(mAllowReentry))
43 {
44 case NpScene::StartWriteResult::eOK:
45 break;
46 case NpScene::StartWriteResult::eNO_LOCK:
47 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__,
48 "An API write call (%s) was made from thread %d but PxScene::lockWrite() was not called first, note that "
49 "when PxSceneFlag::eREQUIRE_RW_LOCK is enabled all API reads and writes must be "
50 "wrapped in the appropriate locks.", mName, PxU32(Ps::Thread::getId()));
51 break;
52 case NpScene::StartWriteResult::eRACE_DETECTED:
53 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__,
54 "Concurrent API write call or overlapping API read and write call detected during %s from thread %d! "
55 "Note that write operations to the SDK must be sequential, i.e., no overlap with "
56 "other write or read calls, else the resulting behavior is undefined. "
57 "Also note that API writes during a callback function are not permitted.", mName, PxU32(Ps::Thread::getId()));
58 break;
59
60 case NpScene::StartWriteResult::eIN_FETCHRESULTS:
61 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__,
62 "Illegal write call detected in %s from thread %d during split fetchResults! "
63 "Note that write operations to the SDK are not permitted between the start of fetchResultsStart() and end of fetchResultsFinish(). "
64 "Behavior will be undefined. ", mName, PxU32(Ps::Thread::getId()));
65 break;
66 }
67
68 // Record the NpScene read/write error counter which is
69 // incremented any time a NpScene::startWrite/startRead fails
70 // (see destructor for additional error checking based on this count)
71 mErrorCount = mScene->getReadWriteErrorCount();
72 }
73}
74
75
76NpWriteCheck::~NpWriteCheck()

Callers

nothing calls this directly

Calls 2

startWriteMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected