nvidia/cuda: Adjust to match coding guidelines

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-06-16 12:16:35 +02:00 committed by Xaymar
parent a897bd0252
commit ebbe5e92a8
12 changed files with 124 additions and 118 deletions

View file

@ -49,7 +49,7 @@
#define ENABLE_STACK_CHECKS
nvidia::cuda::context::~context()
streamfx::nvidia::cuda::context::~context()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
@ -59,15 +59,16 @@ nvidia::cuda::context::~context()
_cuda->cuCtxDestroy(_ctx);
}
nvidia::cuda::context::context() : _cuda(::nvidia::cuda::cuda::get()), _ctx(), _has_device(false), _device()
streamfx::nvidia::cuda::context::context()
: _cuda(::streamfx::nvidia::cuda::cuda::get()), _ctx(), _has_device(false), _device()
{
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
}
#ifdef WIN32
nvidia::cuda::context::context(ID3D11Device* device) : context()
streamfx::nvidia::cuda::context::context(ID3D11Device* device) : context()
{
using namespace nvidia::cuda;
using namespace streamfx::nvidia::cuda;
if (!device)
throw std::invalid_argument("device");
@ -93,45 +94,45 @@ nvidia::cuda::context::context(ID3D11Device* device) : context()
}
#endif
::nvidia::cuda::context_t nvidia::cuda::context::get()
::streamfx::nvidia::cuda::context_t streamfx::nvidia::cuda::context::get()
{
return _ctx;
}
std::shared_ptr<::nvidia::cuda::context_stack> nvidia::cuda::context::enter()
std::shared_ptr<::streamfx::nvidia::cuda::context_stack> streamfx::nvidia::cuda::context::enter()
{
return std::make_shared<::nvidia::cuda::context_stack>(shared_from_this());
return std::make_shared<::streamfx::nvidia::cuda::context_stack>(shared_from_this());
}
void nvidia::cuda::context::push()
void streamfx::nvidia::cuda::context::push()
{
if (auto res = _cuda->cuCtxPushCurrent(_ctx); res != ::nvidia::cuda::result::SUCCESS) {
throw ::nvidia::cuda::cuda_error(res);
if (auto res = _cuda->cuCtxPushCurrent(_ctx); res != ::streamfx::nvidia::cuda::result::SUCCESS) {
throw ::streamfx::nvidia::cuda::cuda_error(res);
}
}
void nvidia::cuda::context::pop()
void streamfx::nvidia::cuda::context::pop()
{
#ifdef ENABLE_STACK_CHECKS
::nvidia::cuda::context_t ctx;
if (_cuda->cuCtxGetCurrent(&ctx) == ::nvidia::cuda::result::SUCCESS)
::streamfx::nvidia::cuda::context_t ctx;
if (_cuda->cuCtxGetCurrent(&ctx) == ::streamfx::nvidia::cuda::result::SUCCESS)
assert(ctx == _ctx);
#endif
assert(_cuda->cuCtxPopCurrent(&ctx) == ::nvidia::cuda::result::SUCCESS);
assert(_cuda->cuCtxPopCurrent(&ctx) == ::streamfx::nvidia::cuda::result::SUCCESS);
}
void nvidia::cuda::context::synchronize()
void streamfx::nvidia::cuda::context::synchronize()
{
D_LOG_DEBUG("Synchronizing... (Addr: 0x%" PRIuPTR ")", this);
#ifdef ENABLE_STACK_CHECKS
::nvidia::cuda::context_t ctx;
if (_cuda->cuCtxGetCurrent(&ctx) == ::nvidia::cuda::result::SUCCESS)
::streamfx::nvidia::cuda::context_t ctx;
if (_cuda->cuCtxGetCurrent(&ctx) == ::streamfx::nvidia::cuda::result::SUCCESS)
assert(ctx == _ctx);
#endif
if (auto res = _cuda->cuCtxSynchronize(); res != ::nvidia::cuda::result::SUCCESS) {
throw ::nvidia::cuda::cuda_error(res);
if (auto res = _cuda->cuCtxSynchronize(); res != ::streamfx::nvidia::cuda::result::SUCCESS) {
throw ::streamfx::nvidia::cuda::cuda_error(res);
}
}

View file

@ -21,14 +21,14 @@
#include <memory>
#include "nvidia-cuda.hpp"
namespace nvidia::cuda {
namespace streamfx::nvidia::cuda {
class context_stack;
class context : public std::enable_shared_from_this<::nvidia::cuda::context> {
std::shared_ptr<::nvidia::cuda::cuda> _cuda;
::nvidia::cuda::context_t _ctx;
bool _has_device;
::nvidia::cuda::device_t _device;
class context : public std::enable_shared_from_this<::streamfx::nvidia::cuda::context> {
std::shared_ptr<::streamfx::nvidia::cuda::cuda> _cuda;
::streamfx::nvidia::cuda::context_t _ctx;
bool _has_device;
::streamfx::nvidia::cuda::device_t _device;
public:
~context();
@ -41,7 +41,7 @@ namespace nvidia::cuda {
context(ID3D11Device* device);
#endif
::nvidia::cuda::context_t get();
::streamfx::nvidia::cuda::context_t get();
void push();
void pop();
@ -49,20 +49,20 @@ namespace nvidia::cuda {
void synchronize();
public:
std::shared_ptr<::nvidia::cuda::context_stack> enter();
std::shared_ptr<::streamfx::nvidia::cuda::context_stack> enter();
};
class context_stack {
std::shared_ptr<::nvidia::cuda::context> _ctx;
std::shared_ptr<::streamfx::nvidia::cuda::context> _ctx;
public:
inline ~context_stack()
{
_ctx->pop();
}
inline context_stack(std::shared_ptr<::nvidia::cuda::context> ctx) : _ctx(ctx)
inline context_stack(std::shared_ptr<::streamfx::nvidia::cuda::context> ctx) : _ctx(ctx)
{
_ctx->push();
}
};
} // namespace nvidia::cuda
} // namespace streamfx::nvidia::cuda

View file

@ -35,7 +35,7 @@
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
#endif
nvidia::cuda::gstexture::~gstexture()
streamfx::nvidia::cuda::gstexture::~gstexture()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
@ -43,8 +43,8 @@ nvidia::cuda::gstexture::~gstexture()
_cuda->cuGraphicsUnregisterResource(_resource);
}
nvidia::cuda::gstexture::gstexture(std::shared_ptr<streamfx::obs::gs::texture> texture)
: _cuda(::nvidia::cuda::cuda::get()), _texture(texture), _resource(), _is_mapped(false), _pointer()
streamfx::nvidia::cuda::gstexture::gstexture(std::shared_ptr<streamfx::obs::gs::texture> texture)
: _cuda(::streamfx::nvidia::cuda::cuda::get()), _texture(texture), _resource(), _is_mapped(false), _pointer()
{
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
@ -77,7 +77,7 @@ nvidia::cuda::gstexture::gstexture(std::shared_ptr<streamfx::obs::gs::texture> t
}
switch (_cuda->cuGraphicsD3D11RegisterResource(&_resource, resource, 0)) {
case nvidia::cuda::result::SUCCESS:
case streamfx::nvidia::cuda::result::SUCCESS:
break;
default:
throw std::runtime_error("nvidia::cuda::gstexture: Failed to register resource.");
@ -86,7 +86,8 @@ nvidia::cuda::gstexture::gstexture(std::shared_ptr<streamfx::obs::gs::texture> t
#endif
}
nvidia::cuda::array_t nvidia::cuda::gstexture::map(std::shared_ptr<nvidia::cuda::stream> stream)
streamfx::nvidia::cuda::array_t
streamfx::nvidia::cuda::gstexture::map(std::shared_ptr<streamfx::nvidia::cuda::stream> stream)
{
if (_is_mapped) {
return _pointer;
@ -94,7 +95,7 @@ nvidia::cuda::array_t nvidia::cuda::gstexture::map(std::shared_ptr<nvidia::cuda:
graphics_resource_t resources[] = {_resource};
switch (_cuda->cuGraphicsMapResources(1, resources, stream->get())) {
case nvidia::cuda::result::SUCCESS:
case streamfx::nvidia::cuda::result::SUCCESS:
break;
default:
throw std::runtime_error("nvidia::cuda::gstexture: Mapping failed.");
@ -104,7 +105,7 @@ nvidia::cuda::array_t nvidia::cuda::gstexture::map(std::shared_ptr<nvidia::cuda:
_is_mapped = true;
switch (_cuda->cuGraphicsSubResourceGetMappedArray(&_pointer, _resource, 0, 0)) {
case nvidia::cuda::result::SUCCESS:
case streamfx::nvidia::cuda::result::SUCCESS:
break;
default:
unmap();
@ -114,14 +115,14 @@ nvidia::cuda::array_t nvidia::cuda::gstexture::map(std::shared_ptr<nvidia::cuda:
return _pointer;
}
void nvidia::cuda::gstexture::unmap()
void streamfx::nvidia::cuda::gstexture::unmap()
{
if (!_is_mapped)
return;
graphics_resource_t resources[] = {_resource};
switch (_cuda->cuGraphicsUnmapResources(1, resources, _stream->get())) {
case nvidia::cuda::result::SUCCESS:
case streamfx::nvidia::cuda::result::SUCCESS:
break;
default:
throw std::runtime_error("nvidia::cuda::gstexture: Unmapping failed.");
@ -132,12 +133,12 @@ void nvidia::cuda::gstexture::unmap()
_stream.reset();
}
std::shared_ptr<streamfx::obs::gs::texture> nvidia::cuda::gstexture::get_texture()
std::shared_ptr<streamfx::obs::gs::texture> streamfx::nvidia::cuda::gstexture::get_texture()
{
return _texture;
}
::nvidia::cuda::graphics_resource_t nvidia::cuda::gstexture::get()
::streamfx::nvidia::cuda::graphics_resource_t streamfx::nvidia::cuda::gstexture::get()
{
return _resource;
}

View file

@ -24,24 +24,24 @@
#include "nvidia-cuda.hpp"
#include "obs/gs/gs-texture.hpp"
namespace nvidia::cuda {
namespace streamfx::nvidia::cuda {
class gstexture {
std::shared_ptr<::nvidia::cuda::cuda> _cuda;
std::shared_ptr<streamfx::obs::gs::texture> _texture;
graphics_resource_t _resource;
std::shared_ptr<::streamfx::nvidia::cuda::cuda> _cuda;
std::shared_ptr<streamfx::obs::gs::texture> _texture;
graphics_resource_t _resource;
bool _is_mapped;
array_t _pointer;
std::shared_ptr<nvidia::cuda::stream> _stream;
bool _is_mapped;
array_t _pointer;
std::shared_ptr<streamfx::nvidia::cuda::stream> _stream;
public:
~gstexture();
gstexture(std::shared_ptr<streamfx::obs::gs::texture> texture);
array_t map(std::shared_ptr<nvidia::cuda::stream> stream);
array_t map(std::shared_ptr<streamfx::nvidia::cuda::stream> stream);
void unmap();
std::shared_ptr<streamfx::obs::gs::texture> get_texture();
::nvidia::cuda::graphics_resource_t get();
std::shared_ptr<streamfx::obs::gs::texture> get_texture();
::streamfx::nvidia::cuda::graphics_resource_t get();
};
} // namespace nvidia::cuda
} // namespace streamfx::nvidia::cuda

View file

@ -35,32 +35,33 @@
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
#endif
nvidia::cuda::memory::~memory()
streamfx::nvidia::cuda::memory::~memory()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
_cuda->cuMemFree(_pointer);
}
nvidia::cuda::memory::memory(size_t size) : _cuda(::nvidia::cuda::cuda::get()), _pointer(), _size(size)
streamfx::nvidia::cuda::memory::memory(size_t size)
: _cuda(::streamfx::nvidia::cuda::cuda::get()), _pointer(), _size(size)
{
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
::nvidia::cuda::result res = _cuda->cuMemAlloc(&_pointer, _size);
::streamfx::nvidia::cuda::result res = _cuda->cuMemAlloc(&_pointer, _size);
switch (res) {
case ::nvidia::cuda::result::SUCCESS:
case ::streamfx::nvidia::cuda::result::SUCCESS:
break;
default:
throw std::runtime_error("nvidia::cuda::memory: cuMemAlloc failed.");
}
}
nvidia::cuda::device_ptr_t nvidia::cuda::memory::get()
streamfx::nvidia::cuda::device_ptr_t streamfx::nvidia::cuda::memory::get()
{
return _pointer;
}
std::size_t nvidia::cuda::memory::size()
std::size_t streamfx::nvidia::cuda::memory::size()
{
return _size;
}

View file

@ -22,11 +22,11 @@
#include <memory>
#include "nvidia-cuda.hpp"
namespace nvidia::cuda {
namespace streamfx::nvidia::cuda {
class memory {
std::shared_ptr<::nvidia::cuda::cuda> _cuda;
device_ptr_t _pointer;
size_t _size;
std::shared_ptr<::streamfx::nvidia::cuda::cuda> _cuda;
device_ptr_t _pointer;
size_t _size;
public:
~memory();
@ -36,4 +36,4 @@ namespace nvidia::cuda {
std::size_t size();
};
} // namespace nvidia::cuda
} // namespace streamfx::nvidia::cuda

View file

@ -35,7 +35,7 @@
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
#endif
nvidia::cuda::obs::~obs()
streamfx::nvidia::cuda::obs::~obs()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
@ -49,7 +49,7 @@ nvidia::cuda::obs::~obs()
_cuda.reset();
}
nvidia::cuda::obs::obs() : _cuda(::nvidia::cuda::cuda::get()), _context()
streamfx::nvidia::cuda::obs::obs() : _cuda(::streamfx::nvidia::cuda::cuda::get()), _context()
{
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
@ -58,7 +58,8 @@ nvidia::cuda::obs::obs() : _cuda(::nvidia::cuda::cuda::get()), _context()
// Create Context
#ifdef WIN32
if (gs_get_device_type() == GS_DEVICE_DIRECT3D_11) {
_context = std::make_shared<::nvidia::cuda::context>(reinterpret_cast<ID3D11Device*>(gs_get_device_obj()));
_context =
std::make_shared<::streamfx::nvidia::cuda::context>(reinterpret_cast<ID3D11Device*>(gs_get_device_obj()));
}
#endif
if (gs_get_device_type() == GS_DEVICE_OPENGL) {
@ -67,35 +68,35 @@ nvidia::cuda::obs::obs() : _cuda(::nvidia::cuda::cuda::get()), _context()
// Create Stream
auto stack = _context->enter();
_stream = std::make_shared<::nvidia::cuda::stream>();
_stream = std::make_shared<::streamfx::nvidia::cuda::stream>();
}
std::shared_ptr<nvidia::cuda::obs> nvidia::cuda::obs::get()
std::shared_ptr<streamfx::nvidia::cuda::obs> streamfx::nvidia::cuda::obs::get()
{
static std::weak_ptr<nvidia::cuda::obs> instance;
static std::mutex lock;
static std::weak_ptr<streamfx::nvidia::cuda::obs> instance;
static std::mutex lock;
std::unique_lock<std::mutex> ul(lock);
if (instance.expired()) {
std::shared_ptr<nvidia::cuda::obs> hard_instance;
hard_instance = std::make_shared<nvidia::cuda::obs>();
std::shared_ptr<streamfx::nvidia::cuda::obs> hard_instance;
hard_instance = std::make_shared<streamfx::nvidia::cuda::obs>();
instance = hard_instance;
return hard_instance;
}
return instance.lock();
}
std::shared_ptr<nvidia::cuda::cuda> nvidia::cuda::obs::get_cuda()
std::shared_ptr<streamfx::nvidia::cuda::cuda> streamfx::nvidia::cuda::obs::get_cuda()
{
return _cuda;
}
std::shared_ptr<nvidia::cuda::context> nvidia::cuda::obs::get_context()
std::shared_ptr<streamfx::nvidia::cuda::context> streamfx::nvidia::cuda::obs::get_context()
{
return _context;
}
std::shared_ptr<nvidia::cuda::stream> nvidia::cuda::obs::get_stream()
std::shared_ptr<streamfx::nvidia::cuda::stream> streamfx::nvidia::cuda::obs::get_stream()
{
return _stream;
}

View file

@ -23,21 +23,21 @@
#include "nvidia-cuda-stream.hpp"
#include "nvidia-cuda.hpp"
namespace nvidia::cuda {
namespace streamfx::nvidia::cuda {
class obs {
std::shared_ptr<::nvidia::cuda::cuda> _cuda;
std::shared_ptr<::nvidia::cuda::context> _context;
std::shared_ptr<::nvidia::cuda::stream> _stream;
std::shared_ptr<::streamfx::nvidia::cuda::cuda> _cuda;
std::shared_ptr<::streamfx::nvidia::cuda::context> _context;
std::shared_ptr<::streamfx::nvidia::cuda::stream> _stream;
public:
~obs();
obs();
std::shared_ptr<::nvidia::cuda::cuda> get_cuda();
std::shared_ptr<::nvidia::cuda::context> get_context();
std::shared_ptr<::nvidia::cuda::stream> get_stream();
std::shared_ptr<::streamfx::nvidia::cuda::cuda> get_cuda();
std::shared_ptr<::streamfx::nvidia::cuda::context> get_context();
std::shared_ptr<::streamfx::nvidia::cuda::stream> get_stream();
public:
static std::shared_ptr<::nvidia::cuda::obs> get();
static std::shared_ptr<::streamfx::nvidia::cuda::obs> get();
};
} // namespace nvidia::cuda
} // namespace streamfx::nvidia::cuda

View file

@ -35,40 +35,41 @@
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
#endif
nvidia::cuda::stream::~stream()
streamfx::nvidia::cuda::stream::~stream()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
_cuda->cuStreamDestroy(_stream);
}
nvidia::cuda::stream::stream(::nvidia::cuda::stream_flags flags, int32_t priority) : _cuda(::nvidia::cuda::cuda::get())
streamfx::nvidia::cuda::stream::stream(::streamfx::nvidia::cuda::stream_flags flags, int32_t priority)
: _cuda(::streamfx::nvidia::cuda::cuda::get())
{
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
nvidia::cuda::result res;
streamfx::nvidia::cuda::result res;
if (priority == 0) {
res = _cuda->cuStreamCreate(&_stream, flags);
} else {
res = _cuda->cuStreamCreateWithPriority(&_stream, flags, priority);
}
switch (res) {
case nvidia::cuda::result::SUCCESS:
case streamfx::nvidia::cuda::result::SUCCESS:
break;
default:
throw std::runtime_error("Failed to create CUstream object.");
}
}
::nvidia::cuda::stream_t nvidia::cuda::stream::get()
::streamfx::nvidia::cuda::stream_t streamfx::nvidia::cuda::stream::get()
{
return _stream;
}
void nvidia::cuda::stream::synchronize()
void streamfx::nvidia::cuda::stream::synchronize()
{
D_LOG_DEBUG("Synchronizing... (Addr: 0x%" PRIuPTR ")", this);
if (auto res = _cuda->cuStreamSynchronize(_stream); res != ::nvidia::cuda::result::SUCCESS) {
throw ::nvidia::cuda::cuda_error(res);
if (auto res = _cuda->cuStreamSynchronize(_stream); res != ::streamfx::nvidia::cuda::result::SUCCESS) {
throw ::streamfx::nvidia::cuda::cuda_error(res);
}
}

View file

@ -21,17 +21,18 @@
#include <memory>
#include "nvidia-cuda.hpp"
namespace nvidia::cuda {
namespace streamfx::nvidia::cuda {
class stream {
std::shared_ptr<::nvidia::cuda::cuda> _cuda;
::nvidia::cuda::stream_t _stream;
std::shared_ptr<::streamfx::nvidia::cuda::cuda> _cuda;
::streamfx::nvidia::cuda::stream_t _stream;
public:
~stream();
stream(::nvidia::cuda::stream_flags flags = ::nvidia::cuda::stream_flags::DEFAULT, int32_t priority = 0);
stream(::streamfx::nvidia::cuda::stream_flags flags = ::streamfx::nvidia::cuda::stream_flags::DEFAULT,
int32_t priority = 0);
::nvidia::cuda::stream_t get();
::streamfx::nvidia::cuda::stream_t get();
void synchronize();
};
} // namespace nvidia::cuda
} // namespace streamfx::nvidia::cuda

View file

@ -80,12 +80,12 @@
D_LOG_WARNING("Loading of optional symbol '" #NAME "' failed.", 0); \
}
nvidia::cuda::cuda::~cuda()
streamfx::nvidia::cuda::cuda::~cuda()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
}
nvidia::cuda::cuda::cuda() : _library()
streamfx::nvidia::cuda::cuda::cuda() : _library()
{
int32_t cuda_version = 0;
@ -238,21 +238,21 @@ nvidia::cuda::cuda::cuda() : _library()
cuInit(0);
}
int32_t nvidia::cuda::cuda::version()
int32_t streamfx::nvidia::cuda::cuda::version()
{
int32_t v = 0;
cuDriverGetVersion(&v);
return v;
}
std::shared_ptr<nvidia::cuda::cuda> nvidia::cuda::cuda::get()
std::shared_ptr<streamfx::nvidia::cuda::cuda> streamfx::nvidia::cuda::cuda::get()
{
static std::weak_ptr<nvidia::cuda::cuda> instance;
static std::mutex lock;
static std::weak_ptr<streamfx::nvidia::cuda::cuda> instance;
static std::mutex lock;
std::unique_lock<std::mutex> ul(lock);
if (instance.expired()) {
auto hard_instance = std::make_shared<nvidia::cuda::cuda>();
auto hard_instance = std::make_shared<streamfx::nvidia::cuda::cuda>();
instance = hard_instance;
return hard_instance;
}

View file

@ -32,14 +32,14 @@
#pragma warning(pop)
#endif
#define P_CUDA_DEFINE_FUNCTION(name, ...) \
private: \
typedef ::nvidia::cuda::result (*t##name)(__VA_ARGS__); \
\
public: \
#define P_CUDA_DEFINE_FUNCTION(name, ...) \
private: \
typedef ::streamfx::nvidia::cuda::result (*t##name)(__VA_ARGS__); \
\
public: \
t##name name = nullptr;
namespace nvidia::cuda {
namespace streamfx::nvidia::cuda {
enum class result : std::size_t {
SUCCESS = 0,
INVALID_VALUE = 1,
@ -163,13 +163,13 @@ namespace nvidia::cuda {
};
class cuda_error : public std::exception {
::nvidia::cuda::result _code;
::streamfx::nvidia::cuda::result _code;
public:
~cuda_error(){};
cuda_error(::nvidia::cuda::result code) : _code(code) {}
cuda_error(::streamfx::nvidia::cuda::result code) : _code(code) {}
::nvidia::cuda::result code()
::streamfx::nvidia::cuda::result code()
{
return _code;
}
@ -319,9 +319,9 @@ namespace nvidia::cuda {
ID3D11Resource* d3dresource, uint32_t flags);
#endif
public:
static std::shared_ptr<::nvidia::cuda::cuda> get();
static std::shared_ptr<::streamfx::nvidia::cuda::cuda> get();
};
} // namespace nvidia::cuda
} // namespace streamfx::nvidia::cuda
P_ENABLE_BITMASK_OPERATORS(::nvidia::cuda::context_flags)
P_ENABLE_BITMASK_OPERATORS(::nvidia::cuda::stream_flags)
P_ENABLE_BITMASK_OPERATORS(::streamfx::nvidia::cuda::context_flags)
P_ENABLE_BITMASK_OPERATORS(::streamfx::nvidia::cuda::stream_flags)