diff --git a/source/nvidia/cuda/nvidia-cuda-context.cpp b/source/nvidia/cuda/nvidia-cuda-context.cpp index fcfdf814..e0baef41 100644 --- a/source/nvidia/cuda/nvidia-cuda-context.cpp +++ b/source/nvidia/cuda/nvidia-cuda-context.cpp @@ -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); } } diff --git a/source/nvidia/cuda/nvidia-cuda-context.hpp b/source/nvidia/cuda/nvidia-cuda-context.hpp index 5305d68d..cfe1f59b 100644 --- a/source/nvidia/cuda/nvidia-cuda-context.hpp +++ b/source/nvidia/cuda/nvidia-cuda-context.hpp @@ -21,14 +21,14 @@ #include #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 diff --git a/source/nvidia/cuda/nvidia-cuda-gs-texture.cpp b/source/nvidia/cuda/nvidia-cuda-gs-texture.cpp index c574ac9f..3fc8536c 100644 --- a/source/nvidia/cuda/nvidia-cuda-gs-texture.cpp +++ b/source/nvidia/cuda/nvidia-cuda-gs-texture.cpp @@ -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 texture) - : _cuda(::nvidia::cuda::cuda::get()), _texture(texture), _resource(), _is_mapped(false), _pointer() +streamfx::nvidia::cuda::gstexture::gstexture(std::shared_ptr 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 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 t #endif } -nvidia::cuda::array_t nvidia::cuda::gstexture::map(std::shared_ptr stream) +streamfx::nvidia::cuda::array_t + streamfx::nvidia::cuda::gstexture::map(std::shared_ptr stream) { if (_is_mapped) { return _pointer; @@ -94,7 +95,7 @@ nvidia::cuda::array_t nvidia::cuda::gstexture::map(std::shared_ptrcuGraphicsMapResources(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_ptrcuGraphicsSubResourceGetMappedArray(&_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_ptrcuGraphicsUnmapResources(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 nvidia::cuda::gstexture::get_texture() +std::shared_ptr 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; } diff --git a/source/nvidia/cuda/nvidia-cuda-gs-texture.hpp b/source/nvidia/cuda/nvidia-cuda-gs-texture.hpp index d56f885b..a110a81e 100644 --- a/source/nvidia/cuda/nvidia-cuda-gs-texture.hpp +++ b/source/nvidia/cuda/nvidia-cuda-gs-texture.hpp @@ -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 _texture; - graphics_resource_t _resource; + std::shared_ptr<::streamfx::nvidia::cuda::cuda> _cuda; + std::shared_ptr _texture; + graphics_resource_t _resource; - bool _is_mapped; - array_t _pointer; - std::shared_ptr _stream; + bool _is_mapped; + array_t _pointer; + std::shared_ptr _stream; public: ~gstexture(); gstexture(std::shared_ptr texture); - array_t map(std::shared_ptr stream); + array_t map(std::shared_ptr stream); void unmap(); - std::shared_ptr get_texture(); - ::nvidia::cuda::graphics_resource_t get(); + std::shared_ptr get_texture(); + ::streamfx::nvidia::cuda::graphics_resource_t get(); }; -} // namespace nvidia::cuda +} // namespace streamfx::nvidia::cuda diff --git a/source/nvidia/cuda/nvidia-cuda-memory.cpp b/source/nvidia/cuda/nvidia-cuda-memory.cpp index 8e185fdf..7661c3c0 100644 --- a/source/nvidia/cuda/nvidia-cuda-memory.cpp +++ b/source/nvidia/cuda/nvidia-cuda-memory.cpp @@ -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; } diff --git a/source/nvidia/cuda/nvidia-cuda-memory.hpp b/source/nvidia/cuda/nvidia-cuda-memory.hpp index 69ad92d1..4f80714b 100644 --- a/source/nvidia/cuda/nvidia-cuda-memory.hpp +++ b/source/nvidia/cuda/nvidia-cuda-memory.hpp @@ -22,11 +22,11 @@ #include #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 diff --git a/source/nvidia/cuda/nvidia-cuda-obs.cpp b/source/nvidia/cuda/nvidia-cuda-obs.cpp index ee213b7c..c99a092a 100644 --- a/source/nvidia/cuda/nvidia-cuda-obs.cpp +++ b/source/nvidia/cuda/nvidia-cuda-obs.cpp @@ -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(gs_get_device_obj())); + _context = + std::make_shared<::streamfx::nvidia::cuda::context>(reinterpret_cast(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::get() +std::shared_ptr streamfx::nvidia::cuda::obs::get() { - static std::weak_ptr instance; - static std::mutex lock; + static std::weak_ptr instance; + static std::mutex lock; std::unique_lock ul(lock); if (instance.expired()) { - std::shared_ptr hard_instance; - hard_instance = std::make_shared(); + std::shared_ptr hard_instance; + hard_instance = std::make_shared(); instance = hard_instance; return hard_instance; } return instance.lock(); } -std::shared_ptr nvidia::cuda::obs::get_cuda() +std::shared_ptr streamfx::nvidia::cuda::obs::get_cuda() { return _cuda; } -std::shared_ptr nvidia::cuda::obs::get_context() +std::shared_ptr streamfx::nvidia::cuda::obs::get_context() { return _context; } -std::shared_ptr nvidia::cuda::obs::get_stream() +std::shared_ptr streamfx::nvidia::cuda::obs::get_stream() { return _stream; } diff --git a/source/nvidia/cuda/nvidia-cuda-obs.hpp b/source/nvidia/cuda/nvidia-cuda-obs.hpp index 6b1ede0e..555459c5 100644 --- a/source/nvidia/cuda/nvidia-cuda-obs.hpp +++ b/source/nvidia/cuda/nvidia-cuda-obs.hpp @@ -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 diff --git a/source/nvidia/cuda/nvidia-cuda-stream.cpp b/source/nvidia/cuda/nvidia-cuda-stream.cpp index f4c971d2..80c9b99d 100644 --- a/source/nvidia/cuda/nvidia-cuda-stream.cpp +++ b/source/nvidia/cuda/nvidia-cuda-stream.cpp @@ -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); } } diff --git a/source/nvidia/cuda/nvidia-cuda-stream.hpp b/source/nvidia/cuda/nvidia-cuda-stream.hpp index d7a01680..007adb68 100644 --- a/source/nvidia/cuda/nvidia-cuda-stream.hpp +++ b/source/nvidia/cuda/nvidia-cuda-stream.hpp @@ -21,17 +21,18 @@ #include #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 diff --git a/source/nvidia/cuda/nvidia-cuda.cpp b/source/nvidia/cuda/nvidia-cuda.cpp index fb3de9fd..4882fbae 100644 --- a/source/nvidia/cuda/nvidia-cuda.cpp +++ b/source/nvidia/cuda/nvidia-cuda.cpp @@ -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::get() +std::shared_ptr streamfx::nvidia::cuda::cuda::get() { - static std::weak_ptr instance; - static std::mutex lock; + static std::weak_ptr instance; + static std::mutex lock; std::unique_lock ul(lock); if (instance.expired()) { - auto hard_instance = std::make_shared(); + auto hard_instance = std::make_shared(); instance = hard_instance; return hard_instance; } diff --git a/source/nvidia/cuda/nvidia-cuda.hpp b/source/nvidia/cuda/nvidia-cuda.hpp index d2c9836b..4a724ad8 100644 --- a/source/nvidia/cuda/nvidia-cuda.hpp +++ b/source/nvidia/cuda/nvidia-cuda.hpp @@ -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)