You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Objective
`ComputedVisibility` could afford to be smaller/faster. Optimizing the size and performance of operations on the component will positively benefit almost all extraction systems.
This was listed as one of the potential pieces of future work for #5310.
## Solution
Merge both internal booleans into a single `u8` bitflag field. Rely on bitmasks to evaluate local, hierarchical, and general visibility.
Pros:
- `ComputedVisibility::is_visible` should be a single bitmask test instead of two.
- `ComputedVisibility` is now only 1 byte. Should be able to fit 100% more per cache line when using dense iteration.
Cons:
- Harder to read.
- Setting individual values inside `ComputedVisiblity` require bitmask mutations.
This should be a non-breaking change. No public API was changed. The only publicly visible effect is that `ComputedVisibility` is now 1 byte instead of 2.
@@ -71,8 +78,7 @@ impl Default for ComputedVisibility {
71
78
implComputedVisibility{
72
79
/// A [`ComputedVisibility`], set as invisible.
73
80
pubconstINVISIBLE:Self = ComputedVisibility{
74
-
is_visible_in_hierarchy:false,
75
-
is_visible_in_view:false,
81
+
flags:ComputedVisibilityFlags::empty(),
76
82
};
77
83
78
84
/// Whether this entity is visible to something this frame. This is true if and only if [`Self::is_visible_in_hierarchy`] and [`Self::is_visible_in_view`]
@@ -81,7 +87,7 @@ impl ComputedVisibility {
81
87
/// [`CoreStage::Update`] stage will yield the value from the previous frame.
0 commit comments