33#ifndef DVD_GL_MEMORY_MANAGER_H_
34#define DVD_GL_MEMORY_MANAGER_H_
69 gl46core::BufferStorageMask storageMask,
70 gl46core::BufferAccessMask accessMask,
71 gl46core::GLenum usage);
74 [[nodiscard]]
bool allocate(
size_t size,
const char* name, std::pair<bufferPtr, size_t> initialData,
Block& blockOut);
77 PROPERTY_RW( gl46core::BufferStorageMask, storageMask, gl46core::BufferStorageMask::GL_NONE_BIT);
78 PROPERTY_RW( gl46core::BufferAccessMask, accessMask, gl46core::BufferAccessMask::GL_NONE_BIT);
96 [[nodiscard]] std::unique_ptr<Chunk>
allocate(
bool poolAllocations,
99 gl46core::BufferStorageMask storageMask,
100 gl46core::BufferAccessMask accessMask,
101 gl46core::GLenum usage)
const;
114 void init(
size_t size);
118 gl46core::BufferStorageMask storageMask,
119 gl46core::BufferAccessMask accessMask,
120 gl46core::GLenum usage,
121 const char* blockName,
122 std::pair<bufferPtr, size_t> initialData);
136void createBuffer( gl46core::GLuint& bufferIdOut,
const char* name =
nullptr);
139 gl46core::GLenum usageMask,
140 gl46core::GLuint& bufferIdOut,
141 std::pair<bufferPtr, size_t> initialData,
142 const char* name =
nullptr);
145 gl46core::BufferStorageMask storageMask,
146 gl46core::BufferAccessMask accessMask,
147 gl46core::GLuint& bufferIdOut,
148 std::pair<bufferPtr, size_t> initialData,
149 const char* name =
nullptr);
std::unique_ptr< Chunk > allocate(bool poolAllocations, size_t size, size_t alignment, gl46core::BufferStorageMask storageMask, gl46core::BufferAccessMask accessMask, gl46core::GLenum usage) const
const bool _poolAllocations
PROPERTY_RW(gl46core::BufferStorageMask, storageMask, gl46core::BufferStorageMask::GL_NONE_BIT)
FORCE_INLINE bool poolAllocations() const noexcept
bool containsBlock(const Block &block) const
bool allocate(size_t size, const char *name, std::pair< bufferPtr, size_t > initialData, Block &blockOut)
PROPERTY_RW(gl46core::GLenum, usage, gl46core::GL_NONE)
PROPERTY_RW(gl46core::BufferAccessMask, accessMask, gl46core::BufferAccessMask::GL_NONE_BIT)
PROPERTY_RW(size_t, alignment, 0u)
void deallocate(const Block &block)
vector< std::unique_ptr< Chunk > > _chunks
ChunkAllocator_uptr _chunkAllocator
Mutex _chunkAllocatorLock
FORCE_INLINE GLMemoryType glMemoryType() const noexcept
const GLMemoryType _memoryType
Block allocate(bool poolAllocations, size_t size, size_t alignment, gl46core::BufferStorageMask storageMask, gl46core::BufferAccessMask accessMask, gl46core::GLenum usage, const char *blockName, std::pair< bufferPtr, size_t > initialData)
void OnFrameEnd(const U64 frameCount)
void createBuffer(gl46core::GLuint &bufferIdOut, const char *name)
void freeBuffer(gl46core::GLuint &bufferId, bufferPtr mappedPtr)
Byte * createAndAllocPersistentBuffer(const size_t bufferSize, const gl46core::BufferStorageMask storageMask, const gl46core::BufferAccessMask accessMask, gl46core::GLuint &bufferIdOut, const std::pair< bufferPtr, size_t > initialData, const char *name)
void createAndAllocBuffer(const size_t bufferSize, const gl46core::GLenum usageMask, gl46core::GLuint &bufferIdOut, const std::pair< bufferPtr, size_t > initialData, const char *name)
Handle console commands that start with a forward slash.
constexpr gl46core::GLuint GL_NULL_HANDLE
Invalid object value. Used to compare handles and determine if they were properly created.
eastl::vector< Type > vector
bool operator==(const Block &rhs) const =default
gl46core::GLuint _bufferHandle