How to update DescriptorSet? #828
Replies: 1 comment
-
With Vulkan you don't need to call vkUpdateDescriptorSets when you just want to update the data, instead you just update the data on the GPU. The VSG has built in support for this and several VSG examples illustrate how it's done. The vsgclip is a good place to look at. https://github.com/vsg-dev/vsgExamples/blob/master/examples/state/vsgclip/vsgclip.cpp After creating your data you set the properties.dataVariance to DYNAMIC_DATA:
The VSG has a vsg::TransferTask class the does the syncing of data on the CPU with the associated data on the GPU on each frame just before rendering, the compile traversal locates all the data it needs to track and assigns them to the TransferTask. It also handles multi-buffering of the data needing to be copied to avoid issues with the different frames of updates being used on the GPU at the wrong time. Do a search of dataVariance in the vsgExamples and VulkanSceneGraph codebases to see all the places it's used. It's used for updating uniforms, vertex data and texture data, each of these types od data are treated equally so there's no need to learn different mechanisms for uniforms through to textures. |
Beta Was this translation helpful? Give feedback.
-
I have a custom shader which has a uniform which is binded with a DescriptorSet from CPU.
There are some examples code, e.g., phongMaterials are created this way and pushed to shader using DescriptorSet. But I don't know how to update this data at runtime without rebuild graphicspipeline. My hope was that I can just modify the data on CPU and use vkUpdateDescriptorSets() to update it on GPU. Is this possible in VSG?
Thanks,
Cam
Beta Was this translation helpful? Give feedback.
All reactions