Photon Editor Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
GraphicsArena.h
Go to the documentation of this file.
1#pragma once
2
3#include <Utility/TSpan.h>
4
5#include <cstddef>
6
7namespace ph::editor::ghi
8{
9
10class GraphicsMemoryManager;
11class GraphicsMemoryBlock;
12
19class GraphicsArena final
20{
21public:
22 enum class EType
23 {
24 Host,
25 Device,
28 };
29
31
37 template<typename T, typename... Args>
38 T* make(Args&&... args);
39
44 template<typename T>
45 TSpan<T> makeArray(std::size_t arraySize);
46
47private:
51 GraphicsMemoryBlock* allocNextBlock();
52
53 GraphicsMemoryBlock* allocCustomBlock(std::size_t blockSize, std::size_t blockAlignment);
54
55 GraphicsMemoryManager* m_manager;
56 GraphicsMemoryBlock* m_memoryBlock;
57 EType m_type;
58};
59
60}// end namespace ph::editor::ghi
61
Graphics memory allocation helper. The arena is allocating lazily, i.e., constructing and copying an ...
Definition GraphicsArena.h:20
T * make(Args &&... args)
Make an object of type T as if by calling its constructor with Args.
Definition GraphicsArena.ipp:15
TSpan< T > makeArray(std::size_t arraySize)
Make an array of default constructed objects of type T.
Definition GraphicsArena.ipp:36
GraphicsArena(GraphicsMemoryManager *manager, EType type)
Definition GraphicsArena.cpp:29
EType
Definition GraphicsArena.h:23
Definition GraphicsMemoryBlock.h:13
Manages memory for graphics.
Definition GraphicsMemoryManager.h:26
Definition PlatformDisplay.h:13