Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] fix render pass depth descriptor.#51031

Merged
auto-submit[bot] merged 6 commits intoflutter:mainfrom
jonahwilliams:fix_stc
Feb 28, 2024
Merged

[Impeller] fix render pass depth descriptor.#51031
auto-submit[bot] merged 6 commits intoflutter:mainfrom
jonahwilliams:fix_stc

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Feb 28, 2024

Depth+stencil should be treated as the same attachment. Adding more than one d/s attachment in the render pass descriptor seems to be confusing swiftshader.

@bdero

This fixes things for me locally, lets let CI take a spin

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #51031 at sha 78f27aa

Copy link
Contributor

@bdero bdero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (once StC is flipped back off)!

@jonahwilliams
Copy link
Contributor Author

Tested: is covered by the tests in #50856 not failing?

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #51031 at sha 8f5105f

@jonahwilliams
Copy link
Contributor Author

hmm, what did I do wrong. I changed more stuff that I perhaps shouldn't have

}

if (desc.HasStencilAttachmentDescriptors()) {
} else if (desc.HasStencilAttachmentDescriptors()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, won't this just turn off the stencil attachment and make legacy clips + StC not work anywhere?

I think the depth and stencil are separately configurable attachments even if they share a texture. Were you getting validation errors before this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC Depth+Stencil are the same attachment in Vulkan. Calling SetStencilAttachment blows away the value of SetDepthStencilAttachment at least in our code

RenderPassBuilderVK& RenderPassBuilderVK::SetDepthStencilAttachment(
    PixelFormat format,
    SampleCount sample_count,
    LoadAction load_action,
    StoreAction store_action) {
  vk::AttachmentDescription desc;
  desc.format = ToVKImageFormat(format);
  desc.samples = ToVKSampleCount(sample_count);
  desc.loadOp = ToVKAttachmentLoadOp(load_action);
  desc.storeOp = ToVKAttachmentStoreOp(store_action);
  desc.stencilLoadOp = desc.loadOp;    // Not separable in Impeller.
  desc.stencilStoreOp = desc.storeOp;  // Not separable in Impeller.
  desc.initialLayout = vk::ImageLayout::eGeneral;
  desc.finalLayout = vk::ImageLayout::eGeneral;
  depth_stencil_ = desc;
  return *this;
}

RenderPassBuilderVK& RenderPassBuilderVK::SetStencilAttachment(
    PixelFormat format,
    SampleCount sample_count,
    LoadAction load_action,
    StoreAction store_action) {
  vk::AttachmentDescription desc;
  desc.format = ToVKImageFormat(format);
  desc.samples = ToVKSampleCount(sample_count);
  desc.loadOp = vk::AttachmentLoadOp::eDontCare;
  desc.storeOp = vk::AttachmentStoreOp::eDontCare;
  desc.stencilLoadOp = ToVKAttachmentLoadOp(load_action);
  desc.stencilStoreOp = ToVKAttachmentStoreOp(store_action);
  desc.initialLayout = vk::ImageLayout::eGeneral;
  desc.finalLayout = vk::ImageLayout::eGeneral;
  depth_stencil_ = desc;
  return *this;
}

So as long as depth/stencil have the same load/store it should work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we should fix this builder so that it doesn't force us to wipe away depth-specific options when the stencil is set. We don't need to do it right at this moment, but it's an easy fix and will probably bite us later if we don't fix it.

@jonahwilliams
Copy link
Contributor Author

@bdero PTAL!


stencil->load_action = LoadAction::kClear;
stencil->store_action = StoreAction::kDontCare;
depth->load_action = LoadAction::kClear;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was missing.

Copy link
Contributor

@bdero bdero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

stencil->store_action = StoreAction::kDontCare;
depth->load_action = LoadAction::kClear;
depth->store_action = StoreAction::kDontCare;
pass_target_.target_.SetDepthAttachment(depth);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can come back around later and try to clean some of the stuff up with the VK pass builder, but I think this is good to unblock.

The depth attachment is already set above, but this might be order sensitive because RenderPassBuilderVK::SetStencilAttachment sets the depth load/store to eDontCare, whereas the depth call doesn't.

@bdero
Copy link
Contributor

bdero commented Feb 28, 2024

Oh wait a second... All the goldens just resolved on #50856 without this patch.

@jonahwilliams
Copy link
Contributor Author

I think this patch fixes the tofu issue though. With the sleep added I can consistently repro the failure before this patch.

@bdero
Copy link
Contributor

bdero commented Feb 28, 2024

Actually, the golden test isn't getting marked resolved in #50856, so I'm pretty sure I'm just running into the force push issue and there are invisible golden differences which are just not showing up. So I'd say merge away.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 28, 2024
@auto-submit auto-submit bot merged commit fa5b02a into flutter:main Feb 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 28, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 29, 2024
flutter/engine@455c814...10331db

2024-02-28 [email protected] Roll Fuchsia Linux SDK from T1xAi_ww_mWEiDkVN... to ujOkbeYbrC8loPbfR... (flutter/engine#51066)
2024-02-28 [email protected] Roll abseil-cpp to 1db3bdd4eb208bef55c77f22aa94991e52225230 (flutter/engine#51062)
2024-02-28 [email protected] Roll Dart SDK from 7896a944fe67 to fdf4a62bd07b (1 revision) (flutter/engine#51064)
2024-02-28 [email protected] [Impeller] Mark subpass framebuffer fetch tests as unsupported on GLES (flutter/engine#50982)
2024-02-28 [email protected] Roll Skia from 93f245da0097 to 27171d6a9205 (1 revision) (flutter/engine#51063)
2024-02-28 [email protected] [Impeller] fix render pass depth descriptor. (flutter/engine#51031)
2024-02-28 [email protected] Make Skia object ostream operators work with unit tests (flutter/engine#51041)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from T1xAi_ww_mWE to ujOkbeYbrC8l

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants