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

Make RequestAdapterOptions.power_preference optional #3903

Merged
merged 4 commits into from
Jul 19, 2023

Commits on Jul 9, 2023

  1. Make RequestAdapterOptions.power_preference optional

    The WebGPU docs state that the `powerPreference` field is optional -
    it can be set to `undefined`, which provides no hint.
    
    Currently, wgpu only allows using an explicit LowPower or HighPerformance
    hint. This can cause a secondary backend to be chosen over a primary
    backend when the secondary backend is the only one matching the power
    preference - with no way to ensure that a primary backend takes
    priority.
    
    This commit changes `RequestAdapterOptions.power_preference` to
    store an `Option<PowerPreference>`, and removes the `Default`
    impl from `PowerPreference`. Under WebGPU, we leave
    `GPURequestAdapterOptions.powerPreference` when our value
    is `None`. Under native, we skip the backend preference logic.
    Aaron1011 committed Jul 9, 2023
    Configuration menu
    Copy the full SHA
    6c4a3fc View commit details
    Browse the repository at this point in the history
  2. Address review comments

    Aaron1011 committed Jul 9, 2023
    Configuration menu
    Copy the full SHA
    2243859 View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2023

  1. Fix comment

    Aaron1011 committed Jul 19, 2023
    Configuration menu
    Copy the full SHA
    11685ca View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c76295e View commit details
    Browse the repository at this point in the history