Sign in to follow this  

Problem with merging small batches

This topic is 3306 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

I'm using particle system to present some of the VFX. Each instance of a particle system is treated as a render unit, which has its own vertex buffer, index buffer, texture, world matrix, etc. In most cases, a single particle system maintains less than 50 particles or 100 triangles at any given time, but needs a whole DrawIndexedPrimtives batch. So I end up with more than 2K DIP per frame when there is a large number of special effects. Then I come up with the idea to merge different instances of a particle system into one large render unit. Merging the VB and IB shouldn't be a problem, and also they use the same texture and other render states, the only difficulty is the different world matrices can not be unified. One possible solution, I manually apply those world transformations to corresponding particle systems before filling the vertex buffer, and submit identity as the world matrix to the graphic pipeline. Is this practical? Would someone offer any help? Thanks.

Share this post


Link to post
Share on other sites
You shouldn't have a problem with that approach as long as you specify the correct usage flags when creating the vertex buffer (D3DUSAGE_DYNAMIC and D3DUSAGE_WRITEONLY) and locking the vertex buffer (D3DLOCK_DISCARD). Make sure you profile with PIX and check for portions of a frame that are red in the graph...this indicates that the GPU is stalling while waiting for the CPU to modify a resource.

If you need to pursue alternatives, you might want to try using point sprites. Those should help performance, since your vertex can be considerably smaller (only one vertex per particle instead of 4). You can also try out some of the instancing techniques available in D3D9...humus has a sample you can check out on his website.

Share this post


Link to post
Share on other sites
Thank you for the suggestions. Is PIX the most frequently used profiler in practice? I have heard a lot of people talking about it.

Share this post


Link to post
Share on other sites

This topic is 3306 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this