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

Don't use a callback to return backend instance handles. #2991

Merged
merged 1 commit into from
Sep 3, 2022

Conversation

jimblandy
Copy link
Member

@jimblandy jimblandy commented Aug 27, 2022

Change Instance::as_hal<A> to simply return an
Option<&A::Instance>, rather than passing it to a callback. We're
just borrowing a reference to some wgpu_hal::Api::Instance owned by
the wgpu_core::instance::Instance, so there's no special scoping or
locking magic required here.

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Link to the issues addressed by this PR, or dependent PRs in other repositories

Description
Describe what problem this is solving, and how it's solved.

Testing
Explain how this change is tested.

Change `Instance::as_hal<A>` to simply return an
`Option<&A::Instance>`, rather than passing it to a callback. We're
just borrowing a reference to some `wgpu_hal::Api::Instance` owned by
the `wgpu_core::instance::Instance`, so there's no special scoping or
locking magic required here.
@jimblandy jimblandy merged commit bec26b7 into gfx-rs:master Sep 3, 2022
@jimblandy jimblandy deleted the as_hal_no_callback branch September 3, 2022 00:33
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.

2 participants