28 #ifndef PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H 29 #define PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H 33 #if PX_SUPPORT_GPU_PHYSX 38 #define PX_ALLOC_INFO(name, ID) __FILE__, __LINE__, name, physx::PxAllocId::ID 39 #define PX_ALLOC_INFO_PARAMS_DECL(p0, p1, p2, p3) const char* file = p0, int line = p1, const char* allocName = p2, physx::PxAllocId::Enum allocId = physx::PxAllocId::p3 40 #define PX_ALLOC_INFO_PARAMS_DEF() const char* file, int line, const char* allocName, physx::PxAllocId::Enum allocId 41 #define PX_ALLOC_INFO_PARAMS_INPUT() file, line, allocName, allocId 42 #define PX_ALLOC_INFO_PARAMS_INPUT_INFO(info) info.getFileName(), info.getLine(), info.getAllocName(), info.getAllocId() 44 #ifndef NULL // don't want to include <string.h> 74 struct PxCudaBufferMemorySpace
101 PxAllocInfo(
const char* file,
int line,
const char* allocName, PxAllocId::Enum allocId)
104 , mAllocName(allocName)
109 inline const char* getFileName()
const 115 inline int getLine()
const 121 inline const char* getAllocName()
const 127 inline PxAllocId::Enum getAllocId()
const 133 const char* mFileName;
135 const char* mAllocName;
136 PxAllocId::Enum mAllocId;
140 struct PxAllocIdStats
148 class PxCudaMemoryManager;
149 typedef size_t PxCudaBufferPtr;
152 struct PxCudaBufferFlags
159 F_READ_WRITE = F_READ | F_WRITE
165 struct PxCudaMemoryManagerStats
169 size_t totalAllocated;
171 PxAllocIdStats allocIdStats[PxAllocId::NUM_IDS];
176 struct PxCudaBufferType
179 PX_INLINE PxCudaBufferType(
const PxCudaBufferType& t)
180 : memorySpace(t.memorySpace)
185 PX_INLINE PxCudaBufferType(PxCudaBufferMemorySpace::Enum _memSpace, PxCudaBufferFlags::Enum _flags)
186 : memorySpace(_memSpace)
190 PxCudaBufferMemorySpace::Enum memorySpace;
191 PxCudaBufferFlags::Enum
flags;
200 virtual PxCudaMemoryManager* getCudaMemoryManager()
const = 0;
203 virtual bool free() = 0;
209 virtual bool realloc(
size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0;
212 virtual const PxCudaBufferType&
getType()
const = 0;
215 virtual PxCudaBufferPtr getPtr()
const = 0;
218 virtual size_t getSize()
const = 0;
222 virtual ~PxCudaBuffer() {}
227 class PxCudaMemoryManager
231 virtual PxCudaBuffer* alloc(
const PxCudaBufferType& type,
size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0;
234 virtual PxCudaBufferPtr alloc(PxCudaBufferMemorySpace::Enum memorySpace,
size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0;
237 virtual bool free(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr) = 0;
240 virtual bool realloc(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr,
size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0;
243 virtual void getStats(
const PxCudaBufferType& type, PxCudaMemoryManagerStats& outStats) = 0;
247 virtual bool reserve(
const PxCudaBufferType& type,
size_t size) = 0;
252 virtual bool setPageSize(
const PxCudaBufferType& type,
size_t size) = 0;
256 virtual bool setMaxMemorySize(
const PxCudaBufferType& type,
size_t size) = 0;
259 virtual size_t getBaseSize(
const PxCudaBufferType& type) = 0;
262 virtual size_t getPageSize(
const PxCudaBufferType& type) = 0;
265 virtual size_t getMaxMemorySize(
const PxCudaBufferType& type) = 0;
268 virtual PxCudaBufferPtr getMappedPinnedPtr(PxCudaBufferPtr hostPtr) = 0;
272 virtual ~PxCudaMemoryManager() {}
280 #endif // PX_SUPPORT_GPU_PHYSX 281 #endif // PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H Definition: GuContactBuffer.h:37
#define PX_POP_PACK
Definition: PxPreprocessor.h:343
PxU16 flags
a set of Px1DConstraintFlags
Definition: PxConstraintDesc.h:110
PX_FORCE_INLINE PxGeometryType::Enum getType() const
Definition: PxGeometryHelpers.h:88
#define PX_PUSH_PACK_DEFAULT
Definition: PxPreprocessor.h:342
#define PX_INLINE
Definition: PxPreprocessor.h:349