Skip to content

Commit 576fcc0

Browse files
committed
Use 64 bit for world and system tick index
1 parent ffa489a commit 576fcc0

27 files changed

+574
-356
lines changed

crates/bevy_ecs/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ fixedbitset = "0.4"
2727
fxhash = "0.2"
2828
downcast-rs = "1.2"
2929
serde = { version = "1", features = ["derive"] }
30+
cfg-if = "1.0"
3031

3132
[dev-dependencies]
3233
rand = "0.8"

crates/bevy_ecs/macros/src/fetch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
224224
unsafe fn init_fetch<'__w>(
225225
_world: &'__w #path::world::World,
226226
state: &Self::State,
227-
_last_change_tick: u32,
228-
_change_tick: u32
227+
_last_change_tick: #path::change_detection::Tick,
228+
_change_tick: #path::change_detection::Tick
229229
) -> <Self as #path::query::WorldQuery>::Fetch<'__w> {
230230
#fetch_struct_name {
231231
#(#field_idents:

crates/bevy_ecs/macros/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream {
292292
state: &'s mut Self,
293293
system_meta: &SystemMeta,
294294
world: &'w World,
295-
change_tick: u32,
295+
change_tick: Tick,
296296
) -> Self::Item {
297297
ParamSet {
298298
param_states: &mut state.0,
@@ -437,7 +437,7 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
437437
state: &'s mut Self,
438438
system_meta: &#path::system::SystemMeta,
439439
world: &'w #path::world::World,
440-
change_tick: u32,
440+
change_tick: #path::change_detection::Tick,
441441
) -> Self::Item {
442442
#struct_name {
443443
#(#fields: <<#field_types as #path::system::SystemParam>::Fetch as #path::system::SystemParamFetch>::get_param(&mut state.state.#field_indices, system_meta, world, change_tick),)*

crates/bevy_ecs/src/bundle.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::{
99
Archetype, ArchetypeId, Archetypes, BundleComponentStatus, ComponentStatus,
1010
SpawnBundleStatus,
1111
},
12+
change_detection::SmallTick,
1213
component::{Component, ComponentId, ComponentTicks, Components, StorageType},
1314
entity::{Entities, Entity, EntityLocation},
1415
storage::{SparseSetIndex, SparseSets, Storages, Table},
@@ -280,7 +281,7 @@ impl BundleInfo {
280281
components: &mut Components,
281282
storages: &'a mut Storages,
282283
archetype_id: ArchetypeId,
283-
change_tick: u32,
284+
change_tick: SmallTick,
284285
) -> BundleInserter<'a, 'b> {
285286
let new_archetype_id =
286287
self.add_bundle_to_archetype(archetypes, storages, components, archetype_id);
@@ -339,7 +340,7 @@ impl BundleInfo {
339340
archetypes: &'a mut Archetypes,
340341
components: &mut Components,
341342
storages: &'a mut Storages,
342-
change_tick: u32,
343+
change_tick: SmallTick,
343344
) -> BundleSpawner<'a, 'b> {
344345
let new_archetype_id =
345346
self.add_bundle_to_archetype(archetypes, storages, components, ArchetypeId::EMPTY);
@@ -380,7 +381,7 @@ impl BundleInfo {
380381
bundle_component_status: &S,
381382
entity: Entity,
382383
table_row: usize,
383-
change_tick: u32,
384+
change_tick: SmallTick,
384385
bundle: T,
385386
) {
386387
// NOTE: get_components calls this closure on each component in "bundle order".
@@ -397,7 +398,7 @@ impl BundleInfo {
397398
column.initialize(
398399
table_row,
399400
component_ptr,
400-
ComponentTicks::new(change_tick),
401+
ComponentTicks::new(change_tick.into()),
401402
);
402403
}
403404
ComponentStatus::Mutated => {
@@ -506,7 +507,7 @@ pub(crate) struct BundleInserter<'a, 'b> {
506507
sparse_sets: &'a mut SparseSets,
507508
result: InsertBundleResult<'a>,
508509
archetypes_ptr: *mut Archetype,
509-
change_tick: u32,
510+
change_tick: SmallTick,
510511
}
511512

512513
pub(crate) enum InsertBundleResult<'a> {
@@ -641,7 +642,7 @@ pub(crate) struct BundleSpawner<'a, 'b> {
641642
bundle_info: &'b BundleInfo,
642643
table: &'a mut Table,
643644
sparse_sets: &'a mut SparseSets,
644-
change_tick: u32,
645+
change_tick: SmallTick,
645646
}
646647

647648
impl<'a, 'b> BundleSpawner<'a, 'b> {

0 commit comments

Comments
 (0)