vkgears synchronization validation errors
vkgears has a number of problems with synchronization as it seems
$ cat vk_layer_settings.txt
khronos_validation.enables = VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,VALIDATION_CHECK_ENABLE_SYNCHRONIZATION_VALIDATION_QUEUE_SUBMIT,VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT,VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_ALL
khronos_validation.report_flags = debug,info,warn,error
$ VK_LOADER_LAYERS_ENABLE='*validation' ./build-dir/src/vulkan/vkgears
...
Objects: 1
[0] 0x301e6c0000000022, type: 9, name: NULL
SYNC-HAZARD-READ-AFTER-WRITE(ERROR / SPEC): msgNum: -455515022 - Validation Error: [ SYNC-HAZARD-READ-AFTER-WRITE ] Object 0: handle = 0x301e6c0000000022, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4d96472 | vkCmdDraw: Hazard READ_AFTER_WRITE for VkBuffer 0x301e6c0000000022[] in VkCommandBuffer 0x127d4d0[], VkPipeline 0xc4f3070000000021[], and VkDescriptorSet 0xb097c90000000027[], type: VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, binding #0 index 0. Access info (usage: SYNC_VERTEX_SHADER_UNIFORM_READ, prior_usage: SYNC_COPY_TRANSFER_WRITE, write_barriers: 0, command: vkCmdUpdateBuffer, seq_no: 1, reset_no: 15).
Objects: 1
[0] 0x301e6c0000000022, type: 9, name: NULL
SYNC-HAZARD-READ-AFTER-WRITE(ERROR / SPEC): msgNum: -455515022 - Validation Error: [ SYNC-HAZARD-READ-AFTER-WRITE ] Object 0: handle = 0x301e6c0000000022, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4d96472 | vkCmdDraw: Hazard READ_AFTER_WRITE for VkBuffer 0x301e6c0000000022[] in VkCommandBuffer 0x127d4d0[], VkPipeline 0xc4f3070000000021[], and VkDescriptorSet 0xb097c90000000027[], type: VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, binding #0 index 0. Access info (usage: SYNC_VERTEX_SHADER_UNIFORM_READ, prior_usage: SYNC_COPY_TRANSFER_WRITE, write_barriers: 0, command: vkCmdUpdateBuffer, seq_no: 1, reset_no: 15).
Objects: 1
[0] 0x301e6c0000000022, type: 9, name: NULL
SYNC-HAZARD-WRITE-AFTER-READ(ERROR / SPEC): msgNum: 929810911 - Validation Error: [ SYNC-HAZARD-WRITE-AFTER-READ ] Object 0: handle = 0x4327f0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x376bc9df | vkQueueSubmit: Hazard WRITE_AFTER_READ for entry 0, VkCommandBuffer 0x127d4d0[], Recorded access info (recorded_usage: SYNC_IMAGE_LAYOUT_TRANSITION, command: vkCmdBeginRenderPass, seq_no: 2,renderpass: VkRenderPass 0xead9370000000008[], reset_no: 15). Access info (prior_usage: SYNC_PRESENT_ENGINE_SYNCVAL_PRESENT_ACQUIRE_READ_SYNCVAL, read_barriers: VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT|VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT, , batch_tag: 277, vkAcquireNextImageKHR aquire_tag:277: VkSwapchainKHR 0x210d07000000003a[], image_index: 2image: VkImage 0x59ffe0000000003d[]).
Objects: 1
[0] 0x4327f0, type: 4, name: NULL
...
Also there are some best practices errors
...
Objects: 1
[0] 0x44df00, type: 1, name: NULL
UNASSIGNED-BestPractices-vkCreateSwapchainKHR-surface-not-retrieved(WARN / SPEC): msgNum: -373436918 - Validation Warning: [ UNASSIGNED-BestPractices-vkCreateSwapchainKHR-surface-not-retrieved ] Object 0: handle = 0x112c7e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xe9bdce0a | vkCreateSwapchainKHR() called before getting surface format(s) from vkGetPhysicalDeviceSurfaceFormatsKHR().
Objects: 1
[0] 0x112c7e0, type: 3, name: NULL
UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueCountHigherThanAttachmentCount(WARN / SPEC): msgNum: -786847254 - Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueCountHigherThanAttachmentCount ] Object 0: handle = 0x112c7e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xd119a9ea | This render pass has VkRenderPassBeginInfo.clearValueCount > VkRenderPassCreateInfo.attachmentCount (3 > 2) and as such the clearValues that do not have a corresponding attachment will be ignored.
Objects: 1
[0] 0x112c7e0, type: 3, name: NULL
UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueCountHigherThanAttachmentCount(WARN / SPEC): msgNum: -786847254 - Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueCountHigherThanAttachmentCount ] Object 0: handle = 0x112c7e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xd119a9ea | This render pass has VkRenderPassBeginInfo.clearValueCount > VkRenderPassCreateInfo.attachmentCount (3 > 2) and as such the clearValues that do not have a corresponding attachment will be ignored.
...
Synchronization validation is very useful, I suggest adding vk_layers_settings.txt
to catch this in the future.
You can also set features with env variable VK_LAYER_ENABLES
, but you can't set report_flags with env variable.