Skip to content

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

@rparrett

Description

@rparrett

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 = "*"

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions