🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

[D3D12] Pool of vertex buffers for sprite and line batch?

Started by
5 comments, last by ddlox 3 years, 6 months ago

Hello everybody!
Using Direct3D 11 you could use one dynamic vertex buffer for each pass of your sprite and line batch.
Using Direct3D 12 this is not the case anymore because you need to update the dynamic vertex buffer on your second pass of batch but this vertex buffer was not yet used for the rendering.
Is the best approach on Direct3D 12 to use a pool of vertex buffer which check if there is no free vertex buffer for this size of batch and create a new vertex buffer on the fly if it's the case?
Create a dynamic vertex buffer only require the device so you can create on the fly without issue and then use the map/unmap on it during your second pass of batch, but is it the good approach?
Thanks!

Advertisement

Alundra said:
Is the best approach on Direct3D 12 to use a pool of vertex buffer which check if there is no free vertex buffer for this size of batch and create a new vertex buffer on the fly if it's the case? Create a dynamic vertex buffer only require the device so you can create on the fly without issue and then use the map/unmap on it during your second pass of batch, but is it the good approach?

what exact problem have u found when u do it this way in dx12?

I have two passes of batch of lines for example and since that uses the same vertex buffer but the two passes use different point vertices that gives an issue on the rendering at the final execution of the command list. With D3D11 it was not an issue because apparently D3D11 handle this case automatically or hide a performance issue using one vertex buffer.

create a 2nd vb, descriptor and view;

fill vb, set view on the 2nd slot;

execute;

Your opinion is then the best approach in D3D12 is to have a pool of vertex buffer and take a free one from this pool and if no one is free create one on the fly. Basically having only a cost on performance when one is necessary and creating a completely new vertex buffer on this case.

correct ?

This topic is closed to new replies.

Advertisement