-
Notifications
You must be signed in to change notification settings - Fork 947
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
Renderpass take resource ownership #5884
Conversation
a7bec42
to
c097717
Compare
d10100d
to
bdc6328
Compare
…ership of resources passed on pass creation
6347d28
to
ebbbdf2
Compare
ebbbdf2
to
a6bcbf1
Compare
…coder locking errors with render passes
a6bcbf1
to
a463cdd
Compare
It turns out that this change badly broke Rend3. See (Rend3 was abandoned by its author around the time this went in. But I'm stuck using it, and now I have to fix it.) |
@John-Nagle This PR loosens the lifetime requirements on the wgpu side. The change to You'll need to call |
I get that, mostly. The worst trouble is near here: https://github.com/BVE-Reborn/rend3/blob/trunk/rend3/src/graph/graph.rs#L403 This code is trying to manage the lifetime of the render pass and encoder from unsafe code.
That's not an assurance that this is safe code. It's a warning that there are lifetime requirements imposed on the caller. Ones which are changing now. The code in that function does considerable unsafe manipulation of encoder and render pass lifetimes. So changes in this area are likely to cause undefined behavior. I really don't want to touch that code if I can possibly avoid doing so. Is that possible? |
@John-Nagle lifetime requirements only got relaxed and more things are now handled as a runtime error rather than a compile time error which is what allows |
The unsafe code in this area is exactly because previously the ownership management was only via lifetime annotation & there was no forget_lifetime. I think that's about right. It looks to me like the old WGPU lifetime system forced complex unsafe ownership management. I'm trying to figure that out now. I think ordinary Rc and RefCell can do the job now. Thanks. |
Connections
RenderPass
make it difficult to use. #1453ComputePass
to its parent command encoder #5620wgpu::ComputePass::forget_lifetime
#5768Description
Just like ComputePass before, we now take ownership of all ingoing resources to a RenderPass right away. We also take ownership of the parent encoder, making it possible to convert
RenderPass<'a>
->RenderPass<'static>
(as opt-in)Testing
New ownership tests added (very similar to what we added for compute pass previously)
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.