Skip to content
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

Degenerification part 2/3: Removal of lifetimes from wgpu-core #6099

Closed
wants to merge 49 commits into from

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Aug 10, 2024

Connections

Description
This is where the magic happens!
Almost all interaction of wgpu-hal in wgpu-core use now the previously introduced Dyn backend abstraction.
To achieve this, all hal resources are allocated as Box<dyn hal::DynResource> (with more concrete types for safety & easy of use).

Since hal resource are no longer distinguish type, Hubs collapses to just a single Hub.
AnyDevice is no longer needed since every device is just a Box<dyn hal::DynDevice>

Since wgpu-core types are extremely intertwined (most of them have an Arc<Device>) this happens in very few commits. However, I split out a few rough iterations with two major "unravelings": first boxing & dyn passing, then hub simplification & actual generic removal.

In order to not have this PR spill into wgpu, gfx_select has been stripped down to pass-through, it will be removed entirely in Part 3.

Testing

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • [ ] Add change to CHANGELOG.md. See simple instructions inside file. changelog in Part 3

@Wumpf Wumpf requested a review from a team as a code owner August 10, 2024 21:18
@Wumpf Wumpf marked this pull request as draft August 10, 2024 21:18
@Wumpf Wumpf force-pushed the degenerification-part2 branch 2 times, most recently from fd36733 to 9927994 Compare August 10, 2024 21:29
@Wumpf Wumpf marked this pull request as ready for review August 10, 2024 21:31
Copy link
Contributor

@nical nical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glorious

@@ -1,7 +1,7 @@
/*! Resource State and Lifetime Trackers

These structures are responsible for keeping track of resource state,
generating barriers where needed, and making sure resources are kept
generating barriers where needednd making sure resources are kept
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: looks like the next few comment modifications are accidental.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, one of my many regex replacements must have gone sideways!

Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My eyes glazed over by the 457th file, but this is looking good and nothing that deserves blocking. I could probably find something to bikeshed if I really tried, but lets favor landing.

…ffects from there leading to boxing of almost all hal resources
gfx_select macros are empty husks now that are waiting to be removed
@Wumpf
Copy link
Member Author

Wumpf commented Aug 14, 2024

merged in part 3

@Wumpf Wumpf closed this Aug 14, 2024
@Wumpf Wumpf deleted the degenerification-part2 branch August 14, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants