Support for incidental data updates checked in #1142
robertosfield
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
The VSG has had support for dynamic data updates for while now, essentially all you need to is in scene graph setup:
This works well and is easy to use, but there are instances where applications may occasionally want to dynamically update data rather than on every frame, and if there are thousands of these types of data elements that "might" need updating the current mechanism is overkill and can lead to checking many data objects that almost never get updated.
In extreme usage cases this can lead to a high CPU overhead just for the privilege of possibly updating some of the data some of the time. While "Vulkan made easy" is the tag line for the vsg-dev account, performance is also critical so this has been an open issue since I originally wrote vsg::TransferTask.
This morning I updated TransferTask so that users can manually assign vsg:BufferInfo and vsg::ImageInfo to the vsg::TransferTask and have it for the next frame transfer the associated data, then remove the BufferInfo/ImageInfo for the list of objects to check if they need transferred. The mechanism allows you to update data and then tell the TransferTask that it needs to do a one off transfer the data.
To test the mechanism I also updated the vsgdynamicvertex example so that if you pass it the --static command line option it'll use dataVariance of STATIC_DATA and manually assign the associated BufferInfo to ensure it's transferred. This example still does this update on every frame so behaves the same the DYNAMIC_DATA approach so a cheaper option for this particular example, but at least it illustrates how it's done.
Form the vsgdynamicvertex example the new section in the main loop to do this assignment is:
This is all extra code you need if you don't utilize the standard DYANMIC_DATA mechanism, but the key is enables incidental updates where the overhead is only paid when you require the transfer.
The new code that handles this usage case also handles the case where a BufferInfo/ImageInfo has dataVariance of DYNAMIC_DATA which is then changed to STATIC_VARIANCE, so it'll remove these entries for the list it manages automatically as well.
The changes required for this new feature is checked into VSG and vsgExamples master with these respective PRs:
Longer term I am thinking about having the vsg::CompileManager/CompileTraversal/Context leverage TransferTask to copy data rather than have this done within vsg::Context, and the changes checked into this morning are small part of this jigsaw.
Beta Was this translation helpful? Give feedback.
All reactions