Hello guys, i need your advice for something i want to implement.
My current render-loop looks like this:
update(deltaTime);
draw();
where update(deltaTime) updates all my objects and components on them.
Draw is a bit bigger and looks like this:
// Updates all data on the gpu and uniforms in descriptor-sets e.g. view-projection, lighting-params.
// Does a VkQueueWaitIdle to ensure data wont get updated until gpu has finished work with it.
updateGPUData();
// Record commands into command-buffers
recordCommandBuffers();
// Submit all command-buffers at once and present the swapchain-image finally on screen
submit();
The problem is obvious: The CPU spent a lot of time with VkQueueWaitIdle() at updateGPUData() before it can record command-buffers for the new frame.
My solution to that is to implement a system with doubled descriptor-sets and buffers and just update those who arent in use by the GPU, when the GPU uses the other one (like the backbuffer-principle).
What do you think of it? Or do you have ideas for a better place when to update the data on the gpu?
Thanks in Advance
SH