28 #ifndef PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H 29 #define PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H 33 #if PX_SUPPORT_GPU_PHYSX 42 typedef struct CUstream_st*
CUstream;
50 class PxGpuCopyDescQueue
54 PxGpuCopyDescQueue(PxGpuDispatcher& d)
69 mDispatcher.getCudaContextManager()->getMemoryManager()->free(PxCudaBufferMemorySpace::T_PINNED_HOST, (
size_t) mBuffer);
78 void reset(
CUstream stream, uint32_t reserveSize)
80 if (reserveSize > mReserved)
84 mDispatcher.getCudaContextManager()->getMemoryManager()->free(
85 PxCudaBufferMemorySpace::T_PINNED_HOST,
89 mBuffer = (PxGpuCopyDesc*) mDispatcher.getCudaContextManager()->getMemoryManager()->alloc(
90 PxCudaBufferMemorySpace::T_PINNED_HOST,
91 reserveSize *
sizeof(PxGpuCopyDesc),
92 PX_ALLOC_INFO(
"PxGpuCopyDescQueue", GPU_UTIL));
95 mReserved = reserveSize;
105 void enqueue(PxGpuCopyDesc& desc)
113 if (mOccupancy < mReserved)
115 mBuffer[ mOccupancy++ ] = desc;
119 mDispatcher.launchCopyKernel(&desc, 1, mStream);
126 if (mOccupancy > mFlushed)
128 mDispatcher.launchCopyKernel(mBuffer + mFlushed, mOccupancy - mFlushed, mStream);
129 mFlushed = mOccupancy;
134 PxGpuDispatcher& mDispatcher;
135 PxGpuCopyDesc* mBuffer;
141 void operator=(
const PxGpuCopyDescQueue&);
148 #endif // PX_SUPPORT_GPU_PHYSX 149 #endif // PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H Definition: GuContactBuffer.h:37
struct CUstream_st * CUstream
Definition: PxGpuDispatcher.h:35
#define PX_POP_PACK
Definition: PxPreprocessor.h:343
#define PX_ASSERT(exp)
Definition: PxAssert.h:61
#define PX_PUSH_PACK_DEFAULT
Definition: PxPreprocessor.h:342