-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Descriptor pool incremental allocation. #49686
Conversation
size_t write_offset = 0u; | ||
|
||
auto& pipeline_descriptor = command.pipeline->GetDescriptor(); | ||
auto& desc_set = |
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.
missing the &
on this meant we were always copying the descriptor set layouts read from the pipeline descriptor 🤦
@@ -27,6 +28,12 @@ class RenderPassVK final : public RenderPass { | |||
std::weak_ptr<CommandBufferVK> command_buffer_; | |||
std::string debug_label_; | |||
bool is_valid_ = false; | |||
|
|||
mutable std::array<vk::DescriptorImageInfo, kMaxBindings> image_workspace_; |
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.
These don't have to be mutable once we remove the deferred encoding.
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 in the short term we could make this method not const.
Friendly ping :) |
After taking a closer look I found a few places where we made extra shared_ptr copies, so i've updated this to fix them. |
Part of flutter/flutter#140804 Migrate the rest of the commands in impeller to use the new API. Hide RenderPass::AddCommand. On subsequent changes I will be able to begin making some of these methods virtual so we can add more direct pass through. Though the vulkan backend will be blocked on changes to descriptor sets: #49686
f4d4a55
to
9a5bb08
Compare
|
||
writes.push_back(write_set); | ||
write_workspace[write_offset++] = write_set; |
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.
A somewhat hypothetical issue but there are no guards around writes past the end of the buffer. Debugging memory corruptions might get hairy. Perhaps write_workspace[std::max(write_offset++, write_workspace.size() - 1u)] = <blah>;
. Or do a bounds check and propagate the error. Here and elsewhere.
write_set.descriptorType = vk::DescriptorType::eInputAttachment; | ||
write_set.pImageInfo = &image_workspace[image_offset - 1]; | ||
|
||
write_workspace[write_offset++] = write_set; |
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.
Other than the writes past the end. This reads so much less scarier. Rather than depending on the correct reserve
call to ensure that the push_back
doesn't cause a reallocation and invalid pointer.
…141489) flutter/engine@418c9e9...b8e5d47 2024-01-12 [email protected] [Impeller] move TrackedObjectsVK to separate file. (flutter/engine#49773) 2024-01-12 [email protected] Add gclient_variables back for linux_license and fix the excluded files (flutter/engine#49775) 2024-01-12 [email protected] [Impeller] Descriptor pool incremental allocation. (flutter/engine#49686) 2024-01-12 [email protected] Relands: Refactors RBE support (flutter/engine#49660) 2024-01-12 [email protected] [Impeller] finish migration to new render pass API. (flutter/engine#49740) 2024-01-12 [email protected] [Impeller] remove Buffer type and associated abstractions. (flutter/engine#49702) 2024-01-12 [email protected] Remove `gclient_variables` from `linux_license.json` (flutter/engine#49766) 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
This returns descriptor set allocation to the previously used strategy of incrementally allocating descriptors and maintaing a vec of pools. This is required to remove deferred command encoding as part of flutter/flutter#140804
There are some potential further improvements: we may be able to share the descriptor pool across a frame, which would reduce allocation time slightly.