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

[Merged by Bors] - Configurable wgpu features/limits priority #3452

Closed
wants to merge 3 commits into from

Conversation

superdump
Copy link
Contributor

Objective

  • Allow the user to specify the priority when configuring wgpu features/limits and by default use the maximum capabilities of the chosen adapter.

Solution

  • Add a WgpuOptionsPriority enum with Compatibility, Functionality and WebGL2 options.
  • Add a priority: WgpuOptionsPriority member to WgpuOptions.
  • When initialising the renderer, if WgpuOptions::priority == WgpuOptionsPriority::Functionality, query the adapter for the available features and limits, use them when creating a device, and update WgpuOptions with those values. If Compatibility use the behaviour as before this PR. If WebGL2 then use the WebGL2 downlevel limits as used when when building for wasm, for convenience of testing WebGL2 limits without having to build for wasm.
  • Add an environment variable WGPU_OPTIONS_PRIO that takes compatibility, functionality, webgl2.
  • Default to WgpuOptionsPriority::Functionality.
  • Insert updated WgpuOptions into render app world as well. This is useful for applying the limits when rendering, such as limiting the directional light shadow map texture to 2048x2048 when using WebGL2 downlevel limits but not on wasm.
  • Reduced draw_state logs from debug to trace and added debug level logs for the wgpu features and limits. Use RUST_LOG=bevy_render=debug to see the output.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Dec 27, 2021
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A simple quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled labels Dec 27, 2021
@cart cart added this to the Bevy 0.6 milestone Jan 4, 2022
@cart
Copy link
Member

cart commented Jan 4, 2022

Seems reasonable to me!

@cart
Copy link
Member

cart commented Jan 4, 2022

bors r+

bors bot pushed a commit that referenced this pull request Jan 4, 2022
# Objective

- Allow the user to specify the priority when configuring wgpu features/limits and by default use the maximum capabilities of the chosen adapter.

## Solution

- Add a `WgpuOptionsPriority` enum with `Compatibility`, `Functionality` and `WebGL2` options.
- Add a `priority: WgpuOptionsPriority` member to `WgpuOptions`.
- When initialising the renderer, if `WgpuOptions::priority == WgpuOptionsPriority::Functionality`, query the adapter for the available features and limits, use them when creating a device, and update `WgpuOptions` with those values. If `Compatibility` use the behaviour as before this PR. If `WebGL2` then use the WebGL2 downlevel limits as used when when building for wasm, for convenience of testing WebGL2 limits without having to build for wasm.
- Add an environment variable `WGPU_OPTIONS_PRIO` that takes `compatibility`, `functionality`, `webgl2`.
- Default to `WgpuOptionsPriority::Functionality`.
- Insert updated `WgpuOptions` into render app world as well. This is useful for applying the limits when rendering, such as limiting the directional light shadow map texture to 2048x2048 when using WebGL2 downlevel limits but not on wasm.
- Reduced `draw_state` logs from `debug` to `trace` and added `debug` level logs for the wgpu features and limits. Use `RUST_LOG=bevy_render=debug` to see the output.
@bors bors bot changed the title Configurable wgpu features/limits priority [Merged by Bors] - Configurable wgpu features/limits priority Jan 4, 2022
@bors bors bot closed this Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Usability A simple quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants