68 static_assert(
sizeof(
DrawCmd) <= 64);
80 using Cmd = std::variant<DrawCmd, DynamicDrawCmd, RenderPassCmd>;
81 const std::vector<Cmd> &
GetDrawCmds()
const {
return m_drawCmds; }
83 bool IsEmpty()
const {
return m_drawCmds.empty(); }
91 m_drawCmds.reserve(32);
95 char *AllocDrawData(
const Shader *shader);
100 void ApplyDrawData(
const Shader *shader,
Program *program,
char *drawData)
const;
102 void ExecuteDrawCmd(
const DrawCmd &);
103 void ExecuteDynamicDrawCmd(
const DynamicDrawCmd &);
107 static TextureGL **getTextureBindings(
const Shader *shader,
char *data);
111 static constexpr size_t BUCKET_SIZE = 1UL << 14;
113 std::unique_ptr<char[]> data;
115 size_t capacity = BUCKET_SIZE;
117 char *alloc(
size_t size)
120 if (capacity - used >= size) {
121 ret = data.get() + used;
129 std::vector<Cmd> m_drawCmds;
130 std::vector<DataBucket> m_dataBuckets;
131 bool m_executing =
false;
Definition VertexBuffer.h:127
Definition Material.h:148
Definition VertexBuffer.h:156
Definition CommandBufferGL.h:35
bool IsEmpty() const
Definition CommandBufferGL.h:83
void AddScissorCmd(ViewportExtents extents)
Definition CommandBufferGL.cpp:83
void AddDynamicDrawCmd(BufferBinding< Graphics::VertexBuffer > vtx, BufferBinding< Graphics::IndexBuffer > idx, Graphics::Material *mat)
Definition CommandBufferGL.cpp:35
void AddClearCmd(bool clearColors, bool clearDepth, Color color)
Definition CommandBufferGL.cpp:104
std::variant< DrawCmd, DynamicDrawCmd, RenderPassCmd > Cmd
Definition CommandBufferGL.h:80
const std::vector< Cmd > & GetDrawCmds() const
Definition CommandBufferGL.h:81
void AddDrawCmd(Graphics::MeshObject *mesh, Graphics::Material *mat, Graphics::InstanceBuffer *inst=nullptr)
Definition CommandBufferGL.cpp:18
void Reset()
Definition CommandBufferGL.cpp:128
void AddRenderPassCmd(RenderTarget *renderTarget, ViewportExtents extents)
Definition CommandBufferGL.cpp:59
Definition VertexBufferGL.h:60
Definition VertexBufferGL.h:81
Definition MaterialGL.h:35
Definition VertexBufferGL.h:103
Definition RenderTargetGL.h:21
Definition TextureGL.h:12
Definition VertexBufferGL.h:17
Definition RendererGL.h:37
Definition Background.h:14
Definition BufferCommon.h:63
Definition CommandBufferGL.h:37
char * drawData
Definition CommandBufferGL.h:43
MeshObject * mesh
Definition CommandBufferGL.h:38
const Shader * shader
Definition CommandBufferGL.h:40
Program * program
Definition CommandBufferGL.h:41
size_t renderStateHash
Definition CommandBufferGL.h:42
InstanceBuffer * inst
Definition CommandBufferGL.h:39
Definition CommandBufferGL.h:46
Program * program
Definition CommandBufferGL.h:50
BufferBinding< VertexBuffer > vtxBind
Definition CommandBufferGL.h:47
size_t renderStateHash
Definition CommandBufferGL.h:51
char * drawData
Definition CommandBufferGL.h:52
BufferBinding< IndexBuffer > idxBind
Definition CommandBufferGL.h:48
const Shader * shader
Definition CommandBufferGL.h:49
Definition CommandBufferGL.h:55
RenderTarget * renderTarget
Definition CommandBufferGL.h:56
ViewportExtents extents
Definition CommandBufferGL.h:57
bool clearColors
Definition CommandBufferGL.h:61
ViewportExtents scissor
Definition CommandBufferGL.h:58
bool setRenderTarget
Definition CommandBufferGL.h:59
Color clearColor
Definition CommandBufferGL.h:63
bool clearDepth
Definition CommandBufferGL.h:62
bool setScissor
Definition CommandBufferGL.h:60