bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Update to wgpu trunk/0.19 and raw-window-handle 0.6

Open Elabajaba opened this issue 1 year ago • 4 comments

Objective

Keep core dependencies up to date.

Solution

Update the dependencies.

wgpu 0.19 only supports raw-window-handle (rwh) 0.6, so bumping that was included in this.

The rwh 0.6 version bump is just the simplest way of doing it. There might be a way we can take advantage of wgpu's new safe surface creation api, but I'm not familiar enough with bevy's window management to untangle it and my attempt ended up being a mess of lifetimes and rustc complaining about missing trait impls (that were implemented). Thanks to @MiniaczQ for the (much simpler) rwh 0.6 version bump code.

Unblocks https://github.com/bevyengine/bevy/pull/9172 and https://github.com/bevyengine/bevy/pull/10812

This might be blocked on cpal and oboe updating their ndk versions to 0.8, as they both currently target ndk 0.7 which uses rwh 0.5.2


Changelog

TODO

Migration Guide

TODO

Elabajaba avatar Jan 09 '24 23:01 Elabajaba

https://github.com/gfx-rs/wgpu/pull/5044 may also need some work on the wasm side

mockersf avatar Jan 17 '24 04:01 mockersf

gfx-rs/wgpu#5044 may also need some work on the wasm side

Yup, I was just thinking about that earlier. I guess I need to audit every cfg block in bevy_pbr/render/core_pipeline/sprite...

edit: Current status of web: webgpu seems to work, webgl2 doesn't (probably need to remove the webgpu feature from wgpu for webgl2 builds for now?)

Elabajaba avatar Jan 17 '24 04:01 Elabajaba

Blocked on https://github.com/gfx-rs/wgpu/issues/5088 and getting webgl2 working.

Elabajaba avatar Jan 18 '24 07:01 Elabajaba

This might be blocked on cpal and oboe updating their ndk versions to 0.8, as they both currently target ndk 0.7 which uses rwh 0.5.2

https://github.com/RustAudio/cpal/pull/820 and https://github.com/katyo/oboe-rs/pull/57

and https://github.com/Elabajaba/bevy/pull/2 to build this PR on Android

mockersf avatar Jan 18 '24 11:01 mockersf

You added a new feature but didn't add a description for it. Please update the root Cargo.toml file.

github-actions[bot] avatar Jan 19 '24 07:01 github-actions[bot]

I've added a (temporary) webgpu feature that's mutually exclusive with webgl2 for now (compile time error) to get them building. (I know it's incorrect, but it's needed for testing).

Currently running into an issue where there's a ton of "error[E0412]: cannot find type Gpu*** in crate web_sys" in wgpu-0.19.0\src\backend\webgpu.rs when compiling with both webgl2 and webgpu features enabled.

Elabajaba avatar Jan 19 '24 07:01 Elabajaba

You added a new feature but didn't add a description for it. Please update the root Cargo.toml file.

github-actions[bot] avatar Jan 19 '24 07:01 github-actions[bot]

I've added a (temporary) webgpu feature that's mutually exclusive with webgl2 for now (compile time error) to get them building. (I know it's incorrect, but it's needed for testing).

I think it's OK for now, we can work once merged to get them working together

Currently running into an issue where there's a ton of "error[E0412]: cannot find type Gpu*** in crate web_sys" in wgpu-0.19.0\src\backend\webgpu.rs when compiling with both webgl2 and webgpu features enabled.

webgpu still needs RUSTFLAGS=--cfg=web_sys_unstable_apis

mockersf avatar Jan 19 '24 07:01 mockersf

You added a new feature but didn't add a description for it. Please update the root Cargo.toml file.

github-actions[bot] avatar Jan 22 '24 07:01 github-actions[bot]

You added a new feature but didn't add a description for it. Please update the root Cargo.toml file.

github-actions[bot] avatar Jan 22 '24 07:01 github-actions[bot]

Reworked this so that instead of making webgpu and webgl mutually exclusive features and a compile error, enabling the webgpu feature now overrides the webgl feature as people seemed to maybe prefer that approach when I asked on discord (https://discord.com/channels/691052431525675048/692572690833473578/1199092028164821082)

Currently some examples are broken on webgl2 (load_gltf works fine, but the flight helmet explodes in deferred_rendering and anti_aliasing. many_foxes and shader_prepass straight up don't work on webgl2). I haven't really tested webgpu much yet other than load_gltf and deferred_rendering work.

Elabajaba avatar Jan 23 '24 07:01 Elabajaba

You added a new feature but didn't add a description for it. Please update the root Cargo.toml file.

github-actions[bot] avatar Jan 24 '24 02:01 github-actions[bot]

The generated examples/README.md is out of sync with the example metadata in Cargo.toml or the example readme template. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.

github-actions[bot] avatar Jan 24 '24 05:01 github-actions[bot]

You added a new feature but didn't update the readme. Please run cargo run -p build-templated-pages -- update features to update it, and commit the file change.

github-actions[bot] avatar Jan 24 '24 05:01 github-actions[bot]

Tested this on my phone and android appears to work fine (audio played correctly, paused when minimized, plays when re-focused).

Elabajaba avatar Jan 24 '24 20:01 Elabajaba

Transparent window is broken on Windows 11, but I don't think it's this PRs fault, I'll update this in a sec. Yeah, just Win11 things, this PR does not make it better/worse.

MiniaczQ avatar Jan 26 '24 09:01 MiniaczQ