mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-15 08:15:06 +00:00
5a3954ae0e
Fixes several files incorrectly stated a different license from the actual project, as well as the copyright headers included in all files. This change has no effect on the licensing terms, it should clear up a bit of confusion by contributors. Plus the files get a bit smaller, and we have less duplicated information across the entire project. Overall the project is GPLv2 if not built with Qt, and GPLv3 if it is built with Qt. There are no parts licensed under a different license, all have been adapted from other compatible licenses into GPLv2 or GPLv3.
57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
// AUTOGENERATED COPYRIGHT HEADER START
|
|
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
// Copyright (C) 2022 lainon <GermanAizek@yandex.ru>
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
|
|
|
#pragma once
|
|
#include "nvidia-cuda.hpp"
|
|
|
|
#include "warning-disable.hpp"
|
|
#include <memory>
|
|
#include "warning-enable.hpp"
|
|
|
|
namespace streamfx::nvidia::cuda {
|
|
class context_stack;
|
|
|
|
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();
|
|
|
|
private:
|
|
context();
|
|
|
|
public:
|
|
#ifdef WIN32
|
|
context(ID3D11Device* device);
|
|
#endif
|
|
|
|
::streamfx::nvidia::cuda::context_t get();
|
|
|
|
void push();
|
|
void pop();
|
|
|
|
void synchronize();
|
|
|
|
public:
|
|
std::shared_ptr<::streamfx::nvidia::cuda::context_stack> enter();
|
|
};
|
|
|
|
class context_stack {
|
|
std::shared_ptr<::streamfx::nvidia::cuda::context> _ctx;
|
|
|
|
public:
|
|
inline ~context_stack()
|
|
{
|
|
_ctx->pop();
|
|
}
|
|
inline context_stack(std::shared_ptr<::streamfx::nvidia::cuda::context> ctx) : _ctx(std::move(ctx))
|
|
{
|
|
_ctx->push();
|
|
}
|
|
};
|
|
} // namespace streamfx::nvidia::cuda
|