Skip to content

Possible false positive for depth attachments and dynamic rendering #10924

@SaschaWillems

Description

@SaschaWillems

I'm currently running into the following validation error with the latest SDK when doing dynamic rendering:

validation layer: type { Validation } msg: vkQueueSubmit(): WRITE_AFTER_WRITE hazard detected. vkCmdPipelineBarrier2 (from VkCommandBuffer 0x121daa1bae0 submitted on the current VkQueue 0x121959d22f0) writes to VkImage 0xf000000000f, which was previously written by vkCmdEndRendering (from VkCommandBuffer 0x121da9f4990 submitted on VkQueue 0x121959d22f0).
No sufficient synchronization is present to ensure that a layout transition does not conflict with a prior write (VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT) at VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT.
Validation Error: [ SYNC-HAZARD-WRITE-AFTER-WRITE ] | MessageID = 0x5c0ec5d6
(Warning - This VUID has now been reported 10 times, which is the duplicate_message_limit value, this will be the last time reporting it).
vkQueueSubmit(): WRITE_AFTER_WRITE hazard detected. vkCmdPipelineBarrier2 (from VkCommandBuffer 0x121da9f4990 submitted on the current VkQueue 0x121959d22f0) writes to VkImage 0xf000000000f, which was previously written by vkCmdEndRendering (from VkCommandBuffer 0x121daa1bae0 submitted on VkQueue 0x121959d22f0).
No sufficient synchronization is present to ensure that a layout transition does not conflict with a prior write (VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT) at VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT.
Objects: 2
    [0] VkQueue 0x121959d22f0
    [1] VkCommandBuffer 0x121da9f4990

With the following barrier:

        vk::ImageMemoryBarrier2 depthBarrier = {
            .srcStageMask = vk::PipelineStageFlagBits2::eTopOfPipe,
            .srcAccessMask = {},
            .dstStageMask = vk::PipelineStageFlagBits2::eEarlyFragmentTests | vk::PipelineStageFlagBits2::eLateFragmentTests,
            .dstAccessMask = vk::AccessFlagBits2::eDepthStencilAttachmentRead | vk::AccessFlagBits2::eDepthStencilAttachmentWrite,
            .oldLayout = vk::ImageLayout::eUndefined,
            .newLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal,
            .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
            .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
            .image = depthImage,
            .subresourceRange = {
                .aspectMask = vk::ImageAspectFlagBits::eDepth,
                .baseMipLevel = 0,
                .levelCount = 1,
                .baseArrayLayer = 0,
                .layerCount = 1
            }
        };
        vk::DependencyInfo depthDependencyInfo = {
            .dependencyFlags = {},
            .imageMemoryBarrierCount = 1,
            .pImageMemoryBarriers = &depthBarrier
        };
        commandBuffers[currentFrame].pipelineBarrier2(depthDependencyInfo);

(from our Khronos Tutorial).

Same happens in my own samples, no matter how I adjust that barrier.

Oddly removing that barrier all along also gets rid of the validation layer error. That seems kinda weird and might be an issue with the layers?

Metadata

Metadata

Assignees

Labels

SynchronizationSynchronization Validation Object Issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions