project: Apply formatting

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-11-08 06:47:47 +01:00
parent 7bedb337b9
commit 5adebc5f03
7 changed files with 33 additions and 30 deletions

View file

@ -49,10 +49,6 @@
#define ENABLE_STACK_CHECKS #define ENABLE_STACK_CHECKS
nvidia::cuda::context::context() : _cuda(::nvidia::cuda::cuda::get()), _ctx(), _has_device(false), _device()
{
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
}
nvidia::cuda::context::~context() nvidia::cuda::context::~context()
{ {
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this); D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
@ -63,6 +59,11 @@ nvidia::cuda::context::~context()
_cuda->cuCtxDestroy(_ctx); _cuda->cuCtxDestroy(_ctx);
} }
nvidia::cuda::context::context() : _cuda(::nvidia::cuda::cuda::get()), _ctx(), _has_device(false), _device()
{
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
}
#ifdef WIN32 #ifdef WIN32
nvidia::cuda::context::context(ID3D11Device* device) : context() nvidia::cuda::context::context(ID3D11Device* device) : context()
{ {

View file

@ -30,12 +30,13 @@ namespace nvidia::cuda {
bool _has_device; bool _has_device;
::nvidia::cuda::device_t _device; ::nvidia::cuda::device_t _device;
public:
~context();
private: private:
context(); context();
public: public:
~context();
#ifdef WIN32 #ifdef WIN32
context(ID3D11Device* device); context(ID3D11Device* device);
#endif #endif

View file

@ -35,6 +35,14 @@
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__) #define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
#endif #endif
nvidia::cuda::gstexture::~gstexture()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
unmap();
_cuda->cuGraphicsUnregisterResource(_resource);
}
nvidia::cuda::gstexture::gstexture(std::shared_ptr<gs::texture> texture) nvidia::cuda::gstexture::gstexture(std::shared_ptr<gs::texture> texture)
: _cuda(::nvidia::cuda::cuda::get()), _texture(texture), _resource(), _is_mapped(false), _pointer() : _cuda(::nvidia::cuda::cuda::get()), _texture(texture), _resource(), _is_mapped(false), _pointer()
{ {
@ -78,14 +86,6 @@ nvidia::cuda::gstexture::gstexture(std::shared_ptr<gs::texture> texture)
#endif #endif
} }
nvidia::cuda::gstexture::~gstexture()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
unmap();
_cuda->cuGraphicsUnregisterResource(_resource);
}
nvidia::cuda::array_t nvidia::cuda::gstexture::map(std::shared_ptr<nvidia::cuda::stream> stream) nvidia::cuda::array_t nvidia::cuda::gstexture::map(std::shared_ptr<nvidia::cuda::stream> stream)
{ {
if (_is_mapped) { if (_is_mapped) {

View file

@ -35,6 +35,13 @@
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__) #define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
#endif #endif
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) nvidia::cuda::memory::memory(size_t size) : _cuda(::nvidia::cuda::cuda::get()), _pointer(), _size(size)
{ {
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this); D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
@ -48,12 +55,6 @@ nvidia::cuda::memory::memory(size_t size) : _cuda(::nvidia::cuda::cuda::get()),
} }
} }
nvidia::cuda::memory::~memory()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
_cuda->cuMemFree(_pointer);
}
nvidia::cuda::device_ptr_t nvidia::cuda::memory::get() nvidia::cuda::device_ptr_t nvidia::cuda::memory::get()
{ {
return _pointer; return _pointer;

View file

@ -29,8 +29,8 @@ namespace nvidia::cuda {
size_t _size; size_t _size;
public: public:
memory(size_t size);
~memory(); ~memory();
memory(size_t size);
device_ptr_t get(); device_ptr_t get();

View file

@ -35,6 +35,13 @@
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__) #define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
#endif #endif
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()) nvidia::cuda::stream::stream(::nvidia::cuda::stream_flags flags, int32_t priority) : _cuda(::nvidia::cuda::cuda::get())
{ {
D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this); D_LOG_DEBUG("Initializating... (Addr: 0x%" PRIuPTR ")", this);
@ -53,13 +60,6 @@ nvidia::cuda::stream::stream(::nvidia::cuda::stream_flags flags, int32_t priorit
} }
} }
nvidia::cuda::stream::~stream()
{
D_LOG_DEBUG("Finalizing... (Addr: 0x%" PRIuPTR ")", this);
_cuda->cuStreamDestroy(_stream);
}
::nvidia::cuda::stream_t nvidia::cuda::stream::get() ::nvidia::cuda::stream_t nvidia::cuda::stream::get()
{ {
return _stream; return _stream;

View file

@ -130,8 +130,8 @@ namespace nvidia::cuda {
::nvidia::cuda::result _code; ::nvidia::cuda::result _code;
public: public:
cuda_error(::nvidia::cuda::result code) : _code(code) {}
~cuda_error(){}; ~cuda_error(){};
cuda_error(::nvidia::cuda::result code) : _code(code) {}
::nvidia::cuda::result code() ::nvidia::cuda::result code()
{ {
@ -143,8 +143,8 @@ namespace nvidia::cuda {
std::shared_ptr<util::library> _library; std::shared_ptr<util::library> _library;
public: public:
cuda();
~cuda(); ~cuda();
cuda();
public: public:
// Initialization // Initialization