Allocate command buffers from pools

This commit is contained in:
Jérôme Leclercq
2020-08-27 18:31:26 +02:00
parent cbdac32f5f
commit 7c9dcdfbe4
18 changed files with 333 additions and 23 deletions

View File

@@ -4,11 +4,24 @@
#include <Nazara/OpenGLRenderer/OpenGLCommandBuffer.hpp>
#include <Nazara/OpenGLRenderer/OpenGLFramebuffer.hpp>
#include <cassert>
#include <stdexcept>
#include <Nazara/OpenGLRenderer/Debug.hpp>
namespace Nz
{
inline OpenGLCommandBuffer::OpenGLCommandBuffer() :
m_owner(nullptr)
{
}
inline OpenGLCommandBuffer::OpenGLCommandBuffer(OpenGLCommandPool& owner, std::size_t poolIndex, std::size_t bindingIndex) :
m_bindingIndex(bindingIndex),
m_poolIndex(poolIndex),
m_owner(&owner)
{
}
inline void OpenGLCommandBuffer::BeginDebugRegion(const std::string_view& regionName, const Nz::Color& color)
{
BeginDebugRegionData beginDebugRegion;
@@ -104,6 +117,22 @@ namespace Nz
m_commands.emplace_back(EndDebugRegionData{});
}
inline std::size_t Nz::OpenGLCommandBuffer::GetBindingIndex() const
{
return m_bindingIndex;
}
inline std::size_t Nz::OpenGLCommandBuffer::GetPoolIndex() const
{
return m_poolIndex;
}
inline const OpenGLCommandPool& OpenGLCommandBuffer::GetOwner() const
{
assert(m_owner);
return *m_owner;
}
inline void OpenGLCommandBuffer::SetFramebuffer(const OpenGLFramebuffer& framebuffer, const RenderPass& /*renderPass*/, std::initializer_list<CommandBufferBuilder::ClearValues> clearValues)
{
SetFrameBufferData setFramebuffer;