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

[local] Don't panic if no adapters are found #368

Closed
kvark opened this issue Oct 31, 2019 · 6 comments
Closed

[local] Don't panic if no adapters are found #368

kvark opened this issue Oct 31, 2019 · 6 comments
Labels
good first issue Good for newcomers help required We need community help to make this happen. type: enhancement New feature or request

Comments

@kvark
Copy link
Member

kvark commented Oct 31, 2019

It would be nicer not to panic in wgpu_instance_request_adapters.
I don't think it should be a blocker for 0.4, but a nice little thing to have.

@kvark kvark added type: enhancement New feature or request help required We need community help to make this happen. good first issue Good for newcomers labels Oct 31, 2019
@antonok-edm
Copy link
Contributor

Unless I misunderstand, this is fixed by 41132a3?

@kvark
Copy link
Member Author

kvark commented Nov 1, 2019

@antonok-edm this only fixed a part of the problem in request_adapter. The rest of the problem is in this unwrap

@fogti
Copy link

fogti commented Nov 7, 2019

I tried implementating an fix for wgpu-rs, but the wgpu-native API needs to be extended to cover the following:
(excerpt from wgpu-rs/src/lib.rs)

    /// Retrieves an [`Adapter`] which matches the given options.
    ///
    /// Some options are "soft", so treated as non-mandatory. Others are "hard".
    ///
    /// If no adapters are found that suffice all the "hard" options, `None` is returned.
    pub fn request(options: &wgn::RequestAdapterOptions) -> Option<Self> {
        wgn::request_adapter(/* &*wgn::hub::GLOBAL (private to wgpu-rs) */, &options, &[]).map(|id| Adapter { id })
    }

The problem is that there is no way to access the global wgpu instance.

@kvark
Copy link
Member Author

kvark commented Nov 7, 2019

We need to modify wgpu_instance_request_adapters first, and then consider it's results in wgpu-rs.

@paulkernfeld
Copy link
Contributor

I was just taking a look to see if I could fix this since it's marked with good-first-issue. Taking a look in wgpu-native, I see that there is no longer a wgpu_request_adapter function. I'm thinking that it has now been replaced by fn wgpu_request_adapter_async in wgpu-native, which no longer tries to unwrap. Additionally, I see that the Instance::request_adapter fn in wgpu-rs now returns a Future<Output = Option<Adapter>>. If my understanding is right, are there any other changes needed to close this issue?

@kvark
Copy link
Member Author

kvark commented Apr 29, 2020

Yes, sorry, looks like this was fixed at some point recently.
The method is now

) -> Option<AdapterId> {
and it returns an option.

@kvark kvark closed this as completed Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help required We need community help to make this happen. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants