How to implement swap of buffers? #1054
-
What im trying to do:
Please, give me a hint how to do it properly in VSG-style way. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Personally I'd use vertex array data per tile, but have those vertex arrays use shared vk/vsg::Buffer. The VSG is already capable of doing this, much of it transparently. Doing this will allow you to create/update vertex array data per tile without worry about coordinating data structures across tiles, and if you do end up need to use more vsg::Buffer then these can be used as well. The VSG already has a vsg::PagedLOD and vsg::DatabasePager that support database pager of whole earth databases, as there is Tim's work on vsgCs which adds 3D Tiles support. These both use vertex arrays/textures per tile and let the underlying support for sharing vsg::Buffer between multiple vertex arrays/uniforms - vsg::BufferInfo couples the CPU array data with the vk/vsg::Buffer and the location that that vsg::Buffer, and vsg::MemoryBufferPools is used to set up the BufferInfo to share vk/vsg::Buffer. -- Is there a particular terrain algorithm you are trying to implement? |
Beta Was this translation helpful? Give feedback.
Dynamic data in the VSG is handled via the vsg::TransferTask, this multi-buffers the data and handles all the transfer and synchronization for you. You just need to set the vsg::Data::properties.dataVariance to DYNAMIC_DATA and call data->dirty() each time the data is updated. Have a look at the vsgdynamic* examples in vsgExamples:
https://github.com/vsg-dev/vsgExamples/tree/master/examples/state
I have written up this topic here on this forum and the old vsg-users googlegroup so have a look through the archives for more discussion on this topic.
My plan is to keep refining vsg::DataTransfer to handle parts of the compile traversal work, and handle one of copying of data rather than relyi…