Skip to content

Commit

Permalink
Fix PxAssertHandler namespace issue when compiling with PhysX 4.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtamis-NV committed Jun 13, 2019
1 parent a05b820 commit 145cd88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
17 changes: 5 additions & 12 deletions NvCloth/include/NvCloth/Callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ namespace cloth
*/
NV_CLOTH_API(void)
InitializeNvCloth(physx::PxAllocatorCallback* allocatorCallback, physx::PxErrorCallback* errorCallback,
physx::PxAssertHandler* assertHandler, physx::PxProfilerCallback* profilerCallback,
nv::cloth::PxAssertHandler* assertHandler, physx::PxProfilerCallback* profilerCallback,
int autoDllIDCheck = NV_CLOTH_DLL_ID);
}
}

//Allocator
NV_CLOTH_API(physx::PxAllocatorCallback*) GetNvClothAllocator(); //Only use internally

#if !PX_DOXYGEN
namespace physx
namespace nv
{
namespace cloth
{
#endif

/* Base class to handle assert failures */
class PxAssertHandler
Expand All @@ -93,14 +93,7 @@ class PxAssertHandler
virtual void operator()(const char* exp, const char* file, int line, bool& ignore) = 0;
};

#if !PX_DOXYGEN
} // namespace physx
#endif

namespace nv
{
namespace cloth
{
//Logging
void LogErrorFn (const char* fileName, int lineNumber, const char* msg, ...);
void LogInvalidParameterFn (const char* fileName, int lineNumber, const char* msg, ...);
Expand All @@ -113,7 +106,7 @@ void LogInfoFn (const char* fileName, int lineNumber, const char* msg, ...);
#define NV_CLOTH_LOG_INFO(...) nv::cloth::LogInfoFn(__FILE__,__LINE__,__VA_ARGS__)

//ASSERT
NV_CLOTH_API(physx::PxAssertHandler*) GetNvClothAssertHandler(); //This function needs to be exposed to properly inline asserts outside this dll
NV_CLOTH_API(nv::cloth::PxAssertHandler*) GetNvClothAssertHandler(); //This function needs to be exposed to properly inline asserts outside this dll
#if !PX_ENABLE_ASSERTS
#if PX_VC
#define NV_CLOTH_ASSERT(exp) __noop
Expand Down
2 changes: 1 addition & 1 deletion NvCloth/samples/SampleBase/utils/CallbackImplementations.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class ErrorCallback : public physx::PxErrorCallback
};


class AssertHandler : public physx::PxAssertHandler
class AssertHandler : public nv::cloth::PxAssertHandler
{
public:
virtual void operator()(const char* exp, const char* file, int line, bool& ignore)
Expand Down
6 changes: 3 additions & 3 deletions NvCloth/src/Callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ struct NvClothContext
{
physx::PxAllocatorCallback* mAllocator;
physx::PxErrorCallback* mErrorCallback;
physx::PxAssertHandler* mAssertHandler;
nv::cloth::PxAssertHandler* mAssertHandler;
physx::PxProfilerCallback* mProfilerCallback;
};

static NvClothContext sContext;

NV_CLOTH_API(void) InitializeNvCloth(physx::PxAllocatorCallback* allocatorCallback, physx::PxErrorCallback* errorCallback, physx::PxAssertHandler* assertHandler, physx::PxProfilerCallback* profilerCallback, int autoDllIDCheck)
NV_CLOTH_API(void) InitializeNvCloth(physx::PxAllocatorCallback* allocatorCallback, physx::PxErrorCallback* errorCallback, nv::cloth::PxAssertHandler* assertHandler, physx::PxProfilerCallback* profilerCallback, int autoDllIDCheck)
{
PX_UNUSED(autoDllIDCheck);
NV_CLOTH_ASSERT_WITH_MESSAGE("NvCloth dll id mismatch, ensure you compile with matching headers/run with matching dll.", NV_CLOTH_DLL_ID == autoDllIDCheck);
Expand Down Expand Up @@ -117,7 +117,7 @@ void LogInfoFn(const char* fileName, int lineNumber, const char* msg, ...)
va_end(args);
}

NV_CLOTH_API(physx::PxAssertHandler*) GetNvClothAssertHandler()
NV_CLOTH_API(nv::cloth::PxAssertHandler*) GetNvClothAssertHandler()
{
return sContext.mAssertHandler;
}
Expand Down

0 comments on commit 145cd88

Please sign in to comment.