29 #ifndef PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H 30 #define PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H 34 #if PX_SUPPORT_GPU_PHYSX 43 typedef struct CUctx_st *CUcontext;
44 typedef struct CUgraphicsResource_st *CUgraphicsResource;
50 class PxGpuDispatcher;
54 struct PxCudaInteropMode
70 struct PxCudaInteropRegisterFlag
76 eWRITE_DISCARD = 0x02,
78 eTEXTURE_GATHER = 0x08
88 PX_FLAGS_OPERATORS(PxCudaInteropRegisterFlag::Enum, uint32_t)
90 class PxCudaContextManagerDesc
124 void *graphicsDevice;
126 #if PX_SUPPORT_GPU_PHYSX 143 PxCudaInteropMode::Enum interopMode;
161 uint32_t memoryBaseSize[PxCudaBufferMemorySpace::COUNT];
172 uint32_t memoryPageSize[PxCudaBufferMemorySpace::COUNT];
180 uint32_t maxMemorySize[PxCudaBufferMemorySpace::COUNT];
185 interopMode = PxCudaInteropMode::NO_INTEROP;
187 #if PX_SUPPORT_GPU_PHYSX 190 for(uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++)
192 memoryBaseSize[i] = 0;
193 memoryPageSize[i] = 2 * 1024*1024;
194 maxMemorySize[i] = UINT32_MAX;
217 class PxCudaContextManager
235 virtual void acquireContext() = 0;
244 virtual void releaseContext() = 0;
249 virtual CUcontext getContext() = 0;
257 virtual PxCudaMemoryManager *getMemoryManager() = 0;
274 virtual bool contextIsValid()
const = 0;
278 virtual bool supportsArchSM10()
const = 0;
279 virtual bool supportsArchSM11()
const = 0;
280 virtual bool supportsArchSM12()
const = 0;
281 virtual bool supportsArchSM13()
const = 0;
282 virtual bool supportsArchSM20()
const = 0;
283 virtual bool supportsArchSM30()
const = 0;
284 virtual bool supportsArchSM35()
const = 0;
285 virtual bool supportsArchSM50()
const = 0;
286 virtual bool supportsArchSM52()
const = 0;
287 virtual bool supportsArchSM60()
const = 0;
288 virtual bool isIntegrated()
const = 0;
289 virtual bool canMapHostMemory()
const = 0;
290 virtual int getDriverVersion()
const = 0;
291 virtual size_t getDeviceTotalMemBytes()
const = 0;
292 virtual int getMultiprocessorCount()
const = 0;
293 virtual unsigned int getClockRate()
const = 0;
294 virtual int getSharedMemPerBlock()
const = 0;
295 virtual int getSharedMemPerMultiprocessor()
const = 0;
296 virtual unsigned int getMaxThreadsPerBlock()
const = 0;
297 virtual const char *getDeviceName()
const = 0;
298 virtual CUdevice getDevice()
const = 0;
299 virtual PxCudaInteropMode::Enum getInteropMode()
const = 0;
301 virtual void setUsingConcurrentStreams(
bool) = 0;
302 virtual bool getUsingConcurrentStreams()
const = 0;
325 virtual bool registerResourceInCudaGL(CUgraphicsResource &resource, uint32_t buffer, PxCudaInteropRegisterFlags
flags = PxCudaInteropRegisterFlags()) = 0;
347 virtual bool registerResourceInCudaD3D(CUgraphicsResource &resource,
void *resourcePointer, PxCudaInteropRegisterFlags
flags = PxCudaInteropRegisterFlags()) = 0;
356 virtual bool unregisterResourceInCuda(CUgraphicsResource resource) = 0;
365 virtual int usingDedicatedGPU()
const = 0;
382 virtual void release() = 0;
389 virtual ~PxCudaContextManager() {}
395 class PxScopedCudaLock
401 PxScopedCudaLock(PxCudaContextManager& ctx) : mCtx(&ctx)
403 mCtx->acquireContext();
411 mCtx->releaseContext();
419 PxCudaContextManager* mCtx;
424 #endif // PX_SUPPORT_GPU_PHYSX 425 #endif // PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H Definition: GuContactBuffer.h:37
A GpuTask dispatcher.
Definition: PxGpuDispatcher.h:71
PxU16 flags
a set of Px1DConstraintFlags
Definition: PxConstraintDesc.h:110
Container for bitfield flag variables associated with a specific enum type.
Definition: PxFlags.h:73
#define PX_INLINE
Definition: PxPreprocessor.h:349