-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Impeller] Implement framebuffer-fetch via subpasses in Vulkan without extensions. #50154
Conversation
I was able to reproduce and fix the clips breaking as reported in #49787 (comment). It was due to a stencil being cleared that should no longer be an issue in this patch. I haven't been able to reproduce the issue reported on a Samsung Android phone because I don't have access to one. |
Awesome, checking this out - quick pass with a few questions. |
if (supports_framebuffer_fetch) { | ||
vk_usage |= vk::ImageUsageFlagBits::eInputAttachment; | ||
} | ||
vk_usage |= vk::ImageUsageFlagBits::eInputAttachment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this only for color attachments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use subpassLoad on any image. If a depth-stencil image is set in the descriptor, that will work too as long as there is sufficient synchronization. So, no. Though I just removed this code since supports_framebuffer_fetch will always be true in this code.
This is working for me locally with a pixel and an older galaxy |
return pipeline; | ||
} | ||
|
||
TEST_P(RendererTest, CanSepiaToneWithSubpasses) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK (@gaaclarke correct me) but this test file doesn't have goldens right? Do we have sufficient golden coverage in aiks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the goldens happen in AiksTest, not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Do we have goldens coverage for any advanced blend already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we depend on host testing, I'm not sure if anything in our matrix supports fb fetch. Metal desktop only supports it on arm.
Maybe since this path is unconditional swiftshader will still use it and the advanced blends will be covered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unconditionality of these tests mean that these will only run on devices that support framebuffer-fetch. I forgot to add a skip otherwise. But yeah, on CI, these tests will only work on Vulkan and ARM Macs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but these tests as written are playground tests that aren't golden, so they don't run on CI AFAIK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may run, but the test is more like ["does it compile", "does it run without crashing"]. I'm not sure about "passes validation" and we know "results are correct" isn't checked. Making sure that impeller_golden_tests
is executing it makes sure we have the later 2 checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really exciting!
This comment was marked as outdated.
This comment was marked as outdated.
…t extensions. * Subpasses are not exposed in the HAL and the need for subpasses in Vulkan can be determined based on the presence and use of input-attachments in the shaders. This information is already reflected by the compiler. Because of this, all references to subpasses have been removed from APIs above the HAL. * `RenderPassBuilderVK` is a lightweight object used to generate render passes to use either with the pipelines (compat, base, or per-subpass) or during rendering along with the framebuffer. Using the builder also sets up the right subpass dependencies. As long as the builder contains compatible attachments and subpass counts, different subpasses stamped by the builder (via the `Build` method) are guaranteed to be compatible per the rules in the spec. * Pass attachments are now in the `eGeneral` layout. There was no observable difference in performance when manually inserting the right transitions. Except, a lot of transitions needed to be inserted. If we need it, we can add it back in short order. I wouldn't be averse to adding it if reviewers insist. * Additional pipeline state objects need not be created as the sub-pass self-dependencies are sufficient to setup the render-pass. * Speaking of the `rasterization_order_attachment_access` extension, its use has been removed in this patch. I am prototyping adding it back to measure the overhead introduced by manual subpass management. If the overhead is measurable, we can use the extension on devices that have it as an added optimization. * The complexity of command encoding remains linear (to the number of commands) per pass. * This patch only works on a single color attachment being used as an input attachment. While this is sufficient for current use cases, the Metal implementation is significantly more capable since the multiple attachments and attachment types (depth) are already supported. Rounding out support for this is in progress.
okie dokie, the test failures have been addressed, the clips work now too and are covered by the golden tests and I think I've addressed all PR comments. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM
I would prefer it if the additional test coverage either added some goldens or something that we could catch on CI.
Work towards flutter/flutter#120223 |
Also word of warning, if you force push skia gold won't rerun. I would probably update branch at least once and let it run to verify that there are no regressions. |
I updated the branch and the goldens seem to be happy. Assuming everything is good. Landing this and working on the new goldens next. |
…kan without extensions. (flutter/engine#50154)
…142675) flutter/engine@c4247c5...f4fbabf 2024-01-31 [email protected] [Impeller] Implement framebuffer-fetch via subpasses in Vulkan without extensions. (flutter/engine#50154) 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
be determined based on the presence and use of input-attachments in the
shaders. This information is already reflected by the compiler. Because of
this, all references to subpasses have been removed from APIs above the HAL.
RenderPassBuilderVK
is a lightweight object used to generate render passesto use either with the pipelines (compat, base, or per-subpass) or during
rendering along with the framebuffer. Using the builder also sets up the
right subpass dependencies. As long as the builder contains compatible
attachments and subpass counts, different subpasses stamped by the builder
(via the
Build
method) are guaranteed to be compatible per the rules in thespec.
eGeneral
layout. There was no observabledifference in performance when manually inserting the right transitions.
Except, a lot of transitions needed to be inserted. If we need it, we can add
it back in short order. I wouldn't be averse to adding it if reviewers
insist.
self-dependencies are sufficient to setup the render-pass.
rasterization_order_attachment_access
extension, its use hasbeen removed in this patch. I am prototyping adding it back to measure the
overhead introduced by manual subpass management. If the overhead is
measurable, we can use the extension on devices that have it as an added
optimization.
per pass.
attachment. While this is sufficient for current use cases, the Metal
implementation is significantly more capable since the multiple attachments
and attachment types (depth) are already supported. Rounding out support for
this is in progress.