mirror of
https://github.com/bevyengine/bevy
synced 2024-12-25 12:33:07 +00:00
b9c623e4f3
# 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. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |