bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.8k stars 3.54k forks source link

Deferred rendering example (Forward + Prepass) is broken on web and macos #15525

Open DGriffin91 opened 2 weeks ago

DGriffin91 commented 2 weeks ago

Bevy version 8316d8969973259d342a930eed7d805ec6dcc780

The deferred rendering example is broken on Windows 10 / Vulkan.

The issue was introduced at https://github.com/bevyengine/bevy/commit/2ae5a21009db00a48193a79962074c583dcb3821 with https://github.com/bevyengine/bevy/pull/13497

Caused by:
  In Device::create_render_pipeline, label = 'deferred_lighting_pipeline'
    Error matching ShaderStages(FRAGMENT) shader requirements against the pipeline
      Shader global ResourceBinding { group: 0, binding: 22 } is not available in the pipeline layout
        View dimension D3 (is array: false) doesn't match the binding Sampler(Filtering)

Additionally, it issues the following warning:

Too many textures in mesh pipeline view layout, this might cause us to hit `wgpu::Limits::max_sampled_textures_per_shader_stage` in some environments.

This means it will also be broken on WebGL2, WebGPU, and some native platforms. I haven't investigated yet if solving the create_render_pipeline issue will also reduce the number of samples textures (allowing it to run on wasm, etc...)

ChristopherBiscardi commented 2 weeks ago
confirmed broken on macos too (expandable) ``` 2024-10-01T19:54:52.578413Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "MacOS 14.2.1 ", kernel: "23.2.0", cpu: "Apple M1 Max", core_count: "10", memory: "64.0 GiB" } 2024-10-01T19:54:52.672518Z INFO bevy_render::renderer: AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal } 2024-10-01T19:54:53.199064Z INFO bevy_winit::system: Creating new window "App" (0v1#4294967296) 2024-10-01T19:54:53.392453Z WARN bevy_pbr::render::mesh_view_bindings: Too many textures in mesh pipeline view layout, this might cause us to hit `wgpu::Limits::max_sampled_textures_per_shader_stage` in some environments. 2024-10-01T19:54:54.162748Z ERROR wgpu_core::device::global: Device::create_render_pipeline error: Error matching ShaderStages(FRAGMENT) shader requirements against the pipeline 2024-10-01T19:54:54.162793Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default thread 'Compute Task Pool (3)' panicked at /Users/chris/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-22.1.0/src/backend/wgpu_core.rs:3411:5: wgpu error: Validation Error Caused by: In Device::create_render_pipeline, label = 'deferred_lighting_pipeline' Error matching ShaderStages(FRAGMENT) shader requirements against the pipeline Shader global ResourceBinding { group: 0, binding: 22 } is not available in the pipeline layout View dimension D3 (is array: false) doesn't match the binding Sampler(Filtering) 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 (0)' panicked at crates/bevy_render/src/render_resource/pipeline_cache.rs:856:49: index out of bounds: the len is 0 but the index is 0 Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`! thread '' panicked at /Users/chris/github/bevyengine/bevy/crates/bevy_render/src/render_resource/pipeline_cache.rs:546:28: index out of bounds: the len is 0 but the index is 0 Encountered a panic in system `bevy_render::renderer::render_system`! ```
cart commented 12 hours ago

Looks like everything but Forward + Prepass is fixed. Enabling Deferred + Prepass in deferred_rendering results in a hang (without error message) on macos/native and linux/webgl2, but not linux/native