-
Notifications
You must be signed in to change notification settings - Fork 920
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
Invoke a DeviceLostClosure immediately if set on an invalid device. #5358
Invoke a DeviceLostClosure immediately if set on an invalid device. #5358
Conversation
1bf4f79
to
ab88eb4
Compare
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.
Looks good! I left a few suggestions, I can apply them if you think they are good.
To make the device invalid, this defines an explicit, test-only method make_invalid. It also modifies calls that expect to always retrieve a valid device.
This comment was marked as resolved.
This comment was marked as resolved.
ab88eb4
to
3e5e6fc
Compare
Pushed up bb03319 to abbreviate |
Pushed 73d90fb to further clean up tests being added with deriving |
Connections
N/A
Description
This handles another case in
device_set_device_lost_closure
where aDeviceLostClosure
is given to wgpu but never called. The contract with these closures is that wgpu must call them before they are dropped.Testing
This adds a new test DEVICE_INVALID_THEN_SET_LOST_CALLBACK which invalidates the device and then sets a device lost callback on it. Unfortunately, there was no existing way to make a device invalid other than dropping it, so it also adds a function
make_invalid
to replace the device with an error in the registry. A few functions had to be touched up to handle this unexpected error object in the registry, representing an invalid device.Checklist
cargo fmt
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.