Sweet Spot for # of vertices in Vertex Buffer vs. # of instances
Members - Reputation: 103
Posted 26 November 2012 - 10:33 AM
Crossbones+ - Reputation: 3017
Posted 27 November 2012 - 01:37 AM
In my experience drawing less than 1000 unique vertices: you're trashing GPU performance, even on ultra-low-end due to CPU being too busy dispatching.
That said, if all your models are static and/or guaranteed to be relatively coherent, pre-transform them and slap them in a single draw call (and therefore buffer), as long as you meet the required memory budget.
For your specific example however, instancing is absolutely necessary, and I would not really worry about it.
Moderators - Reputation: 28613
Posted 27 November 2012 - 02:34 AM
Crossbones+ - Reputation: 6956
Posted 27 November 2012 - 04:51 AM
But this does not consider the arrangement of objects in batches or instancing, at least it should be clear that a single render call for 2 tris is sub-optimal.
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
Crossbones+ - Reputation: 4859
Posted 27 November 2012 - 06:02 AM
Depending on what else you are rendering in the scene, it may even be that the optimal mix of vertices vs. instances could change depending on where you are within the scene... For example, if you are bound elsewhere in the pipeline, then you should go with Hodgeman's tip - save memory where you can. However, if you are bound at vertex assembly (which is very unlikely!) then you would have to profile and see what combo works best for you.
I hope that helps!
Jason Zink :: DirectX MVP
Direct3D 11 engine on CodePlex: Hieroglyph 3
Direct3D Books: Practical Rendering and Computation with Direct3D 11, Programming Vertex, Geometry, and Pixel Shaders
Articles: Dual-Paraboloid Mapping Article :: Parallax Occlusion Mapping Article (original):: Fast Silhouettes Article
Games: Lunar Rift