79 static_assert(
sizeof(
DrawCmd) <= 64);
96 bool resolveMSAA =
false,
bool blitDepthBuffer =
false,
bool linearFilter =
true);
99 using Cmd = std::variant<DrawCmd, DynamicDrawCmd, RenderPassCmd, BlitRenderTargetCmd>;
100 const std::vector<Cmd> &
GetDrawCmds()
const {
return m_drawCmds; }
102 bool IsEmpty()
const {
return m_drawCmds.empty(); }
110 m_drawCmds.reserve(32);
114 char *AllocDrawData(
const Shader *shader);
119 void ApplyDrawData(
const Shader *shader,
Program *program,
char *drawData)
const;
121 void ExecuteDrawCmd(
const DrawCmd &);
122 void ExecuteDynamicDrawCmd(
const DynamicDrawCmd &);
124 void ExecuteBlitRenderTargetCmd(
const BlitRenderTargetCmd &);
127 static TextureGL **getTextureBindings(
const Shader *shader,
char *data);
131 static constexpr size_t BUCKET_SIZE = 1UL << 14;
133 std::unique_ptr<char[]> data;
135 size_t capacity = BUCKET_SIZE;
137 char *alloc(
size_t size)
140 if (capacity - used >= size) {
141 ret = data.get() + used;
149 std::vector<Cmd> m_drawCmds;
150 std::vector<DataBucket> m_dataBuckets;
151 bool m_executing =
false;
Definition: VertexBuffer.h:127
Definition: Material.h:148
Definition: VertexBuffer.h:156
Definition: CommandBufferGL.h:36
bool IsEmpty() const
Definition: CommandBufferGL.h:102
void AddScissorCmd(ViewportExtents extents)
Definition: CommandBufferGL.cpp:85
void AddDynamicDrawCmd(BufferBinding< Graphics::VertexBuffer > vtx, BufferBinding< Graphics::IndexBuffer > idx, Graphics::Material *mat)
Definition: CommandBufferGL.cpp:37
void AddClearCmd(bool clearColors, bool clearDepth, Color color)
Definition: CommandBufferGL.cpp:106
const std::vector< Cmd > & GetDrawCmds() const
Definition: CommandBufferGL.h:100
void AddDrawCmd(Graphics::MeshObject *mesh, Graphics::Material *mat, Graphics::InstanceBuffer *inst=nullptr)
Definition: CommandBufferGL.cpp:20
std::variant< DrawCmd, DynamicDrawCmd, RenderPassCmd, BlitRenderTargetCmd > Cmd
Definition: CommandBufferGL.h:99
void AddBlitRenderTargetCmd(Graphics::RenderTarget *src, Graphics::RenderTarget *dst, const ViewportExtents &srcExtents, const ViewportExtents &dstExtents, bool resolveMSAA=false, bool blitDepthBuffer=false, bool linearFilter=true)
Definition: CommandBufferGL.cpp:130
void Reset()
Definition: CommandBufferGL.cpp:156
void AddRenderPassCmd(RenderTarget *renderTarget, ViewportExtents extents)
Definition: CommandBufferGL.cpp:61
Definition: VertexBufferGL.h:60
Definition: VertexBufferGL.h:81
Definition: MaterialGL.h:35
Definition: VertexBufferGL.h:103
Definition: RenderTargetGL.h:22
Definition: TextureGL.h:12
Definition: VertexBufferGL.h:17
Definition: RenderTarget.h:38
Definition: RendererGL.h:39
Definition: Background.h:14
Definition: BufferCommon.h:63
Definition: CommandBufferGL.h:67
bool linearFilter
Definition: CommandBufferGL.h:74
bool blitDepthBuffer
Definition: CommandBufferGL.h:73
RenderTarget * dstTarget
Definition: CommandBufferGL.h:69
ViewportExtents dstExtents
Definition: CommandBufferGL.h:71
RenderTarget * srcTarget
Definition: CommandBufferGL.h:68
ViewportExtents srcExtents
Definition: CommandBufferGL.h:70
bool resolveMSAA
Definition: CommandBufferGL.h:72
Definition: CommandBufferGL.h:38
char * drawData
Definition: CommandBufferGL.h:44
MeshObject * mesh
Definition: CommandBufferGL.h:39
const Shader * shader
Definition: CommandBufferGL.h:41
Program * program
Definition: CommandBufferGL.h:42
size_t renderStateHash
Definition: CommandBufferGL.h:43
InstanceBuffer * inst
Definition: CommandBufferGL.h:40
Definition: CommandBufferGL.h:47
Program * program
Definition: CommandBufferGL.h:51
BufferBinding< VertexBuffer > vtxBind
Definition: CommandBufferGL.h:48
size_t renderStateHash
Definition: CommandBufferGL.h:52
char * drawData
Definition: CommandBufferGL.h:53
BufferBinding< IndexBuffer > idxBind
Definition: CommandBufferGL.h:49
const Shader * shader
Definition: CommandBufferGL.h:50
Definition: CommandBufferGL.h:56
RenderTarget * renderTarget
Definition: CommandBufferGL.h:57
ViewportExtents extents
Definition: CommandBufferGL.h:58
bool clearColors
Definition: CommandBufferGL.h:62
ViewportExtents scissor
Definition: CommandBufferGL.h:59
bool setRenderTarget
Definition: CommandBufferGL.h:60
Color clearColor
Definition: CommandBufferGL.h:64
bool clearDepth
Definition: CommandBufferGL.h:63
bool setScissor
Definition: CommandBufferGL.h:61
Definition: Graphics.h:59