-
Notifications
You must be signed in to change notification settings - Fork 969
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
Remove lifetime constraints from wgpu::ComputePass
methods
#5570
Conversation
c7655a4
to
b976ff1
Compare
wgpu::ComputePass
)
#5432
…rectly on recording TODO: * bind groups don't work because the Binder gets an id only * wgpu level error handling is missing
…eeds to lock bind_group storage
… DynComputePass on wgpu side
b976ff1
to
0d470a9
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.
By and large great - I'd be curious is there is any performance difference, but lets ship this
Me too! I really want to add a compute pass benchmark and backport it now that you started that work |
…5570) * basic test setup * remove lifetime and drop resources on test - test fails now just as expected * compute pass recording is now hub dependent (needs gfx_select) * compute pass recording now bumps reference count of uses resources directly on recording TODO: * bind groups don't work because the Binder gets an id only * wgpu level error handling is missing * simplify compute pass state flush, compute pass execution no longer needs to lock bind_group storage * wgpu sided error handling * make ComputePass hal dependent, removing command cast hack. Introduce DynComputePass on wgpu side * remove stray repr(C) * changelog entry * fix deno issues -> move DynComputePass into wgc * split out resources setup from test
Connections
wgpu::ComputePass
) #5432wgpu::ComputePass
) #5432 lands as this contains all the changes again.RenderPass
make it difficult to use. #1453Part of a series towards lifetime removal on compute passes:
wgpu::ComputePass
) #5432wgpu::ComputePass
methods #5570ComputePass
to its parent command encoder #5620Description
Removes the need for lifetime dependency on any resource passed into a ComputePass.
Lifetime constraints to the originating encoder & queries used during creation still apply for the moment (to be addressed in a follow-up.
Directly builds on #5432 by moving the creation of
ArcComputeCommand
into compute pass methods.To accomplish this I had to add a HalApi generic dependency on
ComputePass
. Since I didn't want to introduce a new object to the id/objecttracking system, I instead decided to create aDynComputePass
onwgpu/wgpu_core.rs
side. Hopefully we can simplify this as part of the generic refactor (#5124). Note that the new lifetime dependency made boxing of the wgpu-core compute pass is unavoidable at this point andDynComputePass
allows us to merge the otherwise requiredgfx_select
& type cast into a single trait/virtual call.An alternative I expolored was to do the type erasure internally on
BasePass<ArcComputeCommand<A>>
but I found this quite unwieldy, also this wouldn't cover timestamp writes which are intentionally left unaddressed in this PR.Testing
Added a new test that ensures that resources passed into a ComputePass can be dropped before executing the compute pass.
Proved that the test would crash before these changes and passes with them.
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.