Move hashbrown
and foldhash
out of bevy_utils
(#17460)
# Objective - Contributes to #16877 ## Solution - Moved `hashbrown`, `foldhash`, and related types out of `bevy_utils` and into `bevy_platform_support` - Refactored the above to match the layout of these types in `std`. - Updated crates as required. ## Testing - CI --- ## Migration Guide - The following items were moved out of `bevy_utils` and into `bevy_platform_support::hash`: - `FixedState` - `DefaultHasher` - `RandomState` - `FixedHasher` - `Hashed` - `PassHash` - `PassHasher` - `NoOpHash` - The following items were moved out of `bevy_utils` and into `bevy_platform_support::collections`: - `HashMap` - `HashSet` - `bevy_utils::hashbrown` has been removed. Instead, import from `bevy_platform_support::collections` _or_ take a dependency on `hashbrown` directly. - `bevy_utils::Entry` has been removed. Instead, import from `bevy_platform_support::collections::hash_map` or `bevy_platform_support::collections::hash_set` as appropriate. - All of the above equally apply to `bevy::utils` and `bevy::platform_support`. ## Notes - I left `PreHashMap`, `PreHashMapExt`, and `TypeIdMap` in `bevy_utils` as they might be candidates for micro-crating. They can always be moved into `bevy_platform_support` at a later date if desired.
This commit is contained in:
parent
04990fcd27
commit
9bc0ae33c3
@ -24,6 +24,9 @@ bevy_reflect = { path = "../crates/bevy_reflect", features = ["functions"] }
|
|||||||
bevy_render = { path = "../crates/bevy_render" }
|
bevy_render = { path = "../crates/bevy_render" }
|
||||||
bevy_tasks = { path = "../crates/bevy_tasks" }
|
bevy_tasks = { path = "../crates/bevy_tasks" }
|
||||||
bevy_utils = { path = "../crates/bevy_utils" }
|
bevy_utils = { path = "../crates/bevy_utils" }
|
||||||
|
bevy_platform_support = { path = "../crates/bevy_platform_support", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
] }
|
||||||
|
|
||||||
# Other crates
|
# Other crates
|
||||||
glam = "0.29"
|
glam = "0.29"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use core::{fmt::Write, hint::black_box, iter, time::Duration};
|
use core::{fmt::Write, hint::black_box, iter, time::Duration};
|
||||||
|
|
||||||
use benches::bench;
|
use benches::bench;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::{DynamicMap, Map};
|
use bevy_reflect::{DynamicMap, Map};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use criterion::{
|
use criterion::{
|
||||||
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
|
criterion_group, measurement::Measurement, AxisScale, BatchSize, BenchmarkGroup, BenchmarkId,
|
||||||
Criterion, PlotConfiguration, Throughput,
|
Criterion, PlotConfiguration, Throughput,
|
||||||
|
@ -25,6 +25,10 @@ bevy_time = { path = "../bevy_time", version = "0.16.0-dev" }
|
|||||||
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
||||||
bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev" }
|
bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev" }
|
||||||
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
|
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
|
||||||
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
"serialize",
|
||||||
|
] }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
petgraph = { version = "0.6", features = ["serde-1"] }
|
petgraph = { version = "0.6", features = ["serde-1"] }
|
||||||
|
@ -89,21 +89,20 @@ use core::{
|
|||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
graph::AnimationNodeIndex,
|
||||||
|
prelude::{Animatable, BlendInput},
|
||||||
|
AnimationEntityMut, AnimationEvaluationError,
|
||||||
|
};
|
||||||
use bevy_ecs::component::{Component, Mutable};
|
use bevy_ecs::component::{Component, Mutable};
|
||||||
use bevy_math::curve::{
|
use bevy_math::curve::{
|
||||||
cores::{UnevenCore, UnevenCoreError},
|
cores::{UnevenCore, UnevenCoreError},
|
||||||
iterable::IterableCurve,
|
iterable::IterableCurve,
|
||||||
Curve, Interval,
|
Curve, Interval,
|
||||||
};
|
};
|
||||||
|
use bevy_platform_support::hash::Hashed;
|
||||||
use bevy_reflect::{FromReflect, Reflect, Reflectable, TypeInfo, Typed};
|
use bevy_reflect::{FromReflect, Reflect, Reflectable, TypeInfo, Typed};
|
||||||
use bevy_render::mesh::morph::MorphWeights;
|
use bevy_render::mesh::morph::MorphWeights;
|
||||||
|
|
||||||
use crate::{
|
|
||||||
graph::AnimationNodeIndex,
|
|
||||||
prelude::{Animatable, BlendInput},
|
|
||||||
AnimationEntityMut, AnimationEvaluationError,
|
|
||||||
};
|
|
||||||
use bevy_utils::Hashed;
|
|
||||||
use downcast_rs::{impl_downcast, Downcast};
|
use downcast_rs::{impl_downcast, Downcast};
|
||||||
|
|
||||||
/// A value on a component that Bevy can animate.
|
/// A value on a component that Bevy can animate.
|
||||||
|
@ -17,8 +17,8 @@ use bevy_ecs::{
|
|||||||
resource::Resource,
|
resource::Resource,
|
||||||
system::{Res, ResMut},
|
system::{Res, ResMut},
|
||||||
};
|
};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::{prelude::ReflectDefault, Reflect, ReflectSerialize};
|
use bevy_reflect::{prelude::ReflectDefault, Reflect, ReflectSerialize};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use derive_more::derive::From;
|
use derive_more::derive::From;
|
||||||
use petgraph::{
|
use petgraph::{
|
||||||
graph::{DiGraph, NodeIndex},
|
graph::{DiGraph, NodeIndex},
|
||||||
|
@ -40,10 +40,11 @@ use bevy_ecs::{
|
|||||||
world::EntityMutExcept,
|
world::EntityMutExcept,
|
||||||
};
|
};
|
||||||
use bevy_math::FloatOrd;
|
use bevy_math::FloatOrd;
|
||||||
|
use bevy_platform_support::{collections::HashMap, hash::NoOpHash};
|
||||||
use bevy_reflect::{prelude::ReflectDefault, Reflect, TypePath};
|
use bevy_reflect::{prelude::ReflectDefault, Reflect, TypePath};
|
||||||
use bevy_time::Time;
|
use bevy_time::Time;
|
||||||
use bevy_transform::TransformSystem;
|
use bevy_transform::TransformSystem;
|
||||||
use bevy_utils::{HashMap, NoOpHash, PreHashMap, PreHashMapExt, TypeIdMap};
|
use bevy_utils::{PreHashMap, PreHashMapExt, TypeIdMap};
|
||||||
use petgraph::graph::NodeIndex;
|
use petgraph::graph::NodeIndex;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use thread_local::ThreadLocal;
|
use thread_local::ThreadLocal;
|
||||||
@ -754,10 +755,10 @@ impl AnimationCurveEvaluators {
|
|||||||
.component_property_curve_evaluators
|
.component_property_curve_evaluators
|
||||||
.get_or_insert_with(component_property, func),
|
.get_or_insert_with(component_property, func),
|
||||||
EvaluatorId::Type(type_id) => match self.type_id_curve_evaluators.entry(type_id) {
|
EvaluatorId::Type(type_id) => match self.type_id_curve_evaluators.entry(type_id) {
|
||||||
bevy_utils::hashbrown::hash_map::Entry::Occupied(occupied_entry) => {
|
bevy_platform_support::collections::hash_map::Entry::Occupied(occupied_entry) => {
|
||||||
&mut **occupied_entry.into_mut()
|
&mut **occupied_entry.into_mut()
|
||||||
}
|
}
|
||||||
bevy_utils::hashbrown::hash_map::Entry::Vacant(vacant_entry) => {
|
bevy_platform_support::collections::hash_map::Entry::Vacant(vacant_entry) => {
|
||||||
&mut **vacant_entry.insert(func())
|
&mut **vacant_entry.insert(func())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@ use bevy_ecs::{
|
|||||||
schedule::{ScheduleBuildSettings, ScheduleLabel},
|
schedule::{ScheduleBuildSettings, ScheduleLabel},
|
||||||
system::{IntoObserverSystem, SystemId, SystemInput},
|
system::{IntoObserverSystem, SystemId, SystemInput},
|
||||||
};
|
};
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use core::{fmt::Debug, num::NonZero, panic::AssertUnwindSafe};
|
use core::{fmt::Debug, num::NonZero, panic::AssertUnwindSafe};
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -4,7 +4,8 @@ use alloc::{
|
|||||||
string::{String, ToString},
|
string::{String, ToString},
|
||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use bevy_utils::{hashbrown::hash_map::Entry, TypeIdMap};
|
use bevy_platform_support::collections::hash_map::Entry;
|
||||||
|
use bevy_utils::TypeIdMap;
|
||||||
use core::any::TypeId;
|
use core::any::TypeId;
|
||||||
use log::{debug, warn};
|
use log::{debug, warn};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use bevy_ecs::{
|
|||||||
schedule::{InternedScheduleLabel, ScheduleBuildSettings, ScheduleLabel},
|
schedule::{InternedScheduleLabel, ScheduleBuildSettings, ScheduleLabel},
|
||||||
system::{SystemId, SystemInput},
|
system::{SystemId, SystemInput},
|
||||||
};
|
};
|
||||||
use bevy_utils::{HashMap, HashSet};
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
|
||||||
#[cfg(feature = "trace")]
|
#[cfg(feature = "trace")]
|
||||||
|
@ -27,6 +27,9 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
|
|||||||
] }
|
] }
|
||||||
bevy_tasks = { path = "../bevy_tasks", version = "0.16.0-dev" }
|
bevy_tasks = { path = "../bevy_tasks", version = "0.16.0-dev" }
|
||||||
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
||||||
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
] }
|
||||||
|
|
||||||
stackfuture = "0.3"
|
stackfuture = "0.3"
|
||||||
atomicow = "1.0"
|
atomicow = "1.0"
|
||||||
|
@ -13,7 +13,7 @@ use bevy_ecs::{
|
|||||||
storage::{Table, TableRow},
|
storage::{Table, TableRow},
|
||||||
world::unsafe_world_cell::UnsafeWorldCell,
|
world::unsafe_world_cell::UnsafeWorldCell,
|
||||||
};
|
};
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use disqualified::ShortName;
|
use disqualified::ShortName;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
@ -9,8 +9,8 @@ use bevy_ecs::{
|
|||||||
resource::Resource,
|
resource::Resource,
|
||||||
system::{Res, ResMut, SystemChangeTick},
|
system::{Res, ResMut, SystemChangeTick},
|
||||||
};
|
};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::{Reflect, TypePath};
|
use bevy_reflect::{Reflect, TypePath};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::{any::TypeId, iter::Enumerate, marker::PhantomData, sync::atomic::AtomicU32};
|
use core::{any::TypeId, iter::Enumerate, marker::PhantomData, sync::atomic::AtomicU32};
|
||||||
use crossbeam_channel::{Receiver, Sender};
|
use crossbeam_channel::{Receiver, Sender};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -595,7 +595,7 @@ impl<A: Asset> Assets<A> {
|
|||||||
pub struct AssetsMutIterator<'a, A: Asset> {
|
pub struct AssetsMutIterator<'a, A: Asset> {
|
||||||
queued_events: &'a mut Vec<AssetEvent<A>>,
|
queued_events: &'a mut Vec<AssetEvent<A>>,
|
||||||
dense_storage: Enumerate<core::slice::IterMut<'a, Entry<A>>>,
|
dense_storage: Enumerate<core::slice::IterMut<'a, Entry<A>>>,
|
||||||
hash_map: bevy_utils::hashbrown::hash_map::IterMut<'a, Uuid, A>,
|
hash_map: bevy_platform_support::collections::hash_map::IterMut<'a, Uuid, A>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A: Asset> Iterator for AssetsMutIterator<'a, A> {
|
impl<'a, A: Asset> Iterator for AssetsMutIterator<'a, A> {
|
||||||
|
@ -515,8 +515,8 @@ pub enum UntypedAssetConversionError {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
use bevy_platform_support::hash::FixedHasher;
|
||||||
use bevy_reflect::PartialReflect;
|
use bevy_reflect::PartialReflect;
|
||||||
use bevy_utils::FixedHasher;
|
|
||||||
use core::hash::BuildHasher;
|
use core::hash::BuildHasher;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -420,7 +420,7 @@ mod tests {
|
|||||||
fn hash<T: Hash>(data: &T) -> u64 {
|
fn hash<T: Hash>(data: &T) -> u64 {
|
||||||
use core::hash::BuildHasher;
|
use core::hash::BuildHasher;
|
||||||
|
|
||||||
bevy_utils::FixedHasher.hash_one(data)
|
bevy_platform_support::hash::FixedHasher.hash_one(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Typed and Untyped `AssetIds` should be equivalent to each other and themselves
|
/// Typed and Untyped `AssetIds` should be equivalent to each other and themselves
|
||||||
|
@ -4,7 +4,7 @@ use crate::io::{
|
|||||||
AssetSourceEvent, AssetWatcher,
|
AssetSourceEvent, AssetWatcher,
|
||||||
};
|
};
|
||||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use notify_debouncer_full::{notify::RecommendedWatcher, Debouncer, RecommendedCache};
|
use notify_debouncer_full::{notify::RecommendedWatcher, Debouncer, RecommendedCache};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
@ -26,7 +26,9 @@ pub const EMBEDDED: &str = "embedded";
|
|||||||
pub struct EmbeddedAssetRegistry {
|
pub struct EmbeddedAssetRegistry {
|
||||||
dir: Dir,
|
dir: Dir,
|
||||||
#[cfg(feature = "embedded_watcher")]
|
#[cfg(feature = "embedded_watcher")]
|
||||||
root_paths: alloc::sync::Arc<parking_lot::RwLock<bevy_utils::HashMap<Box<Path>, PathBuf>>>,
|
root_paths: alloc::sync::Arc<
|
||||||
|
parking_lot::RwLock<bevy_platform_support::collections::HashMap<Box<Path>, PathBuf>>,
|
||||||
|
>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EmbeddedAssetRegistry {
|
impl EmbeddedAssetRegistry {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::io::{AssetReader, AssetReaderError, PathStream, Reader};
|
use crate::io::{AssetReader, AssetReaderError, PathStream, Reader};
|
||||||
use alloc::{boxed::Box, sync::Arc};
|
use alloc::{boxed::Box, sync::Arc};
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use crossbeam_channel::{Receiver, Sender};
|
use crossbeam_channel::{Receiver, Sender};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::io::{AssetReader, AssetReaderError, PathStream, Reader};
|
use crate::io::{AssetReader, AssetReaderError, PathStream, Reader};
|
||||||
use alloc::{borrow::ToOwned, boxed::Box, sync::Arc, vec::Vec};
|
use alloc::{borrow::ToOwned, boxed::Box, sync::Arc, vec::Vec};
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use core::{pin::Pin, task::Poll};
|
use core::{pin::Pin, task::Poll};
|
||||||
use futures_io::AsyncRead;
|
use futures_io::AsyncRead;
|
||||||
use futures_lite::{ready, Stream};
|
use futures_lite::{ready, Stream};
|
||||||
|
@ -9,7 +9,7 @@ use alloc::{
|
|||||||
};
|
};
|
||||||
use atomicow::CowArc;
|
use atomicow::CowArc;
|
||||||
use bevy_ecs::resource::Resource;
|
use bevy_ecs::resource::Resource;
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use core::{fmt::Display, hash::Hash, time::Duration};
|
use core::{fmt::Display, hash::Hash, time::Duration};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
|
@ -219,8 +219,8 @@ use bevy_ecs::{
|
|||||||
schedule::{IntoSystemConfigs, IntoSystemSetConfigs, SystemSet},
|
schedule::{IntoSystemConfigs, IntoSystemSetConfigs, SystemSet},
|
||||||
world::FromWorld,
|
world::FromWorld,
|
||||||
};
|
};
|
||||||
|
use bevy_platform_support::collections::HashSet;
|
||||||
use bevy_reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath};
|
use bevy_reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath};
|
||||||
use bevy_utils::HashSet;
|
|
||||||
use core::any::TypeId;
|
use core::any::TypeId;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
@ -653,8 +653,8 @@ mod tests {
|
|||||||
schedule::{LogLevel, ScheduleBuildSettings},
|
schedule::{LogLevel, ScheduleBuildSettings},
|
||||||
};
|
};
|
||||||
use bevy_log::LogPlugin;
|
use bevy_log::LogPlugin;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::TypePath;
|
use bevy_reflect::TypePath;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -13,8 +13,8 @@ use alloc::{
|
|||||||
};
|
};
|
||||||
use atomicow::CowArc;
|
use atomicow::CowArc;
|
||||||
use bevy_ecs::world::World;
|
use bevy_ecs::world::World;
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_tasks::{BoxedFuture, ConditionalSendFuture};
|
use bevy_tasks::{BoxedFuture, ConditionalSendFuture};
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
use core::any::{Any, TypeId};
|
use core::any::{Any, TypeId};
|
||||||
use downcast_rs::{impl_downcast, Downcast};
|
use downcast_rs::{impl_downcast, Downcast};
|
||||||
use ron::error::SpannedError;
|
use ron::error::SpannedError;
|
||||||
|
@ -5,7 +5,7 @@ use alloc::{
|
|||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use async_fs::File;
|
use async_fs::File;
|
||||||
use bevy_utils::HashSet;
|
use bevy_platform_support::collections::HashSet;
|
||||||
use futures_lite::{AsyncReadExt, AsyncWriteExt};
|
use futures_lite::{AsyncReadExt, AsyncWriteExt};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -58,8 +58,8 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use alloc::{borrow::ToOwned, boxed::Box, collections::VecDeque, sync::Arc, vec, vec::Vec};
|
use alloc::{borrow::ToOwned, boxed::Box, collections::VecDeque, sync::Arc, vec, vec::Vec};
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_tasks::IoTaskPool;
|
use bevy_tasks::IoTaskPool;
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
use futures_io::ErrorKind;
|
use futures_io::ErrorKind;
|
||||||
use futures_lite::{AsyncReadExt, AsyncWriteExt, StreamExt};
|
use futures_lite::{AsyncReadExt, AsyncWriteExt, StreamExt};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
@ -4,8 +4,8 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use atomicow::CowArc;
|
use atomicow::CowArc;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_tasks::{BoxedFuture, ConditionalSendFuture};
|
use bevy_tasks::{BoxedFuture, ConditionalSendFuture};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::{borrow::Borrow, hash::Hash, ops::Deref};
|
use core::{borrow::Borrow, hash::Hash, ops::Deref};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@ use alloc::{
|
|||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use bevy_ecs::world::World;
|
use bevy_ecs::world::World;
|
||||||
|
use bevy_platform_support::collections::{hash_map::Entry, HashMap, HashSet};
|
||||||
use bevy_tasks::Task;
|
use bevy_tasks::Task;
|
||||||
use bevy_utils::{Entry, HashMap, HashSet, TypeIdMap};
|
use bevy_utils::TypeIdMap;
|
||||||
use core::{any::TypeId, task::Waker};
|
use core::{any::TypeId, task::Waker};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use either::Either;
|
use either::Either;
|
||||||
|
@ -4,8 +4,9 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||||
use async_broadcast::RecvError;
|
use async_broadcast::RecvError;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_tasks::IoTaskPool;
|
use bevy_tasks::IoTaskPool;
|
||||||
use bevy_utils::{HashMap, TypeIdMap};
|
use bevy_utils::TypeIdMap;
|
||||||
use core::any::TypeId;
|
use core::any::TypeId;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
@ -25,8 +25,8 @@ use alloc::{
|
|||||||
};
|
};
|
||||||
use atomicow::CowArc;
|
use atomicow::CowArc;
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
|
use bevy_platform_support::collections::HashSet;
|
||||||
use bevy_tasks::IoTaskPool;
|
use bevy_tasks::IoTaskPool;
|
||||||
use bevy_utils::HashSet;
|
|
||||||
use core::{any::TypeId, future::Future, panic::AssertUnwindSafe, task::Poll};
|
use core::{any::TypeId, future::Future, panic::AssertUnwindSafe, task::Poll};
|
||||||
use crossbeam_channel::{Receiver, Sender};
|
use crossbeam_channel::{Receiver, Sender};
|
||||||
use either::Either;
|
use either::Either;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use crate::{meta::Settings, Asset, ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle};
|
use crate::{meta::Settings, Asset, ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle};
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use atomicow::CowArc;
|
use atomicow::CowArc;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_tasks::ConditionalSendFuture;
|
use bevy_tasks::ConditionalSendFuture;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::{
|
use core::{
|
||||||
borrow::Borrow,
|
borrow::Borrow,
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
|
@ -37,6 +37,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
|||||||
bevy_window = { path = "../bevy_window", version = "0.16.0-dev" }
|
bevy_window = { path = "../bevy_window", version = "0.16.0-dev" }
|
||||||
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
"std",
|
"std",
|
||||||
|
"serialize",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
|
use bevy_platform_support::collections::{hash_map::Entry, HashMap};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
render_resource::{StorageBuffer, UniformBuffer},
|
render_resource::{StorageBuffer, UniformBuffer},
|
||||||
renderer::{RenderDevice, RenderQueue},
|
renderer::{RenderDevice, RenderQueue},
|
||||||
sync_world::RenderEntity,
|
sync_world::RenderEntity,
|
||||||
Extract,
|
Extract,
|
||||||
};
|
};
|
||||||
use bevy_utils::{Entry, HashMap};
|
|
||||||
|
|
||||||
use super::{pipeline::AutoExposureUniform, AutoExposure};
|
use super::{pipeline::AutoExposureUniform, AutoExposure};
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@ pub mod graph {
|
|||||||
use core::ops::Range;
|
use core::ops::Range;
|
||||||
|
|
||||||
use bevy_asset::UntypedAssetId;
|
use bevy_asset::UntypedAssetId;
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
batching::gpu_preprocessing::GpuPreprocessingMode,
|
batching::gpu_preprocessing::GpuPreprocessingMode,
|
||||||
render_phase::PhaseItemBatchSetKey,
|
render_phase::PhaseItemBatchSetKey,
|
||||||
view::{ExtractedView, RetainedViewEntity},
|
view::{ExtractedView, RetainedViewEntity},
|
||||||
};
|
};
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
pub use camera_2d::*;
|
pub use camera_2d::*;
|
||||||
pub use main_opaque_pass_2d_node::*;
|
pub use main_opaque_pass_2d_node::*;
|
||||||
pub use main_transparent_pass_2d_node::*;
|
pub use main_transparent_pass_2d_node::*;
|
||||||
|
@ -81,6 +81,7 @@ use bevy_color::LinearRgba;
|
|||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
use bevy_image::BevyDefault;
|
use bevy_image::BevyDefault;
|
||||||
use bevy_math::FloatOrd;
|
use bevy_math::FloatOrd;
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
camera::{Camera, ExtractedCamera},
|
camera::{Camera, ExtractedCamera},
|
||||||
extract_component::ExtractComponentPlugin,
|
extract_component::ExtractComponentPlugin,
|
||||||
@ -101,7 +102,6 @@ use bevy_render::{
|
|||||||
view::{ExtractedView, ViewDepthTexture, ViewTarget},
|
view::{ExtractedView, ViewDepthTexture, ViewTarget},
|
||||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||||
};
|
};
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
use nonmax::NonMaxU32;
|
use nonmax::NonMaxU32;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ use bevy_app::prelude::*;
|
|||||||
use bevy_asset::{load_internal_asset, Handle};
|
use bevy_asset::{load_internal_asset, Handle};
|
||||||
use bevy_ecs::{component::*, prelude::*};
|
use bevy_ecs::{component::*, prelude::*};
|
||||||
use bevy_math::UVec2;
|
use bevy_math::UVec2;
|
||||||
|
use bevy_platform_support::collections::HashSet;
|
||||||
use bevy_platform_support::time::Instant;
|
use bevy_platform_support::time::Instant;
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
@ -17,7 +18,6 @@ use bevy_render::{
|
|||||||
view::Msaa,
|
view::Msaa,
|
||||||
Render, RenderApp, RenderSet,
|
Render, RenderApp, RenderSet,
|
||||||
};
|
};
|
||||||
use bevy_utils::HashSet;
|
|
||||||
use bevy_window::PrimaryWindow;
|
use bevy_window::PrimaryWindow;
|
||||||
use resolve::{
|
use resolve::{
|
||||||
node::{OitResolveNode, OitResolvePass},
|
node::{OitResolveNode, OitResolvePass},
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
use crate::blit::{BlitPipeline, BlitPipelineKey};
|
use crate::blit::{BlitPipeline, BlitPipelineKey};
|
||||||
use bevy_app::prelude::*;
|
use bevy_app::prelude::*;
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
|
use bevy_platform_support::collections::HashSet;
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
camera::{CameraOutputMode, ExtractedCamera},
|
camera::{CameraOutputMode, ExtractedCamera},
|
||||||
render_resource::*,
|
render_resource::*,
|
||||||
view::ViewTarget,
|
view::ViewTarget,
|
||||||
Render, RenderApp, RenderSet,
|
Render, RenderApp, RenderSet,
|
||||||
};
|
};
|
||||||
use bevy_utils::HashSet;
|
|
||||||
|
|
||||||
mod node;
|
mod node;
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ serialize = [
|
|||||||
"bevy_ecs/serialize",
|
"bevy_ecs/serialize",
|
||||||
"bevy_time/serialize",
|
"bevy_time/serialize",
|
||||||
"bevy_utils/serde",
|
"bevy_utils/serde",
|
||||||
|
"bevy_platform_support/serialize",
|
||||||
]
|
]
|
||||||
|
|
||||||
## Disables diagnostics that are unsupported when Bevy is dynamically linked
|
## Disables diagnostics that are unsupported when Bevy is dynamically linked
|
||||||
|
@ -7,8 +7,7 @@ use core::{
|
|||||||
use bevy_app::{App, SubApp};
|
use bevy_app::{App, SubApp};
|
||||||
use bevy_ecs::resource::Resource;
|
use bevy_ecs::resource::Resource;
|
||||||
use bevy_ecs::system::{Deferred, Res, SystemBuffer, SystemParam};
|
use bevy_ecs::system::{Deferred, Res, SystemBuffer, SystemParam};
|
||||||
use bevy_platform_support::time::Instant;
|
use bevy_platform_support::{collections::HashMap, hash::PassHash, time::Instant};
|
||||||
use bevy_utils::{HashMap, PassHash};
|
|
||||||
use const_fnv1a_hash::fnv1a_hash_str_64;
|
use const_fnv1a_hash::fnv1a_hash_str_64;
|
||||||
|
|
||||||
use crate::DEFAULT_MAX_HISTORY_LENGTH;
|
use crate::DEFAULT_MAX_HISTORY_LENGTH;
|
||||||
|
@ -20,7 +20,7 @@ default = ["std", "bevy_reflect", "async_executor"]
|
|||||||
multi_threaded = ["bevy_tasks/multi_threaded", "dep:arrayvec"]
|
multi_threaded = ["bevy_tasks/multi_threaded", "dep:arrayvec"]
|
||||||
|
|
||||||
## Adds serialization support through `serde`.
|
## Adds serialization support through `serde`.
|
||||||
serialize = ["dep:serde", "bevy_utils/serde"]
|
serialize = ["dep:serde", "bevy_utils/serde", "bevy_platform_support/serialize"]
|
||||||
|
|
||||||
## Adds runtime reflection support using `bevy_reflect`.
|
## Adds runtime reflection support using `bevy_reflect`.
|
||||||
bevy_reflect = ["dep:bevy_reflect"]
|
bevy_reflect = ["dep:bevy_reflect"]
|
||||||
|
@ -27,7 +27,7 @@ use crate::{
|
|||||||
storage::{ImmutableSparseSet, SparseArray, SparseSet, SparseSetIndex, TableId, TableRow},
|
storage::{ImmutableSparseSet, SparseArray, SparseSet, SparseSetIndex, TableId, TableRow},
|
||||||
};
|
};
|
||||||
use alloc::{boxed::Box, vec::Vec};
|
use alloc::{boxed::Box, vec::Vec};
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use core::{
|
use core::{
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
ops::{Index, IndexMut, RangeFrom},
|
ops::{Index, IndexMut, RangeFrom},
|
||||||
|
@ -21,8 +21,9 @@ use crate::{
|
|||||||
world::{unsafe_world_cell::UnsafeWorldCell, ON_ADD, ON_INSERT, ON_REPLACE},
|
world::{unsafe_world_cell::UnsafeWorldCell, ON_ADD, ON_INSERT, ON_REPLACE},
|
||||||
};
|
};
|
||||||
use alloc::{boxed::Box, vec, vec::Vec};
|
use alloc::{boxed::Box, vec, vec::Vec};
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_ptr::{ConstNonNull, OwningPtr};
|
use bevy_ptr::{ConstNonNull, OwningPtr};
|
||||||
use bevy_utils::{HashMap, HashSet, TypeIdMap};
|
use bevy_utils::TypeIdMap;
|
||||||
#[cfg(feature = "track_location")]
|
#[cfg(feature = "track_location")]
|
||||||
use core::panic::Location;
|
use core::panic::Location;
|
||||||
use core::{any::TypeId, ptr::NonNull};
|
use core::{any::TypeId, ptr::NonNull};
|
||||||
|
@ -16,11 +16,12 @@ use crate::{
|
|||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use alloc::{borrow::Cow, format, vec::Vec};
|
use alloc::{borrow::Cow, format, vec::Vec};
|
||||||
pub use bevy_ecs_macros::Component;
|
pub use bevy_ecs_macros::Component;
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_platform_support::sync::Arc;
|
use bevy_platform_support::sync::Arc;
|
||||||
use bevy_ptr::{OwningPtr, UnsafeCellDeref};
|
use bevy_ptr::{OwningPtr, UnsafeCellDeref};
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
use bevy_utils::{HashMap, HashSet, TypeIdMap};
|
use bevy_utils::TypeIdMap;
|
||||||
use core::{
|
use core::{
|
||||||
alloc::Layout,
|
alloc::Layout,
|
||||||
any::{Any, TypeId},
|
any::{Any, TypeId},
|
||||||
@ -531,7 +532,7 @@ pub struct HookContext {
|
|||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use bevy_ecs::prelude::*;
|
/// use bevy_ecs::prelude::*;
|
||||||
/// use bevy_utils::HashSet;
|
/// use bevy_platform_support::collections::HashSet;
|
||||||
///
|
///
|
||||||
/// #[derive(Component)]
|
/// #[derive(Component)]
|
||||||
/// struct MyTrackedComponent;
|
/// struct MyTrackedComponent;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use alloc::{borrow::ToOwned, vec::Vec};
|
use alloc::{borrow::ToOwned, vec::Vec};
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_platform_support::sync::Arc;
|
use bevy_platform_support::sync::Arc;
|
||||||
use bevy_ptr::{Ptr, PtrMut};
|
use bevy_ptr::{Ptr, PtrMut};
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use core::{any::TypeId, ptr::NonNull};
|
use core::{any::TypeId, ptr::NonNull};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ impl BuildHasher for EntityHash {
|
|||||||
///
|
///
|
||||||
/// If you have an unusual case -- say all your indices are multiples of 256
|
/// If you have an unusual case -- say all your indices are multiples of 256
|
||||||
/// or most of the entities are dead generations -- then you might want also to
|
/// or most of the entities are dead generations -- then you might want also to
|
||||||
/// try [`DefaultHasher`](bevy_utils::DefaultHasher) for a slower hash
|
/// try [`DefaultHasher`](bevy_platform_support::hash::DefaultHasher) for a slower hash
|
||||||
/// computation but fewer lookup conflicts.
|
/// computation but fewer lookup conflicts.
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct EntityHasher {
|
pub struct EntityHasher {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Contains the [`EntityHashMap`] type, a [`HashMap`] pre-configured to use [`EntityHash`] hashing.
|
//! Contains the [`EntityHashMap`] type, a [`HashMap`] pre-configured to use [`EntityHash`] hashing.
|
||||||
//!
|
//!
|
||||||
//! This module is a lightweight wrapper around [`hashbrown`](bevy_utils::hashbrown)'s [`HashMap`] that is more performant for [`Entity`] keys.
|
//! This module is a lightweight wrapper around Bevy's [`HashMap`] that is more performant for [`Entity`] keys.
|
||||||
|
|
||||||
use core::{
|
use core::{
|
||||||
fmt::{self, Debug, Formatter},
|
fmt::{self, Debug, Formatter},
|
||||||
@ -9,9 +9,9 @@ use core::{
|
|||||||
ops::{Deref, DerefMut, Index},
|
ops::{Deref, DerefMut, Index},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use bevy_platform_support::collections::hash_map::{self, HashMap};
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
use bevy_utils::hashbrown::hash_map::{self, HashMap};
|
|
||||||
|
|
||||||
use super::{Entity, EntityHash, EntitySetIterator, TrustedEntityBorrow};
|
use super::{Entity, EntityHash, EntitySetIterator, TrustedEntityBorrow};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Contains the [`EntityHashSet`] type, a [`HashSet`] pre-configured to use [`EntityHash`] hashing.
|
//! Contains the [`EntityHashSet`] type, a [`HashSet`] pre-configured to use [`EntityHash`] hashing.
|
||||||
//!
|
//!
|
||||||
//! This module is a lightweight wrapper around [`hashbrown`](bevy_utils::hashbrown)'s [`HashSet`] that is more performant for [`Entity`] keys.
|
//! This module is a lightweight wrapper around Bevy's [`HashSet`] that is more performant for [`Entity`] keys.
|
||||||
|
|
||||||
use core::{
|
use core::{
|
||||||
fmt::{self, Debug, Formatter},
|
fmt::{self, Debug, Formatter},
|
||||||
@ -12,9 +12,9 @@ use core::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use bevy_platform_support::collections::hash_set::{self, HashSet};
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
use bevy_utils::hashbrown::hash_set::{self, HashSet};
|
|
||||||
|
|
||||||
use super::{Entity, EntityHash, EntitySetIterator};
|
use super::{Entity, EntityHash, EntitySetIterator};
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use super::{hash_map::EntityHashMap, VisitEntitiesMut};
|
|||||||
/// Implementing this trait correctly is required for properly loading components
|
/// Implementing this trait correctly is required for properly loading components
|
||||||
/// with entity references from scenes.
|
/// with entity references from scenes.
|
||||||
///
|
///
|
||||||
/// [`HashSet<Entity>`]: bevy_utils::HashSet
|
/// [`HashSet<Entity>`]: bevy_platform_support::collections::HashSet
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
///
|
///
|
||||||
|
@ -62,7 +62,7 @@ mod tests {
|
|||||||
world::World,
|
world::World,
|
||||||
};
|
};
|
||||||
use alloc::{string::String, vec, vec::Vec};
|
use alloc::{string::String, vec, vec::Vec};
|
||||||
use bevy_utils::HashSet;
|
use bevy_platform_support::collections::HashSet;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -5,11 +5,13 @@
|
|||||||
//! and make comparisons for any type as fast as integers.
|
//! and make comparisons for any type as fast as integers.
|
||||||
|
|
||||||
use alloc::{borrow::ToOwned, boxed::Box};
|
use alloc::{borrow::ToOwned, boxed::Box};
|
||||||
|
use bevy_platform_support::{
|
||||||
|
collections::HashSet,
|
||||||
|
hash::FixedHasher,
|
||||||
|
sync::{PoisonError, RwLock},
|
||||||
|
};
|
||||||
use core::{fmt::Debug, hash::Hash, ops::Deref};
|
use core::{fmt::Debug, hash::Hash, ops::Deref};
|
||||||
|
|
||||||
use bevy_platform_support::sync::{PoisonError, RwLock};
|
|
||||||
use bevy_utils::{FixedHasher, HashSet};
|
|
||||||
|
|
||||||
/// An interned value. Will stay valid until the end of the program and will not drop.
|
/// An interned value. Will stay valid until the end of the program and will not drop.
|
||||||
///
|
///
|
||||||
/// For details on interning, see [the module level docs](self).
|
/// For details on interning, see [the module level docs](self).
|
||||||
@ -168,7 +170,7 @@ impl<T: ?Sized> Default for Interner<T> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use alloc::{boxed::Box, string::ToString};
|
use alloc::{boxed::Box, string::ToString};
|
||||||
use bevy_utils::FixedHasher;
|
use bevy_platform_support::hash::FixedHasher;
|
||||||
use core::hash::{BuildHasher, Hash, Hasher};
|
use core::hash::{BuildHasher, Hash, Hasher};
|
||||||
|
|
||||||
use crate::intern::{Internable, Interned, Interner};
|
use crate::intern::{Internable, Interned, Interner};
|
||||||
|
@ -146,8 +146,8 @@ mod tests {
|
|||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use bevy_ecs_macros::{VisitEntities, VisitEntitiesMut};
|
use bevy_ecs_macros::{VisitEntities, VisitEntitiesMut};
|
||||||
|
use bevy_platform_support::collections::HashSet;
|
||||||
use bevy_tasks::{ComputeTaskPool, TaskPool};
|
use bevy_tasks::{ComputeTaskPool, TaskPool};
|
||||||
use bevy_utils::HashSet;
|
|
||||||
use core::{
|
use core::{
|
||||||
any::TypeId,
|
any::TypeId,
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
|
@ -6,7 +6,7 @@ use alloc::{
|
|||||||
borrow::{Cow, ToOwned},
|
borrow::{Cow, ToOwned},
|
||||||
string::String,
|
string::String,
|
||||||
};
|
};
|
||||||
use bevy_utils::FixedHasher;
|
use bevy_platform_support::hash::FixedHasher;
|
||||||
use core::{
|
use core::{
|
||||||
hash::{BuildHasher, Hash, Hasher},
|
hash::{BuildHasher, Hash, Hasher},
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
|
@ -15,8 +15,8 @@ use crate::{
|
|||||||
world::{DeferredWorld, *},
|
world::{DeferredWorld, *},
|
||||||
};
|
};
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_ptr::Ptr;
|
use bevy_ptr::Ptr;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::{
|
use core::{
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
@ -846,8 +846,8 @@ mod tests {
|
|||||||
#[cfg(feature = "track_location")]
|
#[cfg(feature = "track_location")]
|
||||||
use core::panic::Location;
|
use core::panic::Location;
|
||||||
|
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_ptr::OwningPtr;
|
use bevy_ptr::OwningPtr;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
|
|
||||||
use crate as bevy_ecs;
|
use crate as bevy_ecs;
|
||||||
use crate::component::ComponentId;
|
use crate::component::ComponentId;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
//! [`petgraph`]: https://docs.rs/petgraph/0.6.5/petgraph/
|
//! [`petgraph`]: https://docs.rs/petgraph/0.6.5/petgraph/
|
||||||
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use bevy_utils::{hashbrown::HashSet, FixedHasher};
|
use bevy_platform_support::{collections::HashSet, hash::FixedHasher};
|
||||||
use core::{
|
use core::{
|
||||||
fmt,
|
fmt,
|
||||||
hash::{BuildHasher, Hash},
|
hash::{BuildHasher, Hash},
|
||||||
|
@ -2,7 +2,7 @@ use alloc::{vec, vec::Vec};
|
|||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
use bevy_utils::{HashMap, HashSet};
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use fixedbitset::FixedBitSet;
|
use fixedbitset::FixedBitSet;
|
||||||
|
|
||||||
use crate::schedule::set::*;
|
use crate::schedule::set::*;
|
||||||
|
@ -10,7 +10,8 @@ use alloc::{
|
|||||||
vec,
|
vec,
|
||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use bevy_utils::{default, HashMap, HashSet};
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
|
use bevy_utils::default;
|
||||||
use core::fmt::{Debug, Write};
|
use core::fmt::{Debug, Write};
|
||||||
use disqualified::ShortName;
|
use disqualified::ShortName;
|
||||||
use fixedbitset::FixedBitSet;
|
use fixedbitset::FixedBitSet;
|
||||||
|
@ -4,7 +4,8 @@ use crate::{
|
|||||||
system::{IntoSystem, ResMut},
|
system::{IntoSystem, ResMut},
|
||||||
};
|
};
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use bevy_utils::{HashMap, TypeIdMap};
|
use bevy_platform_support::collections::HashMap;
|
||||||
|
use bevy_utils::TypeIdMap;
|
||||||
use core::any::TypeId;
|
use core::any::TypeId;
|
||||||
use fixedbitset::FixedBitSet;
|
use fixedbitset::FixedBitSet;
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
|
@ -6,8 +6,8 @@ use crate::{
|
|||||||
storage::{blob_vec::BlobVec, ImmutableSparseSet, SparseSet},
|
storage::{blob_vec::BlobVec, ImmutableSparseSet, SparseSet},
|
||||||
};
|
};
|
||||||
use alloc::{boxed::Box, vec, vec::Vec};
|
use alloc::{boxed::Box, vec, vec::Vec};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_ptr::{OwningPtr, Ptr, UnsafeCellDeref};
|
use bevy_ptr::{OwningPtr, Ptr, UnsafeCellDeref};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
pub use column::*;
|
pub use column::*;
|
||||||
#[cfg(feature = "track_location")]
|
#[cfg(feature = "track_location")]
|
||||||
use core::panic::Location;
|
use core::panic::Location;
|
||||||
|
@ -19,8 +19,8 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_ptr::{OwningPtr, Ptr};
|
use bevy_ptr::{OwningPtr, Ptr};
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
#[cfg(feature = "track_location")]
|
#[cfg(feature = "track_location")]
|
||||||
use core::panic::Location;
|
use core::panic::Location;
|
||||||
use core::{
|
use core::{
|
||||||
@ -244,7 +244,7 @@ impl<'w> EntityRef<'w> {
|
|||||||
/// ## [`HashSet`] of [`ComponentId`]s
|
/// ## [`HashSet`] of [`ComponentId`]s
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use bevy_utils::HashSet;
|
/// # use bevy_platform_support::collections::HashSet;
|
||||||
/// # use bevy_ecs::{prelude::*, component::ComponentId};
|
/// # use bevy_ecs::{prelude::*, component::ComponentId};
|
||||||
/// #
|
/// #
|
||||||
/// # #[derive(Component, PartialEq, Debug)]
|
/// # #[derive(Component, PartialEq, Debug)]
|
||||||
@ -787,7 +787,7 @@ impl<'w> EntityMut<'w> {
|
|||||||
/// ## [`HashSet`] of [`ComponentId`]s
|
/// ## [`HashSet`] of [`ComponentId`]s
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use bevy_utils::HashSet;
|
/// # use bevy_platform_support::collections::HashSet;
|
||||||
/// # use bevy_ecs::{prelude::*, component::ComponentId};
|
/// # use bevy_ecs::{prelude::*, component::ComponentId};
|
||||||
/// #
|
/// #
|
||||||
/// # #[derive(Component, PartialEq, Debug)]
|
/// # #[derive(Component, PartialEq, Debug)]
|
||||||
|
@ -3778,7 +3778,7 @@ mod tests {
|
|||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use bevy_ecs_macros::Component;
|
use bevy_ecs_macros::Component;
|
||||||
use bevy_utils::{HashMap, HashSet};
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use core::{
|
use core::{
|
||||||
any::TypeId,
|
any::TypeId,
|
||||||
panic,
|
panic,
|
||||||
|
@ -15,6 +15,9 @@ bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev" }
|
|||||||
bevy_input = { path = "../bevy_input", version = "0.16.0-dev" }
|
bevy_input = { path = "../bevy_input", version = "0.16.0-dev" }
|
||||||
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
||||||
bevy_time = { path = "../bevy_time", version = "0.16.0-dev" }
|
bevy_time = { path = "../bevy_time", version = "0.16.0-dev" }
|
||||||
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
] }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
gilrs = "0.11.0"
|
gilrs = "0.11.0"
|
||||||
|
@ -18,7 +18,8 @@ use bevy_app::{App, Plugin, PostUpdate, PreStartup, PreUpdate};
|
|||||||
use bevy_ecs::entity::hash_map::EntityHashMap;
|
use bevy_ecs::entity::hash_map::EntityHashMap;
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
use bevy_input::InputSystem;
|
use bevy_input::InputSystem;
|
||||||
use bevy_utils::{synccell::SyncCell, HashMap};
|
use bevy_platform_support::collections::HashMap;
|
||||||
|
use bevy_utils::synccell::SyncCell;
|
||||||
use gilrs::GilrsBuilder;
|
use gilrs::GilrsBuilder;
|
||||||
use gilrs_system::{gilrs_event_startup_system, gilrs_event_system};
|
use gilrs_system::{gilrs_event_startup_system, gilrs_event_system};
|
||||||
use rumble::{play_gilrs_rumble, RunningRumbleEffects};
|
use rumble::{play_gilrs_rumble, RunningRumbleEffects};
|
||||||
|
@ -4,8 +4,9 @@ use bevy_ecs::prelude::{EventReader, Res, ResMut, Resource};
|
|||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
use bevy_ecs::system::NonSendMut;
|
use bevy_ecs::system::NonSendMut;
|
||||||
use bevy_input::gamepad::{GamepadRumbleIntensity, GamepadRumbleRequest};
|
use bevy_input::gamepad::{GamepadRumbleIntensity, GamepadRumbleRequest};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_time::{Real, Time};
|
use bevy_time::{Real, Time};
|
||||||
use bevy_utils::{synccell::SyncCell, HashMap};
|
use bevy_utils::synccell::SyncCell;
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use gilrs::{
|
use gilrs::{
|
||||||
ff::{self, BaseEffect, BaseEffectType, Repeat, Replay},
|
ff::{self, BaseEffect, BaseEffectType, Repeat, Replay},
|
||||||
|
@ -37,6 +37,10 @@ bevy_scene = { path = "../bevy_scene", version = "0.16.0-dev", features = [
|
|||||||
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
|
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
|
||||||
bevy_tasks = { path = "../bevy_tasks", version = "0.16.0-dev" }
|
bevy_tasks = { path = "../bevy_tasks", version = "0.16.0-dev" }
|
||||||
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
||||||
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
"serialize",
|
||||||
|
] }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
gltf = { version = "1.4.0", default-features = false, features = [
|
gltf = { version = "1.4.0", default-features = false, features = [
|
||||||
|
@ -94,7 +94,7 @@ extern crate alloc;
|
|||||||
|
|
||||||
#[cfg(feature = "bevy_animation")]
|
#[cfg(feature = "bevy_animation")]
|
||||||
use bevy_animation::AnimationClip;
|
use bevy_animation::AnimationClip;
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
|
|
||||||
mod loader;
|
mod loader;
|
||||||
mod vertex_attributes;
|
mod vertex_attributes;
|
||||||
|
@ -24,6 +24,7 @@ use bevy_pbr::{
|
|||||||
DirectionalLight, MeshMaterial3d, PointLight, SpotLight, StandardMaterial, UvChannel,
|
DirectionalLight, MeshMaterial3d, PointLight, SpotLight, StandardMaterial, UvChannel,
|
||||||
MAX_JOINTS,
|
MAX_JOINTS,
|
||||||
};
|
};
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
alpha::AlphaMode,
|
alpha::AlphaMode,
|
||||||
camera::{Camera, OrthographicProjection, PerspectiveProjection, Projection, ScalingMode},
|
camera::{Camera, OrthographicProjection, PerspectiveProjection, Projection, ScalingMode},
|
||||||
@ -41,7 +42,6 @@ use bevy_scene::Scene;
|
|||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use bevy_tasks::IoTaskPool;
|
use bevy_tasks::IoTaskPool;
|
||||||
use bevy_transform::components::Transform;
|
use bevy_transform::components::Transform;
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
use gltf::{
|
use gltf::{
|
||||||
accessor::Iter,
|
accessor::Iter,
|
||||||
image::Source,
|
image::Source,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
mesh::{MeshVertexAttribute, VertexAttributeValues as Values},
|
mesh::{MeshVertexAttribute, VertexAttributeValues as Values},
|
||||||
prelude::Mesh,
|
prelude::Mesh,
|
||||||
render_resource::VertexFormat,
|
render_resource::VertexFormat,
|
||||||
};
|
};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use gltf::{
|
use gltf::{
|
||||||
accessor::{DataType, Dimensions},
|
accessor::{DataType, Dimensions},
|
||||||
mesh::util::{ReadColors, ReadJoints, ReadTexCoords, ReadWeights},
|
mesh::util::{ReadColors, ReadJoints, ReadTexCoords, ReadWeights},
|
||||||
|
@ -30,7 +30,11 @@ qoi = ["image/qoi"]
|
|||||||
tga = ["image/tga"]
|
tga = ["image/tga"]
|
||||||
tiff = ["image/tiff"]
|
tiff = ["image/tiff"]
|
||||||
webp = ["image/webp"]
|
webp = ["image/webp"]
|
||||||
serialize = ["bevy_reflect"]
|
serialize = [
|
||||||
|
"bevy_reflect",
|
||||||
|
"bevy_platform_support/serialize",
|
||||||
|
"bevy_utils/serde",
|
||||||
|
]
|
||||||
|
|
||||||
# For ktx2 supercompression
|
# For ktx2 supercompression
|
||||||
zlib = ["flate2"]
|
zlib = ["flate2"]
|
||||||
@ -49,6 +53,9 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
|
|||||||
"bevy",
|
"bevy",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
||||||
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
] }
|
||||||
|
|
||||||
# rendering
|
# rendering
|
||||||
image = { version = "0.25.2", default-features = false }
|
image = { version = "0.25.2", default-features = false }
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use bevy_app::prelude::*;
|
use bevy_app::prelude::*;
|
||||||
use bevy_asset::{Asset, AssetApp as _, AssetId, Assets, Handle};
|
use bevy_asset::{Asset, AssetApp as _, AssetId, Assets, Handle};
|
||||||
use bevy_math::{URect, UVec2};
|
use bevy_math::{URect, UVec2};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
|
|
||||||
use crate::Image;
|
use crate::Image;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use bevy_asset::{AssetId, RenderAssetUsages};
|
use bevy_asset::{AssetId, RenderAssetUsages};
|
||||||
use bevy_math::{URect, UVec2};
|
use bevy_math::{URect, UVec2};
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use rectangle_pack::{
|
use rectangle_pack::{
|
||||||
contains_smallest_box, pack_rects, volume_heuristic, GroupedRectsToPlace, PackedLocation,
|
contains_smallest_box, pack_rects, volume_heuristic, GroupedRectsToPlace, PackedLocation,
|
||||||
RectToInsert, TargetBin,
|
RectToInsert, TargetBin,
|
||||||
|
@ -27,6 +27,7 @@ serialize = [
|
|||||||
"smol_str/serde",
|
"smol_str/serde",
|
||||||
"bevy_ecs/serialize",
|
"bevy_ecs/serialize",
|
||||||
"bevy_math/serialize",
|
"bevy_math/serialize",
|
||||||
|
"bevy_platform_support/serialize",
|
||||||
]
|
]
|
||||||
|
|
||||||
## Uses the small-string optimization provided by `smol_str`.
|
## Uses the small-string optimization provided by `smol_str`.
|
||||||
@ -43,6 +44,7 @@ std = [
|
|||||||
"bevy_math/std",
|
"bevy_math/std",
|
||||||
"bevy_utils/std",
|
"bevy_utils/std",
|
||||||
"bevy_reflect/std",
|
"bevy_reflect/std",
|
||||||
|
"bevy_platform_support/std",
|
||||||
]
|
]
|
||||||
|
|
||||||
## `critical-section` provides the building blocks for synchronization primitives
|
## `critical-section` provides the building blocks for synchronization primitives
|
||||||
@ -51,6 +53,7 @@ critical-section = [
|
|||||||
"bevy_app/critical-section",
|
"bevy_app/critical-section",
|
||||||
"bevy_ecs/critical-section",
|
"bevy_ecs/critical-section",
|
||||||
"bevy_reflect?/critical-section",
|
"bevy_reflect?/critical-section",
|
||||||
|
"bevy_platform_support/critical-section",
|
||||||
]
|
]
|
||||||
|
|
||||||
## `portable-atomic` provides additional platform support for atomic types and
|
## `portable-atomic` provides additional platform support for atomic types and
|
||||||
@ -59,6 +62,7 @@ portable-atomic = [
|
|||||||
"bevy_app/portable-atomic",
|
"bevy_app/portable-atomic",
|
||||||
"bevy_ecs/portable-atomic",
|
"bevy_ecs/portable-atomic",
|
||||||
"bevy_reflect?/portable-atomic",
|
"bevy_reflect?/portable-atomic",
|
||||||
|
"bevy_platform_support/portable-atomic",
|
||||||
]
|
]
|
||||||
|
|
||||||
## Uses the `libm` maths library instead of the one provided in `std` and `core`.
|
## Uses the `libm` maths library instead of the one provided in `std` and `core`.
|
||||||
@ -73,6 +77,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev", default-features
|
|||||||
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
|
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
|
||||||
"glam",
|
"glam",
|
||||||
], default-features = false, optional = true }
|
], default-features = false, optional = true }
|
||||||
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
serde = { version = "1", features = [
|
serde = { version = "1", features = [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! The generic axis type.
|
//! The generic axis type.
|
||||||
|
|
||||||
use bevy_ecs::resource::Resource;
|
use bevy_ecs::resource::Resource;
|
||||||
use bevy_utils::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use core::hash::Hash;
|
use core::hash::Hash;
|
||||||
|
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! The generic input type.
|
//! The generic input type.
|
||||||
|
|
||||||
use bevy_ecs::resource::Resource;
|
use bevy_ecs::resource::Resource;
|
||||||
use bevy_utils::HashSet;
|
use bevy_platform_support::collections::HashSet;
|
||||||
use core::hash::Hash;
|
use core::hash::Hash;
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use {
|
use {
|
||||||
|
@ -17,11 +17,11 @@ use bevy_ecs::{
|
|||||||
};
|
};
|
||||||
use bevy_math::ops;
|
use bevy_math::ops;
|
||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
#[cfg(all(feature = "serialize", feature = "bevy_reflect"))]
|
#[cfg(all(feature = "serialize", feature = "bevy_reflect"))]
|
||||||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use derive_more::derive::From;
|
use derive_more::derive::From;
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -7,9 +7,9 @@ use bevy_ecs::{
|
|||||||
system::ResMut,
|
system::ResMut,
|
||||||
};
|
};
|
||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
|
|
||||||
#[cfg(all(feature = "serialize", feature = "bevy_reflect"))]
|
#[cfg(all(feature = "serialize", feature = "bevy_reflect"))]
|
||||||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||||
|
@ -97,6 +97,7 @@ serialize = [
|
|||||||
"bevy_ui?/serialize",
|
"bevy_ui?/serialize",
|
||||||
"bevy_window?/serialize",
|
"bevy_window?/serialize",
|
||||||
"bevy_winit?/serialize",
|
"bevy_winit?/serialize",
|
||||||
|
"bevy_platform_support/serialize",
|
||||||
]
|
]
|
||||||
multi_threaded = [
|
multi_threaded = [
|
||||||
"bevy_asset?/multi_threaded",
|
"bevy_asset?/multi_threaded",
|
||||||
|
@ -21,6 +21,10 @@ bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
|
|||||||
bevy_mikktspace = { path = "../bevy_mikktspace", version = "0.16.0-dev" }
|
bevy_mikktspace = { path = "../bevy_mikktspace", version = "0.16.0-dev" }
|
||||||
bevy_derive = { path = "../bevy_derive", version = "0.16.0-dev" }
|
bevy_derive = { path = "../bevy_derive", version = "0.16.0-dev" }
|
||||||
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
||||||
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
"serialize",
|
||||||
|
] }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
bitflags = { version = "2.3", features = ["serde"] }
|
bitflags = { version = "2.3", features = ["serde"] }
|
||||||
|
@ -1128,7 +1128,7 @@ impl From<Capsule2d> for Mesh {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use bevy_math::{prelude::Annulus, primitives::RegularPolygon, FloatOrd};
|
use bevy_math::{prelude::Annulus, primitives::RegularPolygon, FloatOrd};
|
||||||
use bevy_utils::HashSet;
|
use bevy_platform_support::collections::HashSet;
|
||||||
|
|
||||||
use crate::{Mesh, MeshBuilder, Meshable, VertexAttributeValues};
|
use crate::{Mesh, MeshBuilder, Meshable, VertexAttributeValues};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use alloc::sync::Arc;
|
|||||||
use bevy_derive::EnumVariantMeta;
|
use bevy_derive::EnumVariantMeta;
|
||||||
use bevy_ecs::resource::Resource;
|
use bevy_ecs::resource::Resource;
|
||||||
use bevy_math::Vec3;
|
use bevy_math::Vec3;
|
||||||
use bevy_utils::HashSet;
|
use bevy_platform_support::collections::HashSet;
|
||||||
use bytemuck::cast_slice;
|
use bytemuck::cast_slice;
|
||||||
use core::hash::{Hash, Hasher};
|
use core::hash::{Hash, Hasher};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -47,6 +47,9 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.16.0-dev", optional = true }
|
|||||||
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
|
bevy_transform = { path = "../bevy_transform", version = "0.16.0-dev" }
|
||||||
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
||||||
bevy_window = { path = "../bevy_window", version = "0.16.0-dev" }
|
bevy_window = { path = "../bevy_window", version = "0.16.0-dev" }
|
||||||
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
] }
|
||||||
|
|
||||||
# other
|
# other
|
||||||
bitflags = "2.3"
|
bitflags = "2.3"
|
||||||
|
@ -13,6 +13,7 @@ use bevy_ecs::{
|
|||||||
world::{FromWorld, World},
|
world::{FromWorld, World},
|
||||||
};
|
};
|
||||||
use bevy_math::{uvec4, AspectRatio, UVec2, UVec3, UVec4, Vec3Swizzles as _, Vec4};
|
use bevy_math::{uvec4, AspectRatio, UVec2, UVec3, UVec4, Vec3Swizzles as _, Vec4};
|
||||||
|
use bevy_platform_support::collections::HashSet;
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
camera::Camera,
|
camera::Camera,
|
||||||
@ -24,7 +25,6 @@ use bevy_render::{
|
|||||||
sync_world::RenderEntity,
|
sync_world::RenderEntity,
|
||||||
Extract,
|
Extract,
|
||||||
};
|
};
|
||||||
use bevy_utils::HashSet;
|
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
pub(crate) use crate::cluster::assign::assign_objects_to_clusters;
|
pub(crate) use crate::cluster::assign::assign_objects_to_clusters;
|
||||||
|
@ -15,6 +15,7 @@ use bevy_ecs::{
|
|||||||
};
|
};
|
||||||
use bevy_image::Image;
|
use bevy_image::Image;
|
||||||
use bevy_math::{Affine3A, FloatOrd, Mat4, Vec3A, Vec4};
|
use bevy_math::{Affine3A, FloatOrd, Mat4, Vec3A, Vec4};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
extract_instances::ExtractInstancesPlugin,
|
extract_instances::ExtractInstancesPlugin,
|
||||||
@ -29,7 +30,6 @@ use bevy_render::{
|
|||||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||||
};
|
};
|
||||||
use bevy_transform::{components::Transform, prelude::GlobalTransform};
|
use bevy_transform::{components::Transform, prelude::GlobalTransform};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
use core::{hash::Hash, ops::Deref};
|
use core::{hash::Hash, ops::Deref};
|
||||||
|
@ -47,6 +47,7 @@ use bevy_ecs::{
|
|||||||
};
|
};
|
||||||
use bevy_image::Image;
|
use bevy_image::Image;
|
||||||
use bevy_math::{uvec2, vec4, Rect, UVec2};
|
use bevy_math::{uvec2, vec4, Rect, UVec2};
|
||||||
|
use bevy_platform_support::collections::HashSet;
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
render_asset::RenderAssets,
|
render_asset::RenderAssets,
|
||||||
@ -58,7 +59,7 @@ use bevy_render::{
|
|||||||
Extract, ExtractSchedule, RenderApp,
|
Extract, ExtractSchedule, RenderApp,
|
||||||
};
|
};
|
||||||
use bevy_render::{renderer::RenderDevice, sync_world::MainEntityHashMap};
|
use bevy_render::{renderer::RenderDevice, sync_world::MainEntityHashMap};
|
||||||
use bevy_utils::{default, HashSet};
|
use bevy_utils::default;
|
||||||
use fixedbitset::FixedBitSet;
|
use fixedbitset::FixedBitSet;
|
||||||
use nonmax::{NonMaxU16, NonMaxU32};
|
use nonmax::{NonMaxU16, NonMaxU32};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
@ -27,6 +27,7 @@ use bevy_ecs::{
|
|||||||
SystemParamItem,
|
SystemParamItem,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::std_traits::ReflectDefault;
|
use bevy_reflect::std_traits::ReflectDefault;
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
@ -44,7 +45,6 @@ use bevy_render::{
|
|||||||
};
|
};
|
||||||
use bevy_render::{mesh::allocator::MeshAllocator, sync_world::MainEntityHashMap};
|
use bevy_render::{mesh::allocator::MeshAllocator, sync_world::MainEntityHashMap};
|
||||||
use bevy_render::{texture::FallbackImage, view::RenderVisibleEntities};
|
use bevy_render::{texture::FallbackImage, view::RenderVisibleEntities};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::{hash::Hash, marker::PhantomData};
|
use core::{hash::Hash, marker::PhantomData};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ use bevy_ecs::{
|
|||||||
resource::Resource,
|
resource::Resource,
|
||||||
world::{FromWorld, World},
|
world::{FromWorld, World},
|
||||||
};
|
};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
render_resource::{
|
render_resource::{
|
||||||
@ -21,7 +22,7 @@ use bevy_render::{
|
|||||||
renderer::RenderDevice,
|
renderer::RenderDevice,
|
||||||
texture::FallbackImage,
|
texture::FallbackImage,
|
||||||
};
|
};
|
||||||
use bevy_utils::{default, HashMap};
|
use bevy_utils::default;
|
||||||
use core::{any, iter, marker::PhantomData, num::NonZero};
|
use core::{any, iter, marker::PhantomData, num::NonZero};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ use super::asset::{
|
|||||||
};
|
};
|
||||||
use alloc::borrow::Cow;
|
use alloc::borrow::Cow;
|
||||||
use bevy_math::{ops::log2, IVec3, Vec2, Vec3, Vec3Swizzles};
|
use bevy_math::{ops::log2, IVec3, Vec2, Vec3, Vec3Swizzles};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
mesh::{Indices, Mesh},
|
mesh::{Indices, Mesh},
|
||||||
render_resource::PrimitiveTopology,
|
render_resource::PrimitiveTopology,
|
||||||
};
|
};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use bitvec::{order::Lsb0, vec::BitVec, view::BitView};
|
use bitvec::{order::Lsb0, vec::BitVec, view::BitView};
|
||||||
use core::{iter, ops::Range};
|
use core::{iter, ops::Range};
|
||||||
use half::f16;
|
use half::f16;
|
||||||
|
@ -12,11 +12,11 @@ use bevy_ecs::{
|
|||||||
resource::Resource,
|
resource::Resource,
|
||||||
system::{Local, Query, Res, ResMut, SystemState},
|
system::{Local, Query, Res, ResMut, SystemState},
|
||||||
};
|
};
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
render_resource::StorageBuffer, sync_world::MainEntity, view::RenderLayers, MainWorld,
|
render_resource::StorageBuffer, sync_world::MainEntity, view::RenderLayers, MainWorld,
|
||||||
};
|
};
|
||||||
use bevy_transform::components::GlobalTransform;
|
use bevy_transform::components::GlobalTransform;
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
use core::ops::{DerefMut, Range};
|
use core::ops::{DerefMut, Range};
|
||||||
|
|
||||||
/// Manages data for each entity with a [`MeshletMesh`].
|
/// Manages data for each entity with a [`MeshletMesh`].
|
||||||
|
@ -13,6 +13,7 @@ use bevy_core_pipeline::{
|
|||||||
tonemapping::{DebandDither, Tonemapping},
|
tonemapping::{DebandDither, Tonemapping},
|
||||||
};
|
};
|
||||||
use bevy_derive::{Deref, DerefMut};
|
use bevy_derive::{Deref, DerefMut};
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
camera::TemporalJitter,
|
camera::TemporalJitter,
|
||||||
mesh::{Mesh, MeshVertexBufferLayout, MeshVertexBufferLayoutRef, MeshVertexBufferLayouts},
|
mesh::{Mesh, MeshVertexBufferLayout, MeshVertexBufferLayoutRef, MeshVertexBufferLayouts},
|
||||||
@ -20,7 +21,6 @@ use bevy_render::{
|
|||||||
render_resource::*,
|
render_resource::*,
|
||||||
view::ExtractedView,
|
view::ExtractedView,
|
||||||
};
|
};
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
use core::hash::Hash;
|
use core::hash::Hash;
|
||||||
|
|
||||||
/// A list of `(Material ID, Pipeline, BindGroup)` for a view for use in [`super::MeshletMainOpaquePass3dNode`].
|
/// A list of `(Material ID, Pipeline, BindGroup)` for a view for use in [`super::MeshletMainOpaquePass3dNode`].
|
||||||
|
@ -11,11 +11,11 @@ use bevy_ecs::{
|
|||||||
world::{FromWorld, World},
|
world::{FromWorld, World},
|
||||||
};
|
};
|
||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
render_resource::BufferAddress,
|
render_resource::BufferAddress,
|
||||||
renderer::{RenderDevice, RenderQueue},
|
renderer::{RenderDevice, RenderQueue},
|
||||||
};
|
};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::ops::Range;
|
use core::ops::Range;
|
||||||
|
|
||||||
/// Manages uploading [`MeshletMesh`] asset data to the GPU.
|
/// Manages uploading [`MeshletMesh`] asset data to the GPU.
|
||||||
|
@ -11,6 +11,7 @@ use bevy_ecs::{
|
|||||||
system::lifetimeless::Read,
|
system::lifetimeless::Read,
|
||||||
};
|
};
|
||||||
use bevy_math::{ops, Mat4, UVec4, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles};
|
use bevy_math::{ops, Mat4, UVec4, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles};
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
batching::gpu_preprocessing::{GpuPreprocessingMode, GpuPreprocessingSupport},
|
batching::gpu_preprocessing::{GpuPreprocessingMode, GpuPreprocessingSupport},
|
||||||
camera::SortedCameras,
|
camera::SortedCameras,
|
||||||
@ -35,7 +36,7 @@ use bevy_render::{
|
|||||||
sync_world::{MainEntity, RenderEntity},
|
sync_world::{MainEntity, RenderEntity},
|
||||||
};
|
};
|
||||||
use bevy_transform::{components::GlobalTransform, prelude::Transform};
|
use bevy_transform::{components::GlobalTransform, prelude::Transform};
|
||||||
use bevy_utils::{default, HashMap, HashSet};
|
use bevy_utils::default;
|
||||||
use core::{hash::Hash, ops::Range};
|
use core::{hash::Hash, ops::Range};
|
||||||
#[cfg(feature = "trace")]
|
#[cfg(feature = "trace")]
|
||||||
use tracing::info_span;
|
use tracing::info_span;
|
||||||
|
@ -17,6 +17,7 @@ use bevy_ecs::{
|
|||||||
};
|
};
|
||||||
use bevy_image::{BevyDefault, ImageSampler, TextureFormatPixelInfo};
|
use bevy_image::{BevyDefault, ImageSampler, TextureFormatPixelInfo};
|
||||||
use bevy_math::{Affine3, Rect, UVec2, Vec3, Vec4};
|
use bevy_math::{Affine3, Rect, UVec2, Vec3, Vec4};
|
||||||
|
use bevy_platform_support::collections::{hash_map::Entry, HashMap};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
batching::{
|
batching::{
|
||||||
gpu_preprocessing::{
|
gpu_preprocessing::{
|
||||||
@ -44,7 +45,7 @@ use bevy_render::{
|
|||||||
Extract,
|
Extract,
|
||||||
};
|
};
|
||||||
use bevy_transform::components::GlobalTransform;
|
use bevy_transform::components::GlobalTransform;
|
||||||
use bevy_utils::{default, hashbrown::hash_map::Entry, HashMap, Parallel};
|
use bevy_utils::{default, Parallel};
|
||||||
use material_bind_groups::MaterialBindingId;
|
use material_bind_groups::MaterialBindingId;
|
||||||
use render::skin::{self, SkinIndex};
|
use render::skin::{self, SkinIndex};
|
||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
|
@ -129,10 +129,10 @@ pub mod ray {
|
|||||||
use crate::backend::prelude::{PointerId, PointerLocation};
|
use crate::backend::prelude::{PointerId, PointerLocation};
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
use bevy_math::Ray3d;
|
use bevy_math::Ray3d;
|
||||||
|
use bevy_platform_support::collections::{hash_map::Iter, HashMap};
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
use bevy_render::camera::Camera;
|
use bevy_render::camera::Camera;
|
||||||
use bevy_transform::prelude::GlobalTransform;
|
use bevy_transform::prelude::GlobalTransform;
|
||||||
use bevy_utils::{hashbrown::hash_map::Iter, HashMap};
|
|
||||||
use bevy_window::PrimaryWindow;
|
use bevy_window::PrimaryWindow;
|
||||||
|
|
||||||
/// Identifies a ray constructed from some (pointer, camera) combination. A pointer can be over
|
/// Identifies a ray constructed from some (pointer, camera) combination. A pointer can be over
|
||||||
|
@ -41,10 +41,10 @@ use core::{fmt::Debug, time::Duration};
|
|||||||
|
|
||||||
use bevy_ecs::{prelude::*, query::QueryData, system::SystemParam, traversal::Traversal};
|
use bevy_ecs::{prelude::*, query::QueryData, system::SystemParam, traversal::Traversal};
|
||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_platform_support::time::Instant;
|
use bevy_platform_support::time::Instant;
|
||||||
use bevy_reflect::prelude::*;
|
use bevy_reflect::prelude::*;
|
||||||
use bevy_render::camera::NormalizedRenderTarget;
|
use bevy_render::camera::NormalizedRenderTarget;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use bevy_window::Window;
|
use bevy_window::Window;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ use crate::{
|
|||||||
use bevy_derive::{Deref, DerefMut};
|
use bevy_derive::{Deref, DerefMut};
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
use bevy_math::FloatOrd;
|
use bevy_math::FloatOrd;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::prelude::*;
|
use bevy_reflect::prelude::*;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
|
|
||||||
type DepthSortedHits = Vec<(Entity, HitData)>;
|
type DepthSortedHits = Vec<(Entity, HitData)>;
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ use bevy_input::{
|
|||||||
ButtonState,
|
ButtonState,
|
||||||
};
|
};
|
||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
|
use bevy_platform_support::collections::{HashMap, HashSet};
|
||||||
use bevy_reflect::prelude::*;
|
use bevy_reflect::prelude::*;
|
||||||
use bevy_render::camera::RenderTarget;
|
use bevy_render::camera::RenderTarget;
|
||||||
use bevy_utils::{HashMap, HashSet};
|
|
||||||
use bevy_window::{PrimaryWindow, WindowEvent, WindowRef};
|
use bevy_window::{PrimaryWindow, WindowEvent, WindowRef};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_reflect::prelude::*;
|
use bevy_reflect::prelude::*;
|
||||||
use bevy_render::camera::{Camera, NormalizedRenderTarget};
|
use bevy_render::camera::{Camera, NormalizedRenderTarget};
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use bevy_window::PrimaryWindow;
|
use bevy_window::PrimaryWindow;
|
||||||
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
@ -11,6 +11,11 @@ keywords = ["bevy"]
|
|||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
|
|
||||||
|
# Functionality
|
||||||
|
|
||||||
|
## Adds serialization support through `serde`.
|
||||||
|
serialize = ["hashbrown/serde"]
|
||||||
|
|
||||||
# Platform Compatibility
|
# Platform Compatibility
|
||||||
|
|
||||||
## Allows access to the `std` crate. Enabling this feature will prevent compilation
|
## Allows access to the `std` crate. Enabling this feature will prevent compilation
|
||||||
@ -22,9 +27,10 @@ std = [
|
|||||||
"portable-atomic?/std",
|
"portable-atomic?/std",
|
||||||
"portable-atomic-util?/std",
|
"portable-atomic-util?/std",
|
||||||
"spin/std",
|
"spin/std",
|
||||||
|
"foldhash/std",
|
||||||
]
|
]
|
||||||
|
|
||||||
alloc = ["portable-atomic-util?/alloc"]
|
alloc = ["portable-atomic-util?/alloc", "dep:hashbrown"]
|
||||||
|
|
||||||
## `critical-section` provides the building blocks for synchronization primitives
|
## `critical-section` provides the building blocks for synchronization primitives
|
||||||
## on all platforms, including `no_std`.
|
## on all platforms, including `no_std`.
|
||||||
@ -52,6 +58,11 @@ spin = { version = "0.9.8", default-features = false, features = [
|
|||||||
"lazy",
|
"lazy",
|
||||||
"barrier",
|
"barrier",
|
||||||
] }
|
] }
|
||||||
|
foldhash = { version = "0.1.3", default-features = false }
|
||||||
|
hashbrown = { version = "0.15.1", features = [
|
||||||
|
"equivalent",
|
||||||
|
"raw-entry",
|
||||||
|
], optional = true, default-features = false }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
web-time = { version = "1.1", default-features = false }
|
web-time = { version = "1.1", default-features = false }
|
||||||
|
64
crates/bevy_platform_support/src/collections.rs
Normal file
64
crates/bevy_platform_support/src/collections.rs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
//! Provides [`HashMap`] and [`HashSet`] from [`hashbrown`] with some customized defaults.\
|
||||||
|
//!
|
||||||
|
//! Also provides the [`HashTable`] type, which is specific to [`hashbrown`].
|
||||||
|
|
||||||
|
pub use hash_map::HashMap;
|
||||||
|
pub use hash_set::HashSet;
|
||||||
|
pub use hash_table::HashTable;
|
||||||
|
pub use hashbrown::Equivalent;
|
||||||
|
|
||||||
|
pub mod hash_map {
|
||||||
|
//! Provides [`HashMap`]
|
||||||
|
|
||||||
|
use crate::hash::FixedHasher;
|
||||||
|
use hashbrown::hash_map as hb;
|
||||||
|
|
||||||
|
// Re-exports to match `std::collections::hash_map`
|
||||||
|
pub use {
|
||||||
|
crate::hash::{DefaultHasher, RandomState},
|
||||||
|
hb::{
|
||||||
|
Drain, IntoIter, IntoKeys, IntoValues, Iter, IterMut, Keys, OccupiedEntry, VacantEntry,
|
||||||
|
Values, ValuesMut,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Additional items from `hashbrown`
|
||||||
|
pub use hb::{
|
||||||
|
EntryRef, ExtractIf, OccupiedError, RawEntryBuilder, RawEntryBuilderMut, RawEntryMut,
|
||||||
|
RawOccupiedEntryMut,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Shortcut for [`HashMap`](hb::HashMap) with [`FixedHasher`] as the default hashing provider.
|
||||||
|
pub type HashMap<K, V, S = FixedHasher> = hb::HashMap<K, V, S>;
|
||||||
|
|
||||||
|
/// Shortcut for [`Entry`](hb::Entry) with [`FixedHasher`] as the default hashing provider.
|
||||||
|
pub type Entry<'a, K, V, S = FixedHasher> = hb::Entry<'a, K, V, S>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod hash_set {
|
||||||
|
//! Provides [`HashSet`]
|
||||||
|
|
||||||
|
use crate::hash::FixedHasher;
|
||||||
|
use hashbrown::hash_set as hb;
|
||||||
|
|
||||||
|
// Re-exports to match `std::collections::hash_set`
|
||||||
|
pub use hb::{Difference, Drain, Intersection, IntoIter, Iter, SymmetricDifference, Union};
|
||||||
|
|
||||||
|
// Additional items from `hashbrown`
|
||||||
|
pub use hb::{ExtractIf, OccupiedEntry, VacantEntry};
|
||||||
|
|
||||||
|
/// Shortcut for [`HashSet`](hb::HashSet) with [`FixedHasher`] as the default hashing provider.
|
||||||
|
pub type HashSet<T, S = FixedHasher> = hb::HashSet<T, S>;
|
||||||
|
|
||||||
|
/// Shortcut for [`Entry`](hb::Entry) with [`FixedHasher`] as the default hashing provider.
|
||||||
|
pub type Entry<'a, T, S = FixedHasher> = hb::Entry<'a, T, S>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod hash_table {
|
||||||
|
//! Provides [`HashTable`]
|
||||||
|
|
||||||
|
pub use hashbrown::hash_table::{
|
||||||
|
AbsentEntry, Drain, Entry, ExtractIf, HashTable, IntoIter, Iter, IterHash, IterHashMut,
|
||||||
|
IterMut, OccupiedEntry, VacantEntry,
|
||||||
|
};
|
||||||
|
}
|
180
crates/bevy_platform_support/src/hash.rs
Normal file
180
crates/bevy_platform_support/src/hash.rs
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
//! Provides replacements for `std::hash` items using [`foldhash`].
|
||||||
|
//!
|
||||||
|
//! Also provides some additional items beyond the standard library.
|
||||||
|
|
||||||
|
use core::{
|
||||||
|
fmt::Debug,
|
||||||
|
hash::{BuildHasher, Hash, Hasher},
|
||||||
|
marker::PhantomData,
|
||||||
|
ops::Deref,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub use foldhash::fast::{FixedState, FoldHasher as DefaultHasher, RandomState};
|
||||||
|
|
||||||
|
/// For when you want a deterministic hasher.
|
||||||
|
///
|
||||||
|
/// Seed was randomly generated with a fair dice roll. Guaranteed to be random:
|
||||||
|
/// <https://github.com/bevyengine/bevy/pull/1268/files#r560918426>
|
||||||
|
const FIXED_HASHER: FixedState =
|
||||||
|
FixedState::with_seed(0b1001010111101110000001001100010000000011001001101011001001111000);
|
||||||
|
|
||||||
|
/// Deterministic hasher based upon a random but fixed state.
|
||||||
|
#[derive(Copy, Clone, Default, Debug)]
|
||||||
|
pub struct FixedHasher;
|
||||||
|
impl BuildHasher for FixedHasher {
|
||||||
|
type Hasher = DefaultHasher;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn build_hasher(&self) -> Self::Hasher {
|
||||||
|
FIXED_HASHER.build_hasher()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A pre-hashed value of a specific type. Pre-hashing enables memoization of hashes that are expensive to compute.
|
||||||
|
///
|
||||||
|
/// It also enables faster [`PartialEq`] comparisons by short circuiting on hash equality.
|
||||||
|
/// See [`PassHash`] and [`PassHasher`] for a "pass through" [`BuildHasher`] and [`Hasher`] implementation
|
||||||
|
/// designed to work with [`Hashed`]
|
||||||
|
/// See `PreHashMap` for a hashmap pre-configured to use [`Hashed`] keys.
|
||||||
|
pub struct Hashed<V, S = FixedHasher> {
|
||||||
|
hash: u64,
|
||||||
|
value: V,
|
||||||
|
marker: PhantomData<S>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<V: Hash, H: BuildHasher + Default> Hashed<V, H> {
|
||||||
|
/// Pre-hashes the given value using the [`BuildHasher`] configured in the [`Hashed`] type.
|
||||||
|
pub fn new(value: V) -> Self {
|
||||||
|
Self {
|
||||||
|
hash: H::default().hash_one(&value),
|
||||||
|
value,
|
||||||
|
marker: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The pre-computed hash.
|
||||||
|
#[inline]
|
||||||
|
pub fn hash(&self) -> u64 {
|
||||||
|
self.hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<V, H> Hash for Hashed<V, H> {
|
||||||
|
#[inline]
|
||||||
|
fn hash<R: Hasher>(&self, state: &mut R) {
|
||||||
|
state.write_u64(self.hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<V, H> Deref for Hashed<V, H> {
|
||||||
|
type Target = V;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
&self.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<V: PartialEq, H> PartialEq for Hashed<V, H> {
|
||||||
|
/// A fast impl of [`PartialEq`] that first checks that `other`'s pre-computed hash
|
||||||
|
/// matches this value's pre-computed hash.
|
||||||
|
#[inline]
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.hash == other.hash && self.value.eq(&other.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<V: Debug, H> Debug for Hashed<V, H> {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
f.debug_struct("Hashed")
|
||||||
|
.field("hash", &self.hash)
|
||||||
|
.field("value", &self.value)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<V: Clone, H> Clone for Hashed<V, H> {
|
||||||
|
#[inline]
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
hash: self.hash,
|
||||||
|
value: self.value.clone(),
|
||||||
|
marker: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<V: Copy, H> Copy for Hashed<V, H> {}
|
||||||
|
|
||||||
|
impl<V: Eq, H> Eq for Hashed<V, H> {}
|
||||||
|
|
||||||
|
/// A [`BuildHasher`] that results in a [`PassHasher`].
|
||||||
|
#[derive(Default, Clone)]
|
||||||
|
pub struct PassHash;
|
||||||
|
|
||||||
|
impl BuildHasher for PassHash {
|
||||||
|
type Hasher = PassHasher;
|
||||||
|
|
||||||
|
fn build_hasher(&self) -> Self::Hasher {
|
||||||
|
PassHasher::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A no-op hash that only works on `u64`s. Will panic if attempting to
|
||||||
|
/// hash a type containing non-u64 fields.
|
||||||
|
#[derive(Debug, Default)]
|
||||||
|
pub struct PassHasher {
|
||||||
|
hash: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Hasher for PassHasher {
|
||||||
|
#[inline]
|
||||||
|
fn finish(&self) -> u64 {
|
||||||
|
self.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&mut self, _bytes: &[u8]) {
|
||||||
|
panic!("can only hash u64 using PassHasher");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn write_u64(&mut self, i: u64) {
|
||||||
|
self.hash = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [`BuildHasher`] for types that already contain a high-quality hash.
|
||||||
|
#[derive(Clone, Default)]
|
||||||
|
pub struct NoOpHash;
|
||||||
|
|
||||||
|
impl BuildHasher for NoOpHash {
|
||||||
|
type Hasher = NoOpHasher;
|
||||||
|
|
||||||
|
fn build_hasher(&self) -> Self::Hasher {
|
||||||
|
NoOpHasher(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub struct NoOpHasher(u64);
|
||||||
|
|
||||||
|
// This is for types that already contain a high-quality hash and want to skip
|
||||||
|
// re-hashing that hash.
|
||||||
|
impl Hasher for NoOpHasher {
|
||||||
|
fn finish(&self) -> u64 {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&mut self, bytes: &[u8]) {
|
||||||
|
// This should never be called by consumers. Prefer to call `write_u64` instead.
|
||||||
|
// Don't break applications (slower fallback, just check in test):
|
||||||
|
self.0 = bytes.iter().fold(self.0, |hash, b| {
|
||||||
|
hash.rotate_left(8).wrapping_add(*b as u64)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn write_u64(&mut self, i: u64) {
|
||||||
|
self.0 = i;
|
||||||
|
}
|
||||||
|
}
|
@ -15,9 +15,13 @@ extern crate std;
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
|
pub mod hash;
|
||||||
pub mod sync;
|
pub mod sync;
|
||||||
pub mod time;
|
pub mod time;
|
||||||
|
|
||||||
|
#[cfg(feature = "alloc")]
|
||||||
|
pub mod collections;
|
||||||
|
|
||||||
/// Frequently used items which would typically be included in most contexts.
|
/// Frequently used items which would typically be included in most contexts.
|
||||||
///
|
///
|
||||||
/// When adding `no_std` support to a crate for the first time, often there's a substantial refactor
|
/// When adding `no_std` support to a crate for the first time, often there's a substantial refactor
|
||||||
|
@ -87,6 +87,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev", default-features
|
|||||||
bevy_ptr = { path = "../bevy_ptr", version = "0.16.0-dev" }
|
bevy_ptr = { path = "../bevy_ptr", version = "0.16.0-dev" }
|
||||||
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false, features = [
|
||||||
"alloc",
|
"alloc",
|
||||||
|
"serialize",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
# used by bevy-utils, but it also needs reflect impls
|
# used by bevy-utils, but it also needs reflect impls
|
||||||
|
@ -5,8 +5,8 @@ use crate::{
|
|||||||
DynamicEnum, Generics, PartialReflect, Type, TypePath, VariantInfo, VariantType,
|
DynamicEnum, Generics, PartialReflect, Type, TypePath, VariantInfo, VariantType,
|
||||||
};
|
};
|
||||||
use alloc::{boxed::Box, format, string::String};
|
use alloc::{boxed::Box, format, string::String};
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_platform_support::sync::Arc;
|
use bevy_platform_support::sync::Arc;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::slice::Iter;
|
use core::slice::Iter;
|
||||||
|
|
||||||
/// A trait used to power [enum-like] operations via [reflection].
|
/// A trait used to power [enum-like] operations via [reflection].
|
||||||
|
@ -3,8 +3,8 @@ use crate::{
|
|||||||
NamedField, UnnamedField,
|
NamedField, UnnamedField,
|
||||||
};
|
};
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_platform_support::sync::Arc;
|
use bevy_platform_support::sync::Arc;
|
||||||
use bevy_utils::HashMap;
|
|
||||||
use core::slice::Iter;
|
use core::slice::Iter;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user