Renderer: Refactor transient resources (allow access at any time)

This commit is contained in:
SirLynix
2023-07-21 08:51:39 +02:00
committed by Jérôme Leclercq
parent de68033a0e
commit 4db5b59ec9
21 changed files with 265 additions and 240 deletions

View File

@@ -156,22 +156,6 @@ namespace Nz
#endif
}
void OpenGLDevice::Execute(const FunctionRef<void(CommandBufferBuilder& builder)>& callback, QueueType /*queueType*/)
{
const GL::Context* activeContext = GL::Context::GetCurrentContext();
if (!activeContext || activeContext->GetDevice() != this)
{
if (!GL::Context::SetCurrentContext(m_referenceContext.get()))
throw std::runtime_error("failed to activate context");
}
OpenGLCommandBuffer commandBuffer; //< TODO: Use a pool and remove default constructor
OpenGLCommandBufferBuilder builder(commandBuffer);
callback(builder);
commandBuffer.Execute();
}
const RenderDeviceInfo& OpenGLDevice::GetDeviceInfo() const
{
return m_deviceInfo;