nvidia/cuda/context: Don't try to destroy device contexts

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-06-17 12:13:22 +02:00
parent 6ba51efceb
commit 0f56f822c3

View file

@ -55,8 +55,9 @@ streamfx::nvidia::cuda::context::~context()
if (_has_device) {
_cuda->cuDevicePrimaryCtxRelease(_device);
} else {
_cuda->cuCtxDestroy(_ctx);
}
_cuda->cuCtxDestroy(_ctx);
}
streamfx::nvidia::cuda::context::context()
@ -85,6 +86,8 @@ streamfx::nvidia::cuda::context::context(ID3D11Device* device) : context()
throw std::runtime_error("Failed to get device index for device.");
}
_cuda->cuDevicePrimaryCtxSetFlags(_device, context_flags::SCHEDULER_BLOCKING_SYNC);
// Acquire Context
if (result res = _cuda->cuDevicePrimaryCtxRetain(&_ctx, _device); res != result::SUCCESS) {
throw std::runtime_error("Failed to acquire primary device context.");