Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Optimize performance of particle system #154

Closed
LukasKalbertodt opened this issue Aug 2, 2016 · 1 comment
Closed

Optimize performance of particle system #154

LukasKalbertodt opened this issue Aug 2, 2016 · 1 comment

Comments

@LukasKalbertodt
Copy link
Member

The particle system can be improved a lot. This is an unordered list of things I noticed:

  • the small vertex buffer for the particle quad should be created only once, instead of every draw() call
  • the bigger dynamic vertex buffer shouldn't be recreated every draw() call: it's filled with a buffer map afterwards anyway! So just use the old buffer.
  • currently, you create the Vec for the dynamic vertex buffer from the particle list first, then you simulate all particles and change the position in both vectors! First simulate your particles and fill the vertex buffer afterwards with the final positions
  • we could use two dynamic vertex buffers to use "double buffering" ... I've read this can give quite a performance boost, but this is rather complicated and needs to be measured

Apart from all this: you should really try to make your code more readable and shorter. Strive for the shortest, most expressive, most self-explanatory code that solves your task at hand.

@LukasKalbertodt
Copy link
Member Author

LukasKalbertodt commented Aug 4, 2016

Attempt to fix this in #157 and #161 ... not quite sure how much performance was gained, but I will close this anyway.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant