Eagerly release GPU resources when we lose the device.#4834
Closed
bradwerth wants to merge 21 commits intogfx-rs:trunkfrom
Closed
Eagerly release GPU resources when we lose the device.#4834bradwerth wants to merge 21 commits intogfx-rs:trunkfrom
bradwerth wants to merge 21 commits intogfx-rs:trunkfrom
Conversation
cwfitzgerald
requested changes
Dec 6, 2023
|
|
||
| // 1) Resolve the GPUDevice device.lost promise. | ||
| let closure = self.lock_life().device_lost_closure.take(); | ||
| let mut life_lock = self.lock_life(); |
Member
There was a problem hiding this comment.
We shouldn't be holding the life lock across external closure invocations - this could potentially deadlock.
This prepares for introducing a similar test for global variables.
Co-authored-by: Nicolas Silva <nical@fastmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com> Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com> Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
…calls (gfx-rs#4726) * Add reusable buffer mappings for WASM * Run cargo fmt * Update CHANGELOG.md * Update web.rs * Add documentation for WebBuffer struct
* Remove expose-ids feature * Changelog
cbindgen spins out of control if wgpu_hal reexports a wgpu_types type using pub type in stead of pub use while keeping the same name.
…nUniform`, not just buffer binding arrays. Apply the `NonUniform` decoration to the results of all access chains rooted in binding arrays that use non-uniform values as indices, regardless of the binding array's element type and address space. Previously, Naga only decorated non-uniform access chains for binding arrays of buffers.
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.18.0 to 1.19.0. - [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md) - [Commits](matklad/once_cell@v1.18.0...v1.19.0) --- updated-dependencies: - dependency-name: once_cell dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Contributor
Author
|
Ugh, I botched the rebase/merge and I'm not sure how to recover. I'll resubmit as a new PR. |
Contributor
Author
|
New, non-borked PR is #4851. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connections
N/A
Description
This destroys buffer objects whenever we "lose the device", including at the end of the
device.destroyprocess. Destruction of the buffers triggers reclamation of GPU memory, rather than waiting for the garbage collector to drop the buffer. It would be ideal to also destroy texture objects, buttexture.destroyis not implemented, as noted in a TODO.Testing
This is exercised by any bulk test execution, like the CTS, which relies on
device.destroy(not waiting for the garbage collector) to free up GPU resources. Bulk test execution will have less failures due to full memory conditions.Checklist
cargo fmt.cargo clippy. If applicable, add:--target wasm32-unknown-unknown--target wasm32-unknown-emscriptencargo xtask testto run tests.CHANGELOG.md. See simple instructions inside file.