Hi,
the title explains my issue.
and even commenting the PxScene release code and I get the same assertion error when releasing the PxPhysics next…
code is the same as the HelloGRB Snippet code:
void Physics::start()
{
foundation = PxCreateFoundation(PX_PHYSICS_VERSION, defaultAllocator, customErrorCallback);
pvd = PxCreatePvd(*foundation);
auto transport = PxDefaultPvdSocketTransportCreate(Constants::PVD_HOST.c_str(), Constants::PVD_PORT,
Constants::PVD_TIMEOUT);
pvd->connect(*transport, PxPvdInstrumentationFlag::eALL);
physics = PxCreatePhysics(PX_PHYSICS_VERSION, *foundation, PxTolerancesScale(), true, pvd);
PxCudaContextManagerDesc cudaContextManagerDesc;
switch (graphicsApi->getGraphicsConfiguration().api)
{
case GraphicsApiType::DIRECT3D11:
cudaContextManagerDesc.interopMode = PxCudaInteropMode::D3D11_INTEROP;
cudaContextManagerDesc.graphicsDevice = graphicsApi->getGpuContext();
break;
case GraphicsApiType::OPENGL:
cudaContextManagerDesc.interopMode = PxCudaInteropMode::OGL_INTEROP;
break;
default:
cudaContextManagerDesc.interopMode = PxCudaInteropMode::NO_INTEROP;
}
cudaContextManager = PxCreateCudaContextManager(*foundation, cudaContextManagerDesc, PxGetProfilerCallback());
//Create the CUDA context manager, required for GRB to dispatch CUDA kernels.
if (cudaContextManager)
{
if (!cudaContextManager->contextIsValid())
{
Logger::warning(Logger::Channel::PHYSICS, " Cuda context manager is not valid");
cudaContextManager->release();
cudaContextManager = nullptr;
}
}
PxSceneDesc sceneDesc(physics->getTolerancesScale());
sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f);
cpuDispatcher = PxDefaultCpuDispatcherCreate(std::thread::hardware_concurrency());
//Create a CPU dispatcher using 4 worther threads
sceneDesc.cpuDispatcher = cpuDispatcher;
sceneDesc.filterShader = PxDefaultSimulationFilterShader;
//Set the CUDA context manager, used by GRB.
sceneDesc.cudaContextManager = cudaContextManager;
//Enable GPU dynamics - without this enabled, simulation (contact gen and solver) will run on the CPU.
sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS;
//Enable PCM. PCM NP is supported on GPU. Legacy contact gen will fall back to CPU
sceneDesc.flags |= PxSceneFlag::eENABLE_PCM;
//Improve solver stability by enabling post-stabilization.
sceneDesc.flags |= PxSceneFlag::eENABLE_STABILIZATION;
//Enable GPU broad phase. Without this set, broad phase will run on the CPU.
sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU;
//Defines the maximum number of partitions used by the solver. Only power-of-2 values are valid.
//A value of 8 generally gives best balance between performance and stability.
sceneDesc.gpuMaxNumPartitions = 8;
scene = physics->createScene(sceneDesc);
}
void Physics::update()
{
scene->simulate(TimeManager::getInstance().getFixedTimestep());
scene->fetchResults(true);
}
void Physics::shutdown()
{
if (scene)
{
scene->release();
scene = nullptr;
}
if(cpuDispatcher)
{
cpuDispatcher->release();
cpuDispatcher = nullptr;
}
if (physics)
{
physics->release();
physics = nullptr;
}
if (pvd)
{
auto transport = pvd->getTransport();
pvd->release();
pvd = nullptr;
transport->release();
}
if (cudaContextManager)
{
cudaContextManager->release();
cudaContextManager = nullptr;
}
if (foundation)
{
foundation->release();
foundation = nullptr;
}
}
Help?
Specs:
OS: Win 10
Build : VS16 Win64 static
GPU: GTX 1070