Skip to content

Commit b00ed1f

Browse files
authored
[vulkan]: Adds depth/stencil synchronization for subpasses (flutter#195689)
> [!NOTE] > This depends on flutter#195596 to add the testing infrastructure This PR adds dependencies to vulkan subpasses when a depth/stencil buffer is used. It was found to be a problem when enabling the synchronization validation layers. fixes flutter#195599 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent e516485 commit b00ed1f

2 files changed

Lines changed: 24 additions & 16 deletions

File tree

‎engine/src/flutter/impeller/renderer/backend/vulkan/render_pass_builder_vk.cc‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,22 @@ vk::UniqueRenderPass RenderPassBuilderVK::Build(
202202
vk::AccessFlagBits::eColorAttachmentWrite;
203203
deps[0].dstStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
204204
deps[0].dstAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
205+
if (depth_stencil_.has_value()) {
206+
// A depth/stencil attachment (for example a cached stencil buffer shared
207+
// between passes) may have been written by an earlier render pass. That
208+
// pass's depth/stencil writes and storeOp happen in the fragment test
209+
// stages, so they must be included in the source scope. This pass's
210+
// layout transition and loadOp also access the attachment in the fragment
211+
// test stages, so they must be included in the destination scope.
212+
constexpr vk::PipelineStageFlags kFragmentTestStages =
213+
vk::PipelineStageFlagBits::eEarlyFragmentTests |
214+
vk::PipelineStageFlagBits::eLateFragmentTests;
215+
deps[0].srcStageMask |= kFragmentTestStages;
216+
deps[0].srcAccessMask |= vk::AccessFlagBits::eDepthStencilAttachmentWrite;
217+
deps[0].dstStageMask |= kFragmentTestStages;
218+
deps[0].dstAccessMask |= vk::AccessFlagBits::eDepthStencilAttachmentRead |
219+
vk::AccessFlagBits::eDepthStencilAttachmentWrite;
220+
}
205221
deps[0].dependencyFlags = kSelfDependencyFlags;
206222

207223
// Self dependency for reading back the framebuffer, necessary for

‎engine/src/flutter/testing/run_tests.py‎

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -226,27 +226,19 @@ def vulkan_validation_env(build_dir: str) -> typing.Dict[str, str]:
226226
# 'Play/RendererTest.CanGenerateMipmaps/Vulkan',
227227
'Play/TypographerTest.GlyphAtlasTextureWillGrowTilMaxTextureSize/Vulkan',
228228
# Render passes, offscreen targets, MSAA, depth/stencil and subpasses.
229-
## TODO(https://github.com/flutter/flutter/issues/194987):
230-
## RenderPassBuilderVK depth/stencil loadOp.
231-
# 'Play/RendererTest.CanRenderToTexture/Vulkan',
229+
'Play/RendererTest.CanRenderToTexture/Vulkan',
232230
'Play/RendererTest.CanSepiaToneWithSubpasses/Vulkan',
233231
'Play/EntityPassTargetTest.SwapWithMSAAImplicitResolve/Vulkan',
234232
# Compute.
235233
'Compute/ComputeTest.MultiStageInputAndOutput/Vulkan',
236234
# End-to-end rendering through Aiks/DisplayList.
237-
## TODO(https://github.com/flutter/flutter/issues/194987):
238-
## RenderPassBuilderVK depth/stencil loadOp.
239-
# 'Play/AiksTest.CanRenderImage/Vulkan',
240-
# 'Play/AiksTest.CanRenderClips/Vulkan',
241-
# 'Play/AiksTest.CanRenderTextFrame/Vulkan',
242-
# 'Play/AiksTest.CanRenderBackdropBlur/Vulkan',
243-
# 'Play/AiksTest.CanRenderAdvancedBlendColorFilterWithSaveLayer/Vulkan',
244-
## TODO(https://github.com/flutter/flutter/issues/194987):
245-
## RenderPassBuilderVK depth/stencil loadOp.
246-
## TODO(https://github.com/flutter/flutter/issues/195599):
247-
## RenderPassBuilderVK depth/stencil storeOp.
248-
# 'Play/AiksTest.CanRenderNestedBackdropBlur/Vulkan',
249-
# 'Play/AiksTest.GaussianBlurBackdropTinyMipMap/Vulkan',
235+
'Play/AiksTest.CanRenderImage/Vulkan',
236+
'Play/AiksTest.CanRenderClips/Vulkan',
237+
'Play/AiksTest.CanRenderTextFrame/Vulkan',
238+
'Play/AiksTest.CanRenderBackdropBlur/Vulkan',
239+
'Play/AiksTest.CanRenderAdvancedBlendColorFilterWithSaveLayer/Vulkan',
240+
'Play/AiksTest.CanRenderNestedBackdropBlur/Vulkan',
241+
'Play/AiksTest.GaussianBlurBackdropTinyMipMap/Vulkan',
250242
]
251243

252244

0 commit comments

Comments
 (0)