wgpu: Shader translation error for stage ShaderStages(VERTEX | FRAGMENT): new_render_pipeline_state: "Compiler encountered an internal error"

Summary

I encountered this error running a Bevy example cargo run --example mesh2d:

2023-12-02T22:26:01.361664Z  INFO bevy_render::renderer: AdapterInfo { name: "Intel Iris Pro Graphics", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2023-12-02T22:26:02.066572Z  INFO bevy_winit::system: Creating new window "App" (0v0)
2023-12-02T22:26:02.200397Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "MacOS 12.7 ", kernel: "21.6.0", cpu: "Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz", core_count: "4", memory: "16.0 GiB" }
2023-12-02T22:26:03.078599Z ERROR log: Shader translation error for stage ShaderStages(VERTEX | FRAGMENT): new_render_pipeline_state: "Compiler encountered an internal error"    
2023-12-02T22:26:03.078644Z ERROR log: Please report it to https://github.com/gfx-rs/naga    
2023-12-02T22:26:03.078697Z ERROR log: Handling wgpu errors as fatal by default    
thread 'Compute Task Pool (2)' panicked at /Users/eric/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.2/src/backend/direct.rs:3056:5:
wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `transparent_mesh2d_pipeline`
    Internal error in ShaderStages(VERTEX | FRAGMENT) shader: new_render_pipeline_state: "Compiler encountered an internal error"


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!
thread 'Compute Task Pool (0)' panicked at crates/bevy_render/src/pipelined_rendering.rs:145:45:
called `Result::unwrap()` on an `Err` value: RecvError

Appreciating this may well be a Bevy error, I posted over there https://github.com/bevyengine/bevy/issues/10849. However, because the error message asks me to file here, I’m cross-posting.

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 1
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I’m dealing with the same kind of problem 😕

2024-04-13T02:45:41.720201Z  INFO bevy_render::renderer: AdapterInfo { name: "Intel Iris Pro Graphics", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2024-04-13T02:45:42.325953Z  INFO space_bevy_xpbd_plugin: Add bevy_xpbd_3d plugin to editor
BevyXpbdPlugin::build
2024-04-13T02:45:42.513102Z  INFO bevy_winit::system: Creating new window "Space Editor" (0v1)
2024-04-13T02:45:42.579941Z  INFO space_editor_ui: Set start state
2024-04-13T02:45:42.580123Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "MacOS 12.7.4 ", kernel: "21.6.0", cpu: "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz", core_count: "4", memory: "16.0 GiB" }
2024-04-13T02:45:42.721990Z  WARN space_persistence: Persistence file not found at path editor.ron
2024-04-13T02:45:44.229189Z ERROR log: Device::create_render_pipeline error: Internal error in ShaderStages(VERTEX | FRAGMENT) shader: new_render_pipeline_state: "Compiler encountered an internal error"
2024-04-13T02:45:44.229232Z ERROR log: Shader translation error for stage ShaderStages(VERTEX | FRAGMENT): new_render_pipeline_state: "Compiler encountered an internal error"
2024-04-13T02:45:44.229245Z ERROR log: Please report it to https://github.com/gfx-rs/wgpu
2024-04-13T02:45:44.229287Z ERROR log: Handling wgpu errors as fatal by default
thread 'main' panicked at /Users/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.3/src/backend/wgpu_core.rs:3006:5:
wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `alpha_blend_mesh_pipeline`
    Internal error in ShaderStages(VERTEX | FRAGMENT) shader: new_render_pipeline_state: "Compiler encountered an internal error"


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_core_pipeline::upscaling::prepare_view_upscaling_pipelines`!
thread 'Compute Task Pool (3)' panicked at /Users/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.13.1/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError
thread 'main' panicked at /Users/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/macos/app_state.rs:387:33:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }

Fwiw, I see this with macOS 12.7.3 and xcode 14.2. I am unable to upgrade past this because I’m using a 2015 MacBook pro that is not supported by newer macOS versions.

I don’t see anything wrong with the generated Metal shader. It compiles to Metal IR (tried via https://shader-playground.timjones.io/) just fine, this is probably a driver bug that happens later when compiling the Metal IR to GPU instructions.

Debugging with Xcode (see https://github.com/gfx-rs/wgpu/wiki/Debugging-with-Xcode) might tell us more.

Does upgrading OS and/or Xcode version help? Before you do, could you let us know the versions you are on right now? It would help if others run into this to know the broken versions.

Yeah on mac you’re not supposed to find the GL backend - that log is only at debug for that reason.

The shader compilation error is on metal - we need the dump of the shader that failed to compile.

The defaults of the logging plugin exclude wgpu and naga’s logs for severities lower than error/warn.

https://github.com/bevyengine/bevy/blob/12a11e2fd0f7f6c1b907daa2782898c6f3097d1e/crates/bevy_log/src/lib.rs#L105

You should disable it or change the defaults.