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

shader_prepass example panics #7879

Closed
rparrett opened this issue Mar 2, 2023 · 2 comments
Closed

shader_prepass example panics #7879

rparrett opened this issue Mar 2, 2023 · 2 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Milestone

Comments

@rparrett
Copy link
Contributor

rparrett commented Mar 2, 2023

Bevy version

main
bisected to #7784

Relevant system information

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

What you did

cargo run --example shader_prepass

What went wrong

thread 'Compute Task Pool (1)' panicked at 'Resource requested by bevy_pbr::render::light::queue_shadows<shader_prepass::PrepassOutputMaterial> does not exist: bevy_pbr::prepass::PrepassPipeline<shader_prepass::PrepassOutputMaterial>', /Users/me/src/bevy/crates/bevy_ecs/src/system/system_param.rs:454:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (2)' panicked at 'Resource requested by bevy_pbr::render::light::queue_shadow_view_bind_group<shader_prepass::PrepassOutputMaterial> does not exist: bevy_pbr::prepass::PrepassPipeline<shader_prepass::PrepassOutputMaterial>', /Users/me/src/bevy/crates/bevy_ecs/src/system/system_param.rs:454:17
thread 'Compute Task Pool (1)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', crates/bevy_ecs/src/schedule/executor/multi_threaded.rs:194:60
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/me/src/bevy/crates/bevy_tasks/src/task_pool.rs:371:49
thread 'Compute Task Pool (1)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:136:45
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/me/src/bevy/crates/bevy_tasks/src/task_pool.rs:371:49
@rparrett rparrett added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Mar 2, 2023
@geieredgar
Copy link
Contributor

geieredgar commented Mar 2, 2023

I believe this will be fixed by #7878.

.add_plugin(MaterialPlugin::<PrepassOutputMaterial> {
            // This material only needs to read the prepass textures,
            // but the meshes using it should not contribute to the prepass render, so we can disable it.
            prepass_enabled: false,
            ..default()
        })

This disables the PrepassPlugin<PrepassOutputMaterial>, which is required for the shadow mapping to work.

@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 Mar 2, 2023
@alice-i-cecile alice-i-cecile added this to the 0.10 milestone Mar 2, 2023
@geieredgar
Copy link
Contributor

I can confirm that the example does now work on my machine when using #7878. The dependency on the disabled PrepassPlugin was not the only issue, the custom material relied on prepass.wgsl, which did not always define a fragment shader entry point.

@bors bors bot closed this as completed in cb0db07 Mar 3, 2023
Shfty pushed a commit to shfty-rust/bevy that referenced this issue Mar 19, 2023
…yengine#7878)

# Objective

Unfortunately, there are three issues with my changes introduced by bevyengine#7784.

1.  The changes left some dead code. This is already taken care of here: bevyengine#7875.
2. Disabling prepass causes failures because the shadow mapping relies on the `PrepassPlugin` now.
3. Custom materials use the `prepass.wgsl` shader, but this does not always define a fragment entry point.

This PR fixes 2. and 3. and resolves bevyengine#7879.

## Solution

- Add a regression test with disabled prepass.
- Split `PrepassPlugin` into two plugins:
  - `PrepassPipelinePlugin` contains the part that is required for the shadow mapping to work and is unconditionally added.
  - `PrepassPlugin` now only adds the systems and resources required for the "real" prepasses.
- Add a noop fragment entry point to `prepass.wgsl`, used if `NORMAL_PASS` is not defined.


Co-authored-by: Edgar Geier <geieredgar@gmail.com>
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.

3 participants