-
Notifications
You must be signed in to change notification settings - Fork 6k
Allow BufferViews to have non-owning references to DeviceBuffers #56224
Conversation
|
@jonahwilliams I started sketching out what it could look like to have raw pointers in DeviceBuffer. I think I can make this work, especially if we can move DeviceBuffer to unique_ptr in a later PR. The gist is that DeviceBuffer can have ownership or not depending if it's coming from the HostBuffer's DeviceBuffers or not. |
a7d4e74 to
4dff377
Compare
|
That sounds like a good approach. off the top of my head, there is a DeviceBuffer::AsBufferView API that is problematic without the buffer view having ownership, but we can fix that by requiring an explicit track too. |
| } | ||
|
|
||
| if (!command_buffer_->Track(index_buffer)) { | ||
| std::shared_ptr<const DeviceBuffer> index_buffer = |
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.
So we only track it if the buffer_view owns the device buffer reference? Oh and then we set the buffer view to use a raw_ptr as we know its tracked already...
Incredibly clever!
4dff377 to
fd6eb0f
Compare
|
The reason this doesn't work as-is right now is that if we stop tracking DeviceBuffers from the HostBuffer; when ~HostBuffer() is called it will schedule those DeviceBuffers in the HostBuffer to be deleted which will result in deleting the DeviceBuffer while the command buffer is referencing it. We'd need to create some sort of mechanism where ~HostBuffer waits for all frames to render. Or maybe in ~HostBuffer passing all the DeviceBuffers to the TrackedObjectsVK. |
81c958b to
d61d464
Compare
d61d464 to
d5c4736
Compare
9228115 to
ab09d34
Compare
jonahwilliams
left a comment
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.
LGTM
|
reason for revert: merge issue. |
…fers (#56224)" (#56285) Reverts: #56224 Initiated by: jonahwilliams Reason for reverting: merge issue. Original PR Author: gaaclarke Reviewed By: {jonahwilliams} This change reverts the following previous change: issue: flutter/flutter#157538 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
…eviceBuffers (flutter#56224)" (flutter#56285)" This reverts commit cdabd2d.
…ers (#56286) relands #56224 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
…157972) flutter/engine@bb77cf8...cd46383 2024-10-31 [email protected] reland: Allow BufferViews to have non-owning references to DeviceBuffers (flutter/engine#56286) 2024-10-31 [email protected] Roll Skia from 9168ad248c69 to a5e3b3556739 (1 revision) (flutter/engine#56283) 2024-10-31 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Allow BufferViews to have non-owning references to DeviceBuffers (#56224)" (flutter/engine#56285) 2024-10-31 [email protected] macOS: migrate third_party/accessibility to ARC (flutter/engine#56281) 2024-10-31 [email protected] Allow BufferViews to have non-owning references to DeviceBuffers (flutter/engine#56224) 2024-10-31 [email protected] [Impeller] Do not use fast mask blur for stroked shapes (flutter/engine#56247) 2024-10-31 [email protected] [Impeller] make desktop GL render. (flutter/engine#56274) 2024-10-31 [email protected] Vastly rewrite and expand `et/README.md` (flutter/engine#56250) 2024-10-31 [email protected] Roll Fuchsia Linux SDK from dDWvmfG4AxSEs0BQA... to MjcuejuzYvYGobbFM... (flutter/engine#56280) 2024-10-31 [email protected] Roll Dart SDK from f3e3dc44b1dc to bd93105c4fb6 (2 revisions) (flutter/engine#56278) 2024-10-31 [email protected] Embedder: migrate Metal surfaces to ARC (flutter/engine#56279) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from dDWvmfG4AxSE to MjcuejuzYvYG 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] 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
…tter/engine#56224) issue: flutter#157538 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
…fers (flutter#56224)" (flutter/engine#56285) Reverts: flutter/engine#56224 Initiated by: jonahwilliams Reason for reverting: merge issue. Original PR Author: gaaclarke Reviewed By: {jonahwilliams} This change reverts the following previous change: issue: flutter#157538 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
…ers (flutter/engine#56286) relands flutter/engine#56224 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
issue: flutter/flutter#157538
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.