-
Notifications
You must be signed in to change notification settings - Fork 269
Description
I'm implementing an LOD fade effect in vsgCs. A fade in/out flag and value in a tile's uniform buffer data is used to threshold against a blue noise texture map. Unfortunately there is a visible flicker when the transfer begins. I haven't been able to capture the flickering frame in RenderDoc; I think the problem is hidden by the recording layer. But, I'm pretty sure that the issue is a data race in the fade values.
The Vulkan sychronization layer produces a spew of errors like:
[0] 0x220dc70, type: 4, name: NULL
SYNC-HAZARD-WRITE-RACING-READ(ERROR / SPEC): msgNum: -860391127 - Validation Error: [ SYNC-HAZARD-WRITE-RACING-READ ] Object 0: handle = 0x220dc70, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0xccb77929 | vkQueueSubmit: Hazard WRITE_RACING_READ for entry 0, VkCommandBuffer 0x28c6a30[], Recorded access info (recorded_usage: SYNC_COPY_TRANSFER_WRITE, command: vkCmdCopyBuffer, seq_no: 5, reset_no: 1453). Access info (prior_usage: SYNC_FRAGMENT_SHADER_UNIFORM_READ, read_barriers: VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT, queue: VkQueue 0x2108000[], submit: 4483, batch: 0, batch_tag: 70343, command: vkCmdDrawIndexed, seq_no: 18, command_buffer: VkCommandBuffer 0x2729650[], reset_no: 1493).
Objects: 1
[0] 0x220dc70, type: 4, name: NULL
The source of the bug is pretty obvious (to me 😎 ). In src/vsg/TransferTask.cpp:
submitInfo.waitSemaphoreCount = 0;
submitInfo.pWaitSemaphores = nullptr;
submitInfo.pWaitDstStageMask = nullptr;
The transfer task submission does not wait for the rendering on the graphics queue to complete. The buffers in question are single buffered, so this submission should wait for the the relevant stages to complete.