Skip to content

Commit

Permalink
Allow dense iteration for FilteredEntity(Ref|Mut) in more cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
chescock committed Nov 14, 2024
1 parent e155fe1 commit 9af7036
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions crates/bevy_ecs/src/query/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,8 @@ impl<'w, D: QueryData, F: QueryFilter> QueryBuilder<'w, D, F> {
.map_or(false, |info| info.storage_type() == StorageType::Table)
};

#[allow(deprecated)]
let (mut component_reads_and_writes, component_reads_and_writes_inverted) =
self.access.access().component_reads_and_writes();
if component_reads_and_writes_inverted {
return false;
}

component_reads_and_writes.all(is_dense)
&& self.access.access().archetypal().all(is_dense)
&& !self.access.access().has_read_all_components()
D::IS_DENSE
&& F::IS_DENSE
&& self.access.with_filters().all(is_dense)
&& self.access.without_filters().all(is_dense)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/query/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ unsafe impl<'a> WorldQuery for FilteredEntityRef<'a> {
fetch
}

const IS_DENSE: bool = false;
const IS_DENSE: bool = true;

unsafe fn init_fetch<'w>(
world: UnsafeWorldCell<'w>,
Expand Down Expand Up @@ -706,7 +706,7 @@ unsafe impl<'a> WorldQuery for FilteredEntityMut<'a> {
fetch
}

const IS_DENSE: bool = false;
const IS_DENSE: bool = true;

unsafe fn init_fetch<'w>(
world: UnsafeWorldCell<'w>,
Expand Down

0 comments on commit 9af7036

Please sign in to comment.