Skip to content

comp_renderer: Improve synchronization

Lubosz Sarnecki requested to merge lubosz/monado:improve-sync into master

This series of patches removes redundant WaitIdle calls on the queue and the device. For one they were redundant since synchronization was already in place by VkSemaphores for vkAcquireNextImageKHR and vkQueuePresentKHR. For the remaining calls only one additional vkDeviceWaitIdle was required when the swap chain was destroyed, in favor of doing it every draw call. In addition the main vkQueueSubmit is now synchronized with one VkFence per command buffer, so for every swap chain image. This is pretty standard behaviour, as it is done for example in renderers as vkcube. Another patch removes redundancy since we don't need one buffer counter for frame and command buffers, since their size is equal. This now also applies to fences.

I considered moving the 3 variables (VkCommandBuffer, VkFence, VkFramebuffer) into a separate struct e.g. comp_render_buffer as it is done in vkcube and gulkan, but I preferred to leave it as is to utilize Vulkan's functions using an array of command buffers. Also the reinitialization of the 3 is asynchronous.

The patch set was tested on radv, amdvlk, NVIDIA and Intel without producing validation errors. I can confirm that the validation indeed catches wrongfully removed vkDeviceWaitIdle calls, which happened during development.

Edited by Lubosz Sarnecki

Merge request reports