#12502 Remove limit on RenderLayers.#13317
Conversation
|
@james7132 I think I know how to use tracy, would you mind pointing me in the direction of what I should benchmark or any documentation for this relative to rendering prs? |
Co-authored-by: robtfm <50659922+robtfm@users.noreply.github.com>
I ran Will check its fixed shortly |
|
works for me too now. |
|
Don't want to claim to be a perf expert, but the numbers seem pretty reasonable to me? I'm sure there are scenarios we haven't covered yet. If the performance hit is acceptable, I don't think the additional maintence burden is worth it, but I will just say that I was able to implement a feature flag like so that "just works": #[cfg(feature = "unlimited_render_layers")]
#[path = "unlimited_render_layers.rs"]
mod render_layers;
#[cfg(not(feature = "unlimited_render_layers"))]
mod render_layers; |
|
I don't think feature flagging this is worth it. That's a nasty bit of maintenance burden, and IMO the flexibility here is worth the performance cost. |
|
I know this is pretty far into development but have we considered a tagged pointer to a slice with it's size stored inline? The render layer struct would be a single pointer whose address would define what it contains:
A intersection would be performed as follows:
If most our users only use the lower render layers or all render layers intersections and clones would operate without allocating. Pointer provenance shouldn't be an issue since we only ever dereference pointers whose addresses we haven't modified in any way. |
|
The powers that SME have decided that we should merge this as is, and tackle perf follow-ups in future PRs if they become meaningful (or someone wants to get nerd-sniped). Merging! |
# Objective - in example `render_to_texture`, #13317 changed the comment on the existing light saying lights don't work on multiple layers, then add a light on multiple layers explaining that it will work. it's confusing ## Solution - Keep the original light, with the updated comment ## Testing - Run example `render_to_texture`, lighting is correct
|
@alice-i-cecile doc for RenderLayers still contains mention of |
|
Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to bevyengine/bevy-website#1316 if you'd like to help out. |
Addresses Bevy [13317](bevyengine/bevy#13317)
Addresses Bevy [13317](bevyengine/bevy#13317)
Addresses Bevy [13317](bevyengine/bevy#13317)
Objective
Remove the limit of
RenderLayerby using a growable mask usingSmallVec.Changes adopted from @UkoeHB's initial PR here #12502 that contained additional changes related to propagating render layers.
Changes
Solution
The main thing needed to unblock this is removing
RenderLayersfrom our shader code. This primarily affectsDirectionalLight. We are now computing askipfield 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 aboutalllayers no longer being possible).Changelog
Removed the limit on
RenderLayersby 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.