22#include "aeongames/AeonEngine.hpp"
23#include "aeongames/CRC.hpp"
24#include "aeongames/Material.hpp"
25#include "aeongames/Vector2.hpp"
28#include "OpenGLMemoryPoolBuffer.hpp"
29#include "OpenGLRenderer.hpp"
33 static GLint GetUniformBufferOffsetAlignment()
36 glGetIntegerv ( GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &alignment );
41 mOpenGLRenderer { aOpenGLRenderer },
42 mUniformBuffer { ( ( aStackSize - 1 ) | ( GetUniformBufferOffsetAlignment() - 1 ) ) + 1, GL_DYNAMIC_DRAW }
47 mOpenGLRenderer { aOpenGLRenderer },
53 mOpenGLRenderer { aOpenGLMemoryPoolBuffer.mOpenGLRenderer },
54 mUniformBuffer {
std::move ( aOpenGLMemoryPoolBuffer.mUniformBuffer ) }
56 std::swap ( mOffset, aOpenGLMemoryPoolBuffer.mOffset );
59 OpenGLMemoryPoolBuffer::~OpenGLMemoryPoolBuffer()
66 size_t offset = mOffset;
67 mOffset += ( ( aSize - 1 ) | ( GetUniformBufferOffsetAlignment() - 1 ) ) + 1;
68 if ( mOffset > mUniformBuffer.GetSize() )
71 std::cout <<
LogLevel::Error <<
"Memory Pool Buffer cannot fulfill allocation request." << std::endl;
72 throw std::runtime_error (
"Memory Pool Buffer cannot fulfill allocation request." );
83 return mUniformBuffer;
88 mUniformBuffer.Initialize ( ( ( aStackSize - 1 ) | ( GetUniformBufferOffsetAlignment() - 1 ) ) + 1, GL_DYNAMIC_DRAW );
92 mUniformBuffer.Finalize();
Header for the 3D vector class.
Header for the 4D vector class.
Provides access to a region within a memory pool buffer.
Abstract interface for GPU/memory buffer operations.
void Reset() final
Reset the pool, freeing all previous allocations.
void Initialize(GLsizei aStackSize)
Initialize the pool buffer with the given size.
const Buffer & GetBuffer() const final
Get a reference to the underlying Buffer.
BufferAccessor Allocate(size_t aSize) final
Allocate a sub-region from the memory pool.
void Finalize()
Release pool buffer resources.
OpenGLMemoryPoolBuffer(const OpenGLRenderer &aOpenGLRenderer, GLsizei aStackSize)
Construct with a renderer and initial pool size.
OpenGL rendering backend implementing the Renderer interface.
<- This is here just for the literals