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

Prevent OpenGL from taking preference over Vulkan #2853

Merged
merged 3 commits into from
Jul 6, 2022

Conversation

Craig-Macomber
Copy link
Contributor

@Craig-Macomber Craig-Macomber commented Jul 4, 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

Issue is worked around in Craig-Macomber/rusty-flame@8a20c7f#diff-42cb6807ad74b3e201c5a7ca98b911c5fa08380e942be6e4ac5807f8377f87fcR115

Description

Prefer DeviceType::DiscreteGpu over DeviceType::Other for PowerPreference::LowPower so Vulkan is preferred over OpenGL again.

This change: bfcf5fa caused default configurations (low power, all back-ends) such as the "hello" example to prefer OpenGL over Vulkan for DiscreteGpu devices.

This happens because OpenGL lists the device_type as "Other" when its actually "DiscreteGpu" (but OpenGL does not know this).

Since the OpenGL backend currently never reports any device as DiscreteGpu, it seems like a good idea to make sure "Other" is not preferred over DiscreteGpu: without this GL will get preferred over Vulkan when both are present for the DiscreteGpu.

The low power configuration (which is the default) used to violate this (after the above linked change) which resulted in regressions where GL would get selected over Vulkan, causing reduced feature sets.

This fix is not ideal: it could regress some cases including multi-gpu systems where one of them gets device type Other, and thats actually lower power than the one listed as DiscreteGpu.

It also seems bad to be using "Other" when we mean "Unknown", so I have updated the comment on that device type to clarify its actual usage.

Another possible fix would be to change the GL backend back to reporting DiscreteGpu instead of Other, or add actual detection support for DiscreteGpu (ex: maybe consider all devices from amd, nvidia or intel not detected as one of the other types as DiscreteGpu?).

Testing

My system, which outputs the adapters now listed in the updated readme, now selects the Vulkan version like it did back in wgpu 0.12.

@Craig-Macomber Craig-Macomber marked this pull request as ready for review July 4, 2022 23:47
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Good stuff

@cwfitzgerald cwfitzgerald merged commit 1da5bbd into gfx-rs:master Jul 6, 2022
@Craig-Macomber Craig-Macomber deleted the avoid-Other branch July 6, 2022 17:47
cwfitzgerald pushed a commit to cwfitzgerald/wgpu that referenced this pull request Jul 14, 2022
* Prevent OpenGL from taking preference over Vulkan

* update changelog

* fix wasm build of example
cwfitzgerald pushed a commit that referenced this pull request Jul 14, 2022
* Prevent OpenGL from taking preference over Vulkan

* update changelog

* fix wasm build of example
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