drawing many particles in groups

Started by
6 comments, last by jamesw 17 years, 11 months ago
so Im making this particle system and its working pretty nice. However I came across a tutorial in which they split the particles up into groups of size dw_flush (just some number). They would fill a vertex buffer up with that many particles, render them, and then continue from there until they hit that number again. Is there any performance reason for doing this instead of just filling the buffer and rendering them all at once?
Advertisement
i think render all at once is better for performance

maybe the tutorial is a simple version, can you post the adresse of it ?
Killan - www.daaboo.net
http://www.codesampler.com/source/dx9_particle_system.zip
My guess is the person who wrote the tutorial did some performance tests and found the optimal batch size for their system. It is possible that they picked the size at random, but it's more likely that they have a specific reason for doing this (i.e. the number correlates to the width of their graphics card bus, and thus they dump as much as the bus can take, no more, no less)
so the only way to find the best number is through experimenting? theres no value u can get from d3d?
MaxPrimitiveCount in the D3DCAPS9 structure ?

I think that gives the max number of primitives per draw call. I may be wrong though.
yea thats probably a good reason to have multiple draw calls... lol
The reason Kevin (the Codesampler guru) wrote the sample that way, locking with the NO_OVERWRITE flag and writing dw_flush particles, was to show how you can update a buffer without causing a stall or flush. You can probably get similar performance by using a dynamic buffer and lock with the DISCARD flag, since that won't cause a stall or flush either. Both ways use extra memory, but using the DISCARD lock causes the driver to manage the extra memory, instead of the application.

This topic is closed to new replies.

Advertisement