bevy/crates/bevy_render/src
charlotte 4c3b7679ec
#12502 Remove limit on RenderLayers. (#13317)
# Objective

Remove the limit of `RenderLayer` by using a growable mask using
`SmallVec`.

Changes adopted from @UkoeHB's initial PR here
https://github.com/bevyengine/bevy/pull/12502 that contained additional
changes related to propagating render layers.

Changes

## Solution

The main thing needed to unblock this is removing `RenderLayers` from
our shader code. This primarily affects `DirectionalLight`. We are now
computing a `skip` field on the CPU that is then used to skip the light
in the shader.

## Testing

Checked a variety of examples and did a quick benchmark on `many_cubes`.
There were some existing problems identified during the development of
the original pr (see:
https://discord.com/channels/691052431525675048/1220477928605749340/1221190112939872347).
This PR shouldn't change any existing behavior besides removing the
layer limit (sans the comment in migration about `all` layers no longer
being possible).

---

## Changelog

Removed the limit on `RenderLayers` by using a growable bitset that only
allocates when layers greater than 64 are used.

## Migration Guide

- `RenderLayers::all()` no longer exists. Entities expecting to be
visible on all layers, e.g. lights, should compute the active layers
that are in use.

---------

Co-authored-by: robtfm <50659922+robtfm@users.noreply.github.com>
2024-05-16 16:15:47 +00:00
..
batching Add BufferVec, an higher-performance alternative to StorageBuffer, and make GpuArrayBuffer use it. (#13199) 2024-05-03 11:39:21 +00:00
camera #12502 Remove limit on RenderLayers. (#13317) 2024-05-16 16:15:47 +00:00
diagnostic Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
mesh Revert "Support calculating normals for indexed meshes" (#12716) and add support for calculating smooth normals (#13333) 2024-05-16 14:54:35 +00:00
primitives Implement clone for most bundles. (#12993) 2024-04-16 16:37:09 +00:00
render_graph Fix beta lints (#12980) 2024-04-16 02:46:46 +00:00
render_phase Implement GPU frustum culling. (#12889) 2024-04-28 12:50:00 +00:00
render_resource multi_threaded feature rename (#12997) 2024-05-06 20:49:32 +00:00
renderer Disable RAY_QUERY and RAY_TRACING_ACCELERATION_STRUCTURE by default (#12862) 2024-04-04 19:20:19 +00:00
texture Throttle render assets (#12622) 2024-04-26 23:43:33 +00:00
view #12502 Remove limit on RenderLayers. (#13317) 2024-05-16 16:15:47 +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 Enable the unsafe_op_in_unsafe_fn lint (#11591) 2024-01-28 23:18:11 +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 multi_threaded feature rename (#12997) 2024-05-06 20:49:32 +00:00
maths.wgsl move wgsl color operations from bevy_pbr to bevy_render (#13209) 2024-05-04 10:30:23 +00:00
pipelined_rendering.rs Make AppExit more specific about exit reason. (#13022) 2024-04-22 16:48:18 +00:00
render_asset.rs asset throttling: don't be exhausted if there is no limit (#13112) 2024-04-27 09:00:10 +00:00
settings.rs Update to wgpu 0.19 and raw-window-handle 0.6 (#11280) 2024-01-26 18:14:21 +00:00
spatial_bundle.rs Implement Clone for VisibilityBundle and SpatialBundle (#10394) 2023-11-07 21:25:00 +00:00