You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been profiling my game recently, and found that when adding elements to a SpriteBatch (for a custom particle engine), it frequently creates a lag spike. I can confirm that it happens on the frame in which a particle is added, but I can't tell why certain adds trigger this behavior, and some do not. You can see a profile here, where frames are regularly dropped, corresponding to when a particle (BatchElement) is added to the SpriteBatch:
Zooming into the offending frame, you can see that the SpriteBatch flush is creating a massive delay:
Once it gets into allocBuffer, I have no clue what's happening. But I don't feel that I'm using the SpriteBatch improperly. I'm just creating a pool of BatchElement subclasses. Then periodically adding them to the SpriteBatch. Then, after a time, removing them from the sprite batch and returning them to the pool.
The text was updated successfully, but these errors were encountered:
You can try to setup a GPU buffer cache with hxd.impl.Allocator.set(new hxd.impl.CacheAllocator())
This will permit the reuse of GPU buffers for dynamic draws.
I've been profiling my game recently, and found that when adding elements to a SpriteBatch (for a custom particle engine), it frequently creates a lag spike. I can confirm that it happens on the frame in which a particle is added, but I can't tell why certain adds trigger this behavior, and some do not. You can see a profile here, where frames are regularly dropped, corresponding to when a particle (BatchElement) is added to the SpriteBatch:
Zooming into the offending frame, you can see that the SpriteBatch flush is creating a massive delay:
Once it gets into allocBuffer, I have no clue what's happening. But I don't feel that I'm using the SpriteBatch improperly. I'm just creating a pool of BatchElement subclasses. Then periodically adding them to the SpriteBatch. Then, after a time, removing them from the sprite batch and returning them to the pool.
The text was updated successfully, but these errors were encountered: