[hal] Do not expose dependency on metal
and objc
crates
#7649
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connections
Allows #5641 to not contain breaking changes.
Description
wgpu-hal
's dependency on themetal
andobjc
crates is currently indirectly exposed via. the parameter types onhal::metal::Surface::from_view
,hal::metal::Surface::from_layer
andhal::metal::Instance::create_surface_from_layer
.This is unfortunate, since it ties
wgpu-hal
to specific dependencies, and specific versions of said dependencies. Instead, this PR changes these methods to useNonNull<c_void>
, and prefers to instead document which type the user is expected to pass here. This mirrors the top-level API already exposed inInstance::create_surface_metal
.Additionally, this PR removes
metal::Instance::create_surface_from_layer
, since it was only a simple wrapper, and splitsmetal::Surface::from_view
intofrom_ns_view
andfrom_ui_view
to make it clearer/easier to document what the requirements are for the given type. This matchesraw_window_metal::Layer
's methods.Testing
Tested using:
I believe this should suffice, as this mostly modifies the entry point to surface creation.
Checklist
cargo fmt
.taplo format
.cargo clippy --tests
. If applicable, add:--target wasm32-unknown-unknown
cargo xtask test
to run tests.CHANGELOG.md
entry.