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

2d project without default-features fails to compile without bevy_pbr feature on wasm targets #11908

Closed
rparrett opened this issue Feb 16, 2024 · 0 comments · Fixed by #11914
Closed
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@rparrett
Copy link
Contributor

rparrett commented Feb 16, 2024

Bevy version

main, bisected to #10057

Relevant system information

AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
SystemInfo { os: "MacOS 14.2.1 ", kernel: "23.2.0", cpu: "", core_count: "10", memory: "64.0 GiB" }

What you did

cargo run --example sprite --no-default-features \
--features=bevy_asset,bevy_core_pipeline,bevy_render,bevy_sprite,bevy_text,bevy_ui,bevy_winit,multi-threaded,webgl2,x11,png \
--target=wasm32-unknown-unknown

(adding bevy_pbr to that list causes compilation to succeed)

What went wrong

error[E0599]: no variant or associated item named `Glsl` found for enum `ShaderLanguage` in the current scope
   --> crates/bevy_render/src/render_resource/shader.rs:217:70
    |
217 |             Source::Glsl(_, _) => naga_oil::compose::ShaderLanguage::Glsl,
    |                                                                      ^^^^ variant or associated item not found in `ShaderLanguage`

error[E0599]: no variant or associated item named `GlslVertex` found for enum `naga_oil::compose::ShaderType` in the current scope
   --> crates/bevy_render/src/render_resource/shader.rs:233:77
    |
233 |                 naga::ShaderStage::Vertex => naga_oil::compose::ShaderType::GlslVertex,
    |                                                                             ^^^^^^^^^^ variant or associated item not found in `ShaderType`

error[E0599]: no variant or associated item named `GlslFragment` found for enum `naga_oil::compose::ShaderType` in the current scope
   --> crates/bevy_render/src/render_resource/shader.rs:234:79
    |
234 |                 naga::ShaderStage::Fragment => naga_oil::compose::ShaderType::GlslFragment,
    |                                                                               ^^^^^^^^^^^^ variant or associated item not found in `ShaderType`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `bevy_render` (lib) due to 3 previous errors

Workaround

Users can work around this by adding the following to their Cargo.toml

[target.'cfg(target_arch = "wasm32")'.dependencies]
# Workaround for Bevy #11908
naga_oil = "*"
@rparrett rparrett added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 16, 2024
@rparrett rparrett changed the title 2d project without default-features fails to compile without bevy_pbr feature 2d project without default-features fails to compile without bevy_pbr feature on wasm targets Feb 16, 2024
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Feb 16, 2024
github-merge-queue bot pushed a commit that referenced this issue Feb 17, 2024
# Objective

Fixes #11908

## Solution

- Remove the `naga_oil` dependency from `bevy_pbr`.
- We were doing a little dance to disable `glsl` support on not-wasm, so
incorporate that dance into `bevy_render`'s `Cargo.toml`.
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-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants