Hey guys, I wanted to get some advice on how you implement draw call merging. As of right now I handle batching dynamically. Elements are submitted to the rendering pipeline using a "CRenderObject".. this contains information such as the constant buffer holding the world transform/etc.. the vertex/index buffers... the material.. the drawcall values, i.e firstIndexID...indexCount..etc, and any render flags necessary for shader passes. There are different Render Objects that have different rendering batching policies. For Example.. a CStaticMeshRenderObject is batched based on the source mesh, the submesh index, the material, and the render flags... For each generated batch, a CStaticMeshRenderObject allocates memory out of the structured buffer pool and fills the data with world transform info.. and etc. a CSkinnedMeshRenderObject is batched based on the same parameters of a CStaticMeshRenderObject.. but a CSkinnedRenderObject fills the structured buffer with skinning data. a CSpriteParticleRenderObject is batched based on material and render flags... and it fills dynamic vertex and index buffers for rendering.. and etc...
My Rendering pipeline is currently :
Perform Frustum Culling
For Each visible Scene Object
- Collect all CRenderObjects
For each rendering pass
- For Each CRenderObject that supports batching ,
- Batch based on per CRenderObject heuristic
- For Each batched group of CRenderObjects , allocate the required data for the batch.
Lock all global pools for rendering
For each rendering pass
- generate command lists
- etc...
The problem with this method is that it's done every frame, I wanted to know if anyone has a better method for drawcall batching that supports things such as skeletal mesh instancing. I know that ACU uses gpu instancing for their Crowd System.. but I don't know if they do it at higher level, or more like my low level implementation. Thank you.