OpenGL: Link contexts to device

This commit is contained in:
Lynix
2020-04-19 15:33:36 +02:00
parent bd6924d66d
commit 349e915e10
12 changed files with 78 additions and 21 deletions

View File

@@ -12,12 +12,15 @@
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
#include <Nazara/Renderer/RenderDevice.hpp>
#include <unordered_set>
#include <vector>
namespace Nz
{
class NAZARA_OPENGLRENDERER_API OpenGLDevice : public RenderDevice
{
friend GL::Context;
public:
OpenGLDevice(GL::Loader& loader);
OpenGLDevice(const OpenGLDevice&) = delete;
@@ -37,11 +40,16 @@ namespace Nz
std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
inline void NotifyTextureDestruction(GLuint texture) const;
OpenGLDevice& operator=(const OpenGLDevice&) = delete;
OpenGLDevice& operator=(OpenGLDevice&&) = delete; ///TODO?
private:
inline void NotifyContextDestruction(const GL::Context& context) const;
std::unique_ptr<GL::Context> m_referenceContext;
mutable std::unordered_set<const GL::Context*> m_contexts;
GL::Loader& m_loader;
};
}