bevyengine / bevy_github_ci_template

Apache License 2.0
202 stars 45 forks source link

Wasm build not working on itch in bevy 0.12.x #48

Closed PraxTube closed 4 months ago

PraxTube commented 10 months ago

I am trying to put a wasm build on itch but it just doesn't work. I cloned this repo and put it on itch to see why wasm isn't building. Turns out that it is working for bevy 0.11.0, but not for 0.12.x. I can't believe that this isn't a known issue, but I also have no clue what I could be doing wrong.

I am getting the following error when trying to run the 0.12.x version in the web on itch, which I don't get in the 0.11.0 build.

WARN /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_pbr-0.12.1/src/ssao/mod.rs:87 ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.

GET https://html-classic.itch.zone/html/9288970-880838/assets/ducky.png.meta 403 (Forbidden)
Failed to load resource: the server responded with a status of 403 ()

ERROR /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_asset-0.12.1/src/server/mod.rs:300 encountered an io error while loading asset: Encountered unexpected HTTP status 403
Full Console Log ``` bundle.min.js?1702356362:1 Already declared, using existing: Lightbox window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: ErrorLightbox window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: Lightbox window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: ErrorLightbox window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: SlideDown window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: CSRF window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: InputRow window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: TextInputRow window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: SimpleSelect window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: Select window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: RadioButtons window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: FormErrors window.R.window.R @ bundle.min.js?1702356362:1 bundle.min.js?1702356362:1 Already declared, using existing: RecaptchaInput window.R.window.R @ bundle.min.js?1702356362:1 lib.min.js?1702356362:2 Unrecognized feature: 'monetization'. xe @ lib.min.js?1702356362:2 lib.min.js?1702356362:2 Unrecognized feature: 'xr'. xe @ lib.min.js?1702356362:2 lib.min.js?1702356362:2 Allow attribute will take precedence over 'allowfullscreen'. xe @ lib.min.js?1702356362:2 bevy_game.js:376 INFO /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_winit-0.12.1/src/system.rs:55 Creating new window "App" (0v0) bevy_game.js:376 INFO /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.12.1/src/renderer/mod.rs:140 AdapterInfo { name: "ANGLE (NVIDIA Corporation, NVIDIA GeForce GTX 960/PCIe/SSE2, OpenGL 4.5.0)", vendor: 4318, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl } bevy_game.js:376 WARN /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_pbr-0.12.1/src/ssao/mod.rs:87 ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING. bevy_game.js:922 GET https://html-classic.itch.zone/html/9288970-880838/assets/ducky.png.meta 403 (Forbidden) imports.wbg.__wbg_fetch_1f9eb1a6c5433fb7 @ bevy_game.js:922 $web_sys::features::gen_Window::Window::fetch_with_str::h0fe830307752bd93 @ bevy_game_bg.wasm:0x1654cd4 $bevy_asset::io::wasm::HttpWasmAssetReader::fetch_bytes::{{closure}}::ha40d39234762fcd4 @ bevy_game_bg.wasm:0xba28d1 $::read_meta::{{closure}}::h2b75dee213d66c97 @ bevy_game_bg.wasm:0x11d5698 $bevy_asset::io::AssetReader::read_meta_bytes::{{closure}}::h656947f40c991694 @ bevy_game_bg.wasm:0xed999d $bevy_asset::server::AssetServer::load_internal::{{closure}}::hf2e538ed883c8c87 @ bevy_game_bg.wasm:0x1284be $bevy_tasks::single_threaded_task_pool::TaskPool::spawn::{{closure}}::h61be2353f29577b0 @ bevy_game_bg.wasm:0x556610 $wasm_bindgen_futures::queue::Queue::new::{{closure}}::h3de27792acef8a83 @ bevy_game_bg.wasm:0x1025ef6 $wasm_bindgen::convert::closures::invoke1_mut::h767562161e2892f8 @ bevy_game_bg.wasm:0x15eece5 __wbg_adapter_60 @ bevy_game.js:234 real @ bevy_game.js:203 bevy_game.js:376 ERROR /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_asset-0.12.1/src/server/mod.rs:300 encountered an io error while loading asset: Encountered unexpected HTTP status 403 ```

EDIT: It works on my web server, so it's likely an issue with the files/assets location on itch (perhaps with the relative/absolute paths). Note that I still get the errors that meta files are missing, but the game still seems to work as expected.

alice-i-cecile commented 10 months ago

First reported in https://github.com/bevyengine/bevy/issues/10157.

The bandaid fix for this was shipped in https://github.com/bevyengine/bevy/pull/10623.

Remember that you need to insert this resource before adding default plugins.

PraxTube commented 10 months ago

Thank you so much <3

alice-i-cecile commented 10 months ago

We should add this config to the template before closing this out :)

askor commented 8 months ago

Is this the reason this template is still on Bevy 0.11? Should be bumped to 0.12 if not

alice-i-cecile commented 8 months ago

This should be bumped, yes :)

PraxTube commented 8 months ago

Is this the reason this template is still on Bevy 0.11? Should be bumped to 0.12 if not

It's fixed in #49.