Advertisement Jump to content
Sign in to follow this  

DirectX/SharpDX Render Batching

This topic is 708 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[Originally posted in Beginners, moved to DirectX and XNA]


I'm toying around with a hobby engine of mine and I was looking at implementing batching to reduce the number of calls to the device and context.


I have several classes that assemble to represent a single entity in the game world. My thought for breaking them down into batches for rendering goes something like this:


1. Frustum cull Entities (with the help of a QuadTree)

2. Sort all entities by their Shader type (IShader interface with many different implementations for various shaders), Place any semi transparent objects in a separate list

3. Sort entities sharing the same Shader by their Mesh (ending up with a Dictionary<IShader, Dictionary<Mesh, List<Entity>>>

4. For each Shader apply it to the pipeline

5. For each key of Dictionary<Mesh, List<Entity>> bind that mesh to the pipeline

6. For each Entity in the list for that Mesh, apply the transformation matrix and any other instance data (animations, etc)

7. Draw the Mesh

8. Repeat 5-7 for each Entity

9. Repeat 4-8 for each Shader

10. Z order the semi transparent list

11. Render the semi transparent list


One pitfall that comes to mind with this system are Mesh's that have submeshes that use different shaders.


My question is, does this sound at all efficient and further, is this close to what is usually done to batch draw calls in DirectX11/SharpDX?


Thank you.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!