Skip to content

[Impeller] Vulkan sync validation: BlitPassVK::ResizeTexture layout transition is not synchronized with its blit #195598

Closed

Description

@gaaclarke

Steps to reproduce

With #195596 applied, build impeller_unittests with SwiftShader and run it with synchronization validation enabled:

./bin/et build -c ci/host_debug_arm64_tests //flutter/impeller:impeller_unittests
cd ../out/ci/host_debug_arm64_tests
VK_ICD_FILENAMES=$PWD/vk_swiftshader_icd.json \
VK_LAYER_PATH=$PWD/vulkan-data \
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
DYLD_LIBRARY_PATH=$PWD \
./impeller_unittests \
  --gtest_filter='Play/BlitPassTest.CanResizeTextures/Vulkan' \
  --enable_vulkan_sync_validation

Expected results

No synchronization hazards reported.

Actual results

ID Name: SYNC-HAZARD-WRITE-AFTER-WRITE
Trigger: vkCmdPipelineBarrier(): WRITE_AFTER_WRITE hazard detected. vkCmdPipelineBarrier performs image layout transition on the VkImage 0x…, which was previously written by vkCmdBlitImage.
No sufficient synchronization is present to ensure that a layout transition does not conflict with a prior write (VK_ACCESS_2_TRANSFER_WRITE_BIT) at VK_PIPELINE_STAGE_2_BLIT_BIT.

Analysis

After vkCmdBlitImage, BlitPassVK::ResizeTexture moves the destination to eShaderReadOnlyOptimal with src_access = {} and src_stage = eTopOfPipe. Because of that, the layout transition isn't ordered after the blit's transfer write. The barrier should probably use src_access = eTransferWrite and src_stage = eTransfer.

Play/BlitPassTest.CanResizeTextures/Vulkan is commented out of the sync validation shard (#195502) until this is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions