Renderer: Implement Framebuffers
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user