Skip to content

Move backend selection to Instance::new()#730

Merged
bors[bot] merged 1 commit intogfx-rs:masterfrom
Kimundi:master
Jun 18, 2020
Merged

Move backend selection to Instance::new()#730
bors[bot] merged 1 commit intogfx-rs:masterfrom
Kimundi:master

Conversation

@Kimundi
Copy link
Copy Markdown
Contributor

@Kimundi Kimundi commented Jun 17, 2020

Connections
Addresses gfx-rs/wgpu-rs#337
Corresponding wgpu-rs PR: gfx-rs/wgpu-rs#385

Description
This makes early backend selection possible in Instance::new, by only attempting to instantiate requested backends. The actual selection in pick_adapter() (necessarily) remains unchanged, and can be used to further restrict the request.

Testing
Unsure what to do here

@Kimundi
Copy link
Copy Markdown
Contributor Author

Kimundi commented Jun 17, 2020

So, this doesn't currently compile because I'm not sure how to address some issue in Global<G>::pick_adapter, see line comments.

@Kimundi Kimundi marked this pull request as ready for review June 17, 2020 19:26
Copy link
Copy Markdown
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Thank you!
Just one note here, looks great overall!

impl Instance {
pub fn new(name: &str, version: u32) -> Self {
pub fn new(name: &str, version: u32, backends: BackendBit) -> Self {
let inputs = AdapterInputs::Mask(backends, |_| ());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we don't need this. Instead, each constructor would check if backends.contains(...) { Some(...) } else {None}

Copy link
Copy Markdown
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Please squash!
Also, if you want to play with a macro, that would be neat :)

Keep `inputs` parameter in `pick_adapter()`
@Kimundi
Copy link
Copy Markdown
Contributor Author

Kimundi commented Jun 18, 2020

I squashed it for now, the macro gets involved enough that I don't want to block on it here. :)

Copy link
Copy Markdown
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

bors r+

@bors
Copy link
Copy Markdown
Contributor

bors bot commented Jun 18, 2020

@bors bors bot merged commit a02a566 into gfx-rs:master Jun 18, 2020
bors bot added a commit to gfx-rs/wgpu-rs that referenced this pull request Jun 19, 2020
385: Move `backends: BackendBit` parameter to `Instance::new()` r=kvark a=Kimundi

Fixes #337
Blocked on gfx-rs/wgpu#730.


Co-authored-by: Marvin Löbel <loebel.marvin@gmail.com>
kvark pushed a commit to kvark/wgpu that referenced this pull request Jun 3, 2021
385: Move `backends: BackendBit` parameter to `Instance::new()` r=kvark a=Kimundi

Fixes gfx-rs#337
Blocked on gfx-rs#730.


Co-authored-by: Marvin Löbel <loebel.marvin@gmail.com>
kvark added a commit to kvark/wgpu that referenced this pull request Jun 3, 2021
730: Fix the web backend in code and CI r=grovesNL a=kvark

Fixes gfx-rs#729

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
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