bevy/crates/bevy_render/src
MiniaczQ e312da8c52
Reduce runtime panics through SystemParam validation (#15276)
# Objective

The goal of this PR is to introduce `SystemParam` validation in order to
reduce runtime panics.

Fixes #15265

## Solution

`SystemParam` now has a new method `validate_param(...) -> bool`, which
takes immutable variants of `get_param` arguments. The returned value
indicates whether the parameter can be acquired from the world. If
parameters cannot be acquired for a system, it won't be executed,
similarly to run conditions. This reduces panics when using params like
`Res`, `ResMut`, etc. as well as allows for new, ergonomic params like
#15264 or #15302.

Param validation happens at the level of executors. All validation
happens directly before executing a system, in case of normal systems
they are skipped, in case of conditions they return false.

Warning about system skipping is primitive and subject to change in
subsequent PRs.

## Testing

Two executor tests check that all executors:
- skip systems which have invalid parameters:
  - piped systems get skipped together,
  - dependent systems still run correctly,
- skip systems with invalid run conditions:
  - system conditions have invalid parameters,
  - system set conditions have invalid parameters.
2024-09-23 16:54:21 +00:00
..
batching Remove remnant EntityHash and related types from bevy_utils (#15039) 2024-09-09 15:24:17 +00:00
camera Fix floating point math (#15239) 2024-09-16 23:28:12 +00:00
diagnostic Wgpu 0.20 (#13186) 2024-06-14 18:39:31 +00:00
mesh simplify std::mem references (#15315) 2024-09-19 21:28:16 +00:00
primitives Reflect derived traits on all components and resources: bevy_render (#15226) 2024-09-15 17:05:11 +00:00
render_graph Don't ignore draw errors (#13240) 2024-07-22 19:22:30 +00:00
render_phase TrackedRenderPass internal tracking state reset (#14948) 2024-09-12 16:51:36 +00:00
render_resource simplify std::mem references (#15315) 2024-09-19 21:28:16 +00:00
renderer Spirv passthrough main (adopted, part deux) (#15352) 2024-09-22 14:51:14 +00:00
texture Add common aspect ratio constants and improve documentation (#15091) 2024-09-09 16:04:41 +00:00
view simplify std::mem references (#15315) 2024-09-19 21:28:16 +00:00
alpha.rs Implement alpha to coverage (A2C) support. (#12970) 2024-04-15 20:37:52 +00:00
color_operations.wgsl move wgsl color operations from bevy_pbr to bevy_render (#13209) 2024-05-04 10:30:23 +00:00
extract_component.rs Fix some nightly Clippy lints (#12927) 2024-04-13 02:05:38 +00:00
extract_instances.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
extract_param.rs Reduce runtime panics through SystemParam validation (#15276) 2024-09-23 16:54:21 +00:00
extract_resource.rs Add error when extract resource build fails (#4964) 2024-04-28 05:20:59 +00:00
globals.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
globals.wgsl Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
gpu_component_array_buffer.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
lib.rs Allow to expect (adopted) (#15301) 2024-09-20 19:16:42 +00:00
maths.wgsl add tonemapping LUT bindings for sprite and mesh2d pipelines (#13262) 2024-05-28 12:09:26 +00:00
pipelined_rendering.rs Fix lints introduced in Rust beta 1.80 (#13899) 2024-06-17 17:22:01 +00:00
render_asset.rs check sampler type in as_bind_group derives (#12637) 2024-08-21 01:41:31 +00:00
settings.rs Replace the wgpu_trace feature with a field in bevy_render::settings::WgpuSettings (#14842) 2024-08-25 14:16:11 +00:00
spatial_bundle.rs Clearer spatial bundle pub const docs (#14293) 2024-07-15 16:03:09 +00:00
storage.rs Add convenience methods for constructing and setting storage buffer data (#15044) 2024-09-09 15:28:31 +00:00