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

Method NpReadCheck

physx/source/physx/src/NpReadCheck.cpp:37–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35using namespace physx;
36
37NpReadCheck::NpReadCheck(const NpScene* scene, const char* functionName)
38 : mScene(scene), mName(functionName), mErrorCount(0)
39{
40 if (mScene)
41 {
42 if (!mScene->startRead())
43 {
44 if (mScene->getScene().getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK)
45 {
46 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__,
47 "An API read call (%s) was made from thread %d but PxScene::lockRead() was not called first, note that "
48 "when PxSceneFlag::eREQUIRE_RW_LOCK is enabled all API reads and writes must be "
49 "wrapped in the appropriate locks.", mName, PxU32(Ps::Thread::getId()));
50 }
51 else
52 {
53 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__,
54 "Overlapping API read and write call detected during %s from thread %d! Note that read operations to "
55 "the SDK must not be overlapped with write calls, else the resulting behavior is undefined.", mName, PxU32(Ps::Thread::getId()));
56 }
57 }
58
59 // Record the NpScene read/write error counter which is
60 // incremented any time a NpScene::startWrite/startRead fails
61 // (see destructor for additional error checking based on this count)
62 mErrorCount = mScene->getReadWriteErrorCount();
63 }
64}
65
66
67NpReadCheck::~NpReadCheck()

Callers

nothing calls this directly

Calls 4

startReadMethod · 0.80
errorMethod · 0.80
getFlagsMethod · 0.45
getSceneMethod · 0.45

Tested by

no test coverage detected