Closed almarklein closed 1 month ago
I'm attempting to update, but my I'm somewhat overwhelmed by the Rust type errors:
E.g. I get a ton of these; is the suggestion from the Rust compiler the way to go?
error[E0599]: no method named `as_mut` found for struct `Id` in the current scope
--> src/lib.rs:4293:32
|
4293 | let encoder = pass.encoder.as_mut().unwrap();
| ^^^^^^ method not found in `Id<RenderPassEncoder>`
|
::: /Users/almar/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/convert/mod.rs:372:8
|
372 | fn as_mut(&mut self) -> &mut T;
| ------
| |
| the method is available for `Box<Id<RenderPassEncoder>>` here
| the method is available for `Box<&mut Id<RenderPassEncoder>>` here
| the method is available for `Box<&Id<RenderPassEncoder>>` here
|
help: consider wrapping the receiver expression with the appropriate type
|
4293 | let encoder = Box::new(pass.encoder).as_mut().unwrap();
| +++++++++ +
help: consider wrapping the receiver expression with the appropriate type
|
4293 | let encoder = Box::new(&mut pass.encoder).as_mut().unwrap();
| +++++++++++++ +
help: consider wrapping the receiver expression with the appropriate type
|
4293 | let encoder = Box::new(&pass.encoder).as_mut().unwrap();
| ++++++++++ +
Yeah there are quite a lot of changes needed, here's my branch that I was working a while ago, it compiles and runs but has a ref counting race condition somewhere for the surface, so it segfaults at exit. I didn't get much time to work on finding it though.
(Feel free to pull those changes in this PR :))
Ah, great to see you've already made the changes. That segfault sounds bad. I might also have a look.
I reviewed your changes, and it looks fine to me (albeit my Rust knowledge is limited). I especially checked the code related to surfaces, but cannot find anything suspicious of why the race condition was introduced. I also don't get a segfault on MacOS.
This https://github.com/gfx-rs/wgpu/issues/5637 may be related, it's fix is added as a backport, so maybe will need to wait till next point release. (I still need to verify by moving to wgpu trunk)
Update: It doesn't fix it unfortunately, but it's related to our Arc
usage for Surface + Device.
Is it possible to publish a version even if we have some memory issue on it ? The issue could be track and fix on a futur minor version, so, peoples waiting for bugfixes/new features are not block.
The segfault turned out to be fixed via https://github.com/gfx-rs/wgpu/pull/6052, #402 updates wgpu to v22.1.0
which includes that fix and no longer segfaults.
Updating to https://github.com/gfx-rs/wgpu/releases/tag/v0.20.0