Likely overpadded motion blur struct
Bevy version
Latest main.
What you did
Had a look at the newly merged motion blur PR.
What went wrong
https://github.com/bevyengine/bevy/blob/main/crates/bevy_core_pipeline/src/motion_blur/motion_blur.wgsl#L21
If I'm not mistaken the padding is meant to ensure the fields add up to 16 bytes.
Since there is a f32 and a u32 before the padding, the "hole" is 8 bytes, but the padding adds 12 bytes via vec3<f32>.
In this case the wgsl should change to vec2<f32> as well as the corresponding Rust side ShaderType struct.
The example doesn't even seem to compile for wasm
error[E0063]: missing field `_webgl2_padding` in initializer of `bevy::bevy_core_pipeline::motion_blur::MotionBlur`
--> examples/3d/motion_blur.rs:24:26
|
24 | motion_blur: MotionBlur {
| ^^^^^^^^^^ missing `_webgl2_padding`
For more information about this error, try `rustc --explain E0063`.
error: could not compile `bevy` (example "motion_blur") due to 1 previous error
And it seems there are further issues on wasm after fixing the padding:
ERROR app: panicked at /Users/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glow-0.13.1/src/web_sys.rs:3184:9:
Tex storage 2D multisample is not supported
Stack:
Error
at imports.wbg.__wbg_new_abda76e883ba8a5f (http://127.0.0.1:1334/api/wasm.js:1814:13)
at __wbg_new_abda76e883ba8a5f externref shim (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[284553]:0x5006010)
at console_error_panic_hook::Error::new::h8f2a3c9e1bd5d94b (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[202489]:0x4be32a9)
at console_error_panic_hook::hook_impl::h4b7b11b364c6a021 (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[40389]:0x314ab02)
at console_error_panic_hook::hook::h9bca3edbb9fe0449 (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[248763]:0x4ea24ad)
at core::ops::function::Fn::call::h863dd25d8ad6c6bb (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[219048]:0x4d03942)
at std::panicking::rust_panic_with_hook::h6b00a1542b7e827c (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[84477]:0x3d89f21)
at std::panicking::begin_panic_handler::{{closure}}::hcb858dc6b4beb4ae (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[108401]:0x41e7446)
at std::sys_common::backtrace::__rust_end_short_backtrace::hbb248f505066e51b (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[286862]:0x500d973)
at rust_begin_unwind (http://127.0.0.1:1334/api/wasm.wasm:wasm-function[225466]:0x4d68032)
After fixing disabling MSAA to fix that, things sort of work, but with a bunch of weird artifacts.