Renderer: Implement Framebuffers

This commit is contained in:
Jérôme Leclercq
2021-02-20 19:22:08 +01:00
parent 3ef74d6e1d
commit fb3468854f
32 changed files with 401 additions and 100 deletions

View File

@@ -46,6 +46,24 @@ namespace Nz::GL
}
}
template<typename C, GLenum ObjectType, typename... CreateArgs>
const Context& DeviceObject<C, ObjectType, CreateArgs...>::EnsureDeviceContext() const
{
assert(m_device);
const Context* activeContext = Context::GetCurrentContext();
if (!activeContext || activeContext->GetDevice() != m_device)
{
const Context& referenceContext = m_device->GetReferenceContext();
if (!Context::SetCurrentContext(&referenceContext))
throw std::runtime_error("failed to activate context");
return referenceContext;
}
return *activeContext;
}
template<typename C, GLenum ObjectType, typename... CreateArgs>
bool DeviceObject<C, ObjectType, CreateArgs...>::IsValid() const
{
@@ -72,24 +90,6 @@ namespace Nz::GL
if (context.glObjectLabel)
context.glObjectLabel(ObjectType, m_objectId, name.size(), name.data());
}
template<typename C, GLenum ObjectType, typename... CreateArgs>
const Context& DeviceObject<C, ObjectType, CreateArgs...>::EnsureDeviceContext()
{
assert(m_device);
const Context* activeContext = Context::GetCurrentContext();
if (!activeContext || activeContext->GetDevice() != m_device)
{
const Context& referenceContext = m_device->GetReferenceContext();
if (!Context::SetCurrentContext(&referenceContext))
throw std::runtime_error("failed to activate context");
return referenceContext;
}
return *activeContext;
}
}
#include <Nazara/OpenGLRenderer/DebugOff.hpp>