Skip to content

Use 64 bit for world and system tick index #6651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/bevy_ecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fixedbitset = "0.4"
fxhash = "0.2"
downcast-rs = "1.2"
serde = { version = "1", features = ["derive"] }
cfg-if = "1.0"

[dev-dependencies]
rand = "0.8"
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/macros/src/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
unsafe fn init_fetch<'__w>(
_world: &'__w #path::world::World,
state: &Self::State,
_last_change_tick: u32,
_change_tick: u32
_last_change_tick: #path::change_detection::Tick,
_change_tick: #path::change_detection::Tick
) -> <Self as #path::query::WorldQuery>::Fetch<'__w> {
#fetch_struct_name {
#(#field_idents:
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream {
state: &'s mut Self,
system_meta: &SystemMeta,
world: &'w World,
change_tick: u32,
change_tick: Tick,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
change_tick: Tick,
change_tick: #path::change_detection::Tick,

) -> Self::Item {
ParamSet {
param_states: &mut state.0,
Expand Down Expand Up @@ -437,7 +437,7 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
state: &'s mut Self,
system_meta: &#path::system::SystemMeta,
world: &'w #path::world::World,
change_tick: u32,
change_tick: #path::change_detection::Tick,
) -> Self::Item {
#struct_name {
#(#fields: <<#field_types as #path::system::SystemParam>::Fetch as #path::system::SystemParamFetch>::get_param(&mut state.state.#field_indices, system_meta, world, change_tick),)*
Expand Down
15 changes: 8 additions & 7 deletions crates/bevy_ecs/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use crate::{
Archetype, ArchetypeId, Archetypes, BundleComponentStatus, ComponentStatus,
SpawnBundleStatus,
},
component::{Component, ComponentId, Components, StorageType, Tick},
change_detection::SmallTick,
component::{Component, ComponentId, Components, StorageType},
entity::{Entities, Entity, EntityLocation},
storage::{SparseSetIndex, SparseSets, Storages, Table},
};
Expand Down Expand Up @@ -280,7 +281,7 @@ impl BundleInfo {
components: &mut Components,
storages: &'a mut Storages,
archetype_id: ArchetypeId,
change_tick: u32,
change_tick: SmallTick,
) -> BundleInserter<'a, 'b> {
let new_archetype_id =
self.add_bundle_to_archetype(archetypes, storages, components, archetype_id);
Expand Down Expand Up @@ -339,7 +340,7 @@ impl BundleInfo {
archetypes: &'a mut Archetypes,
components: &mut Components,
storages: &'a mut Storages,
change_tick: u32,
change_tick: SmallTick,
) -> BundleSpawner<'a, 'b> {
let new_archetype_id =
self.add_bundle_to_archetype(archetypes, storages, components, ArchetypeId::EMPTY);
Expand Down Expand Up @@ -380,7 +381,7 @@ impl BundleInfo {
bundle_component_status: &S,
entity: Entity,
table_row: usize,
change_tick: u32,
change_tick: SmallTick,
bundle: T,
) {
// NOTE: get_components calls this closure on each component in "bundle order".
Expand All @@ -394,7 +395,7 @@ impl BundleInfo {
// SAFETY: bundle_component is a valid index for this bundle
match bundle_component_status.get_status(bundle_component) {
ComponentStatus::Added => {
column.initialize(table_row, component_ptr, Tick::new(change_tick));
column.initialize(table_row, component_ptr, change_tick);
}
ComponentStatus::Mutated => {
column.replace(table_row, component_ptr, change_tick);
Expand Down Expand Up @@ -502,7 +503,7 @@ pub(crate) struct BundleInserter<'a, 'b> {
sparse_sets: &'a mut SparseSets,
result: InsertBundleResult<'a>,
archetypes_ptr: *mut Archetype,
change_tick: u32,
change_tick: SmallTick,
}

pub(crate) enum InsertBundleResult<'a> {
Expand Down Expand Up @@ -637,7 +638,7 @@ pub(crate) struct BundleSpawner<'a, 'b> {
bundle_info: &'b BundleInfo,
table: &'a mut Table,
sparse_sets: &'a mut SparseSets,
change_tick: u32,
change_tick: SmallTick,
}

impl<'a, 'b> BundleSpawner<'a, 'b> {
Expand Down
Loading