bevy/examples/shader
Rob Parrett e186c7ccf4
Fix panic in custom_render_phase example (#17866)
# Objective

Fix panic in `custom_render_phase`.

This example was broken by #17764, but that breakage evolved into a
panic after #17849. This new panic seems to illustrate the problem in a
pretty straightforward way.

```
2025-02-15T00:44:11.833622Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "macOS 15.3 Sequoia", kernel: "24.3.0", cpu: "Apple M4 Max", core_count: "16", memory: "64.0 GiB" }    
2025-02-15T00:44:11.908328Z  INFO bevy_render::renderer: AdapterInfo { name: "Apple M4 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2025-02-15T00:44:12.314930Z  INFO bevy_winit::system: Creating new window App (0v1)
thread 'Compute Task Pool (1)' panicked at /Users/me/src/bevy/crates/bevy_ecs/src/system/function_system.rs:216:28:
bevy_render::batching::gpu_preprocessing::batch_and_prepare_sorted_render_phase<custom_render_phase::Stencil3d, custom_render_phase::StencilPipeline> could not access system parameter ResMut<PhaseBatchedInstanceBuffers<Stencil3d, MeshUniform>>
```

## Solution

Add a `SortedRenderPhasePlugin` for the custom phase.

## Testing

`cargo run --example custom_render_phase`
2025-02-16 19:59:45 +00:00
..
animate_shader.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
array_texture.rs Remove incorrect equality comparisons for asset load error types (#15890) 2024-10-14 01:00:45 +00:00
automatic_instancing.rs Add user supplied mesh tag (#17648) 2025-02-10 22:38:13 +00:00
compute_shader_game_of_life.rs Expose Pipeline Compilation Zero Initialize Workgroup Memory Option (#16301) 2024-11-08 21:42:37 +00:00
custom_phase_item.rs Cache MeshInputUniform indices in each RenderBin. (#17772) 2025-02-11 22:38:52 +00:00
custom_post_processing.rs Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
custom_render_phase.rs Fix panic in custom_render_phase example (#17866) 2025-02-16 19:59:45 +00:00
custom_shader_instancing.rs Use multi_draw_indirect_count where available, in preparation for two-phase occlusion culling. (#17211) 2025-01-14 21:19:20 +00:00
custom_vertex_attribute.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
extended_material.rs Place percentage-closer soft shadows behind a feature gate to save on samplers. (#16068) 2024-10-24 21:16:00 +00:00
fallback_image.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
gpu_readback.rs Allowed creating uninitialized images (for use as storage textures) (#17760) 2025-02-10 22:22:07 +00:00
shader_defs.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
shader_material_2d.rs Add alpha mode implementation to shader_material_2d (#16603) 2025-01-28 05:09:30 +00:00
shader_material_bindless.rs Add a bindless mode to AsBindGroup. (#16368) 2024-12-03 18:00:34 +00:00
shader_material_glsl.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
shader_material_screenspace_texture.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
shader_material.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
shader_prepass.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
specialized_mesh_pipeline.rs Combine output_index and indirect_parameters_index into one field in PreprocessWorkItem. (#17853) 2025-02-13 20:10:14 +00:00
storage_buffer.rs Add user supplied mesh tag (#17648) 2025-02-10 22:38:13 +00:00
texture_binding_array.rs Make StandardMaterial bindless. (#16644) 2024-12-10 17:48:56 +00:00