bevy/crates/bevy_core_pipeline/src
Alice Cecile 5a9bc28502
Support non-Vec data structures in relations (#17447)
# Objective

The existing `RelationshipSourceCollection` uses `Vec` as the only
possible backing for our relationships. While a reasonable choice,
benchmarking use cases might reveal that a different data type is better
or faster.

For example:

- Not all relationships require a stable ordering between the
relationship sources (i.e. children). In cases where we a) have many
such relations and b) don't care about the ordering between them, a hash
set is likely a better datastructure than a `Vec`.
- The number of children-like entities may be small on average, and a
`smallvec` may be faster

## Solution

- Implement `RelationshipSourceCollection` for `EntityHashSet`, our
custom entity-optimized `HashSet`.
-~~Implement `DoubleEndedIterator` for `EntityHashSet` to make things
compile.~~
   -  This implementation was cursed and very surprising.
- Instead, by moving the iterator type on `RelationshipSourceCollection`
from an erased RPTIT to an explicit associated type we can add a trait
bound on the offending methods!
- Implement `RelationshipSourceCollection` for `SmallVec`

## Testing

I've added a pair of new tests to make sure this pattern compiles
successfully in practice!

## Migration Guide

`EntityHashSet` and `EntityHashMap` are no longer re-exported in
`bevy_ecs::entity` directly. If you were not using `bevy_ecs` / `bevy`'s
`prelude`, you can access them through their now-public modules,
`hash_set` and `hash_map` instead.

## Notes to reviewers

The `EntityHashSet::Iter` type needs to be public for this impl to be
allowed. I initially renamed it to something that wasn't ambiguous and
re-exported it, but as @Victoronz pointed out, that was somewhat
unidiomatic.

In
1a8564898f,
I instead made the `entity_hash_set` public (and its `entity_hash_set`)
sister public, and removed the re-export. I prefer this design (give me
module docs please), but it leads to a lot of churn in this PR.

Let me know which you'd prefer, and if you'd like me to split that
change out into its own micro PR.
2025-01-20 21:26:08 +00:00
..
auto_exposure bevy_core_pipeline: Apply #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17137) 2025-01-14 21:33:28 +00:00
blit Expose Pipeline Compilation Zero Initialize Workgroup Memory Option (#16301) 2024-11-08 21:42:37 +00:00
bloom Anamorphic Bloom (#17096) 2025-01-06 18:43:21 +00:00
contrast_adaptive_sharpening Remove all deprecated code (#16338) 2025-01-05 20:33:39 +00:00
core_2d Use multi_draw_indirect_count where available, in preparation for two-phase occlusion culling. (#17211) 2025-01-14 21:19:20 +00:00
core_3d Use multi_draw_indirect_count where available, in preparation for two-phase occlusion culling. (#17211) 2025-01-14 21:19:20 +00:00
deferred Key render phases off the main world view entity, not the render world view entity. (#16942) 2025-01-12 20:24:17 +00:00
dof Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
fullscreen_vertex_shader Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
fxaa Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
motion_blur Remove all deprecated code (#16338) 2025-01-05 20:33:39 +00:00
oit Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
post_process Fix Docs // incorrect default value for ChromaticAberration intensity (#16994) 2024-12-29 19:32:44 +00:00
prepass Use multi_draw_indirect_count where available, in preparation for two-phase occlusion culling. (#17211) 2025-01-14 21:19:20 +00:00
skybox Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
smaa Fix a few typos (#17292) 2025-01-10 22:48:30 +00:00
taa Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
tonemapping bevy_core_pipeline: Apply #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17137) 2025-01-14 21:33:28 +00:00
upscaling Fix a few typos (#17292) 2025-01-10 22:48:30 +00:00
lib.rs Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
msaa_writeback.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00