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

pass around RawDisplayHandle and RawWindowHandle in implementation #3022

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

i509VCB
Copy link
Contributor

@i509VCB i509VCB commented Sep 13, 2022

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
There has been discussion on Matrix to allow swapping the "Context" type inside wgpu at runtime.

Description
This change is to help with an attempt to allow the Context type in wgpu to be swappable at runtime in the future.

In order to do that, the functions provided by a dynamic blanket implemented Context and it's associated types need to be object safe. For surface creation, instead of passing a impl trait that combines both HasRawWindowHandle and HasRawDisplayHandle, we separate the types into their RawDisplayHandle and RawWindowHandle parts internally.

This change is to help with an attempt to allow the Context type in wgpu to be swappable at runtime. In order to do that, the functions provided by Context and it's associated types need to be object safe. Instead of passing a impl trait that combines both HasRawWindowHandle and HasRawDisplayHandle, we seperate the types into their RawDisplayHandle and RawWindowHandle parts internally to reduce some of the hal implementation code mess.
Copy link
Member

@jimblandy jimblandy left a comment

Choose a reason for hiding this comment

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

Looks good to me. A nice cleanup, actually.

@jimblandy jimblandy merged commit 9e3efd7 into gfx-rs:master Sep 15, 2022
jimblandy added a commit to jimblandy/wgpu that referenced this pull request Oct 13, 2022
As of gfx-rs#3022, this is no longer needed.
jimblandy added a commit to jimblandy/wgpu that referenced this pull request Oct 13, 2022
As of gfx-rs#3022, the local `init` function no longer needs a dummy
argument.
jimblandy added a commit to jimblandy/wgpu that referenced this pull request Oct 13, 2022
As of gfx-rs#3022, the local `init` function no longer needs a dummy
argument.
jimblandy added a commit to jimblandy/wgpu that referenced this pull request Oct 13, 2022
As of gfx-rs#3022, the local `init` function no longer needs a dummy
argument.
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