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

Fix default backends selection when running examples at the workspace root #2730

Closed
wants to merge 1 commit into from

Conversation

jinleili
Copy link
Contributor

@jinleili jinleili commented Jun 4, 2022

Connections
#2540

Description
Since wgpu-info as a workspace default-members item depends on wgpu and enabled angle vulkan-portability features, it causes #[cfg(vulkan)] #[cfg(gl)] compile conditions alway pass when run examples at the workspace root .

wgpu/wgpu-core/build.rs

Lines 10 to 19 in 9e3cd08

vulkan: { all(not(wasm), any(windows, unix_wo_apple, feature = "vulkan-portability")) },
metal: { all(not(wasm), apple) },
dx12: { all(not(wasm), windows) },
dx11: { all(not(wasm), windows) },
gl: {
any(
unix_wo_apple,
feature = "angle",
wasm
)

Testing
Tested examples at the workspace root and wgpu package directory

@cwfitzgerald
Copy link
Member

I don't think this actually solves the base problem, just cures the symptoms. The problem here isn't that we are enabling the GL backend on windows, we should always be allowed to do that, the issue is that we're crashing when trying to call a function that we shouldn't be calling.

@jinleili
Copy link
Contributor Author

jinleili commented Jun 4, 2022

@cwfitzgerald Although not solving the crash, I think what this commit solves is the inconsistent results of running the examples in the workspace root and wgpu package directory without specifying WGPU_BACKEND. The same issue exists not only on Windows, but also on macOS.

Executing cargo run --example xx from wgpu package directory on macOS, always using the metal backend

The result of executing cargo run --example xx from the workspace root on macOS.

  • When no "angle" is installed, an alert window pops up:

no_angle

  • When vulkan is installed, always using the vk backend

@cwfitzgerald
Copy link
Member

cwfitzgerald commented Jun 4, 2022

Mac why do you have to be like this.

Alright, I think the best option is to add a message to wgpu-info saying "for gl in non Linux add the angle feature, for vk on Mac add the vulkan-portability feature" , then remove the default features from wgpu-info, then make sure CI covers the angle and vk portability cases.

I specifically want to avoid removing wgpu-info from the default workspace.

@jinleili jinleili deleted the default_backend_select branch June 14, 2022 02:41
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