Prevent OpenGL from taking preference over Vulkan #2853
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
cargo clippy
.RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
Issue is worked around in Craig-Macomber/rusty-flame@8a20c7f#diff-42cb6807ad74b3e201c5a7ca98b911c5fa08380e942be6e4ac5807f8377f87fcR115
Description
Prefer
DeviceType::DiscreteGpu
overDeviceType::Other
forPowerPreference::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.