mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
Disentangle bevy_utils/bevy_core's reexported dependencies (#12313)
# Objective Make bevy_utils less of a compilation bottleneck. Tackle #11478. ## Solution * Move all of the directly reexported dependencies and move them to where they're actually used. * Remove the UUID utilities that have gone unused since `TypePath` took over for `TypeUuid`. * There was also a extraneous bytemuck dependency on `bevy_core` that has not been used for a long time (since `encase` became the primary way to prepare GPU buffers). * Remove the `all_tuples` macro reexport from bevy_ecs since it's accessible from `bevy_utils`. --- ## Changelog Removed: Many of the reexports from bevy_utils (petgraph, uuid, nonmax, smallvec, and thiserror). Removed: bevy_core's reexports of bytemuck. ## Migration Guide bevy_utils' reexports of petgraph, uuid, nonmax, smallvec, and thiserror have been removed. bevy_core' reexports of bytemuck's types has been removed. Add them as dependencies in your own crate instead.
This commit is contained in:
parent
a1974a4738
commit
512b7463a3
57 changed files with 81 additions and 125 deletions
|
@ -338,6 +338,7 @@ bytemuck = "1.7"
|
|||
futures-lite = "2.0.1"
|
||||
crossbeam-channel = "0.5.0"
|
||||
argh = "0.1.12"
|
||||
thiserror = "1.0"
|
||||
|
||||
[[example]]
|
||||
name = "hello_world"
|
||||
|
|
|
@ -26,7 +26,7 @@ bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.14.0-dev" }
|
|||
|
||||
# other
|
||||
sha1_smol = { version = "1.0" }
|
||||
uuid = { version = "1.7", features = ["v5"] }
|
||||
uuid = { version = "1.7", features = ["v4"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -20,8 +20,9 @@ use bevy_render::mesh::morph::MorphWeights;
|
|||
use bevy_time::Time;
|
||||
use bevy_transform::{prelude::Transform, TransformSystem};
|
||||
use bevy_utils::hashbrown::HashMap;
|
||||
use bevy_utils::{tracing::error, NoOpHash, Uuid};
|
||||
use bevy_utils::{tracing::error, NoOpHash};
|
||||
use sha1_smol::Sha1;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[allow(missing_docs)]
|
||||
pub mod prelude {
|
||||
|
|
|
@ -26,7 +26,7 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
|||
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||
ron = { version = "0.8.0", optional = true }
|
||||
downcast-rs = "1.2.0"
|
||||
|
||||
thiserror = "1.0"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
wasm-bindgen = { version = "0.2" }
|
||||
|
|
|
@ -7,11 +7,12 @@ use bevy_ecs::{
|
|||
InternedScheduleLabel, ScheduleBuildSettings, ScheduleLabel,
|
||||
},
|
||||
};
|
||||
use bevy_utils::{intern::Interned, thiserror::Error, tracing::debug, HashMap, HashSet};
|
||||
use bevy_utils::{intern::Interned, tracing::debug, HashMap, HashSet};
|
||||
use std::{
|
||||
fmt::Debug,
|
||||
panic::{catch_unwind, resume_unwind, AssertUnwindSafe},
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
|
|
|
@ -115,8 +115,7 @@ pub trait Plugins<Marker>: sealed::Plugins<Marker> {}
|
|||
impl<Marker, T> Plugins<Marker> for T where T: sealed::Plugins<Marker> {}
|
||||
|
||||
mod sealed {
|
||||
|
||||
use bevy_ecs::all_tuples;
|
||||
use bevy_utils::all_tuples;
|
||||
|
||||
use crate::{App, AppError, Plugin, PluginGroup};
|
||||
|
||||
|
|
|
@ -21,7 +21,9 @@ watch = []
|
|||
bevy_app = { path = "../bevy_app", version = "0.14.0-dev" }
|
||||
bevy_asset_macros = { path = "macros", version = "0.14.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.14.0-dev" }
|
||||
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev" }
|
||||
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [
|
||||
"uuid",
|
||||
] }
|
||||
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||
|
||||
|
@ -37,6 +39,7 @@ parking_lot = { version = "0.12", features = ["arc_lock", "send_guard"] }
|
|||
ron = "0.8"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
thiserror = "1.0"
|
||||
uuid = { version = "1.0", features = ["v4"] }
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
bevy_winit = { path = "../bevy_winit", version = "0.14.0-dev" }
|
||||
|
|
|
@ -7,7 +7,7 @@ use bevy_ecs::{
|
|||
system::{Res, ResMut, Resource},
|
||||
};
|
||||
use bevy_reflect::{Reflect, TypePath};
|
||||
use bevy_utils::{HashMap, Uuid};
|
||||
use bevy_utils::HashMap;
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
|
@ -17,6 +17,7 @@ use std::{
|
|||
sync::{atomic::AtomicU32, Arc},
|
||||
};
|
||||
use thiserror::Error;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// A generational runtime-only identifier for a specific [`Asset`] stored in [`Assets`]. This is optimized for efficient runtime
|
||||
/// usage and is not suitable for identifying assets across app runs.
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect, TypePath};
|
||||
use bevy_utils::{get_short_name, Uuid};
|
||||
use bevy_utils::get_short_name;
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use std::{
|
||||
any::TypeId,
|
||||
|
@ -12,6 +12,7 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
use thiserror::Error;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Provides [`Handle`] and [`UntypedHandle`] _for a specific asset type_.
|
||||
/// This should _only_ be used for one specific asset type.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{Asset, AssetIndex};
|
||||
use bevy_reflect::Reflect;
|
||||
use bevy_utils::Uuid;
|
||||
use uuid::Uuid;
|
||||
|
||||
use std::{
|
||||
any::TypeId,
|
||||
|
|
|
@ -24,8 +24,8 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
|||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||
|
||||
# other
|
||||
bytemuck = "1.5"
|
||||
serde = { version = "1.0", optional = true }
|
||||
uuid = "1.0"
|
||||
|
||||
[features]
|
||||
serialize = ["dep:serde"]
|
||||
|
|
|
@ -6,7 +6,6 @@ mod serde;
|
|||
mod task_pool_options;
|
||||
|
||||
use bevy_ecs::system::Resource;
|
||||
pub use bytemuck::{bytes_of, cast_slice, Pod, Zeroable};
|
||||
pub use name::*;
|
||||
pub use task_pool_options::*;
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
|||
serde = { version = "1", features = ["derive"] }
|
||||
bitflags = "2.3"
|
||||
radsort = "0.1"
|
||||
nonmax = "0.5"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -42,7 +42,8 @@ use bevy_render::{
|
|||
render_resource::CachedRenderPipelineId,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::{nonmax::NonMaxU32, FloatOrd};
|
||||
use bevy_utils::FloatOrd;
|
||||
use nonmax::NonMaxU32;
|
||||
|
||||
use crate::{tonemapping::TonemappingNode, upscaling::UpscalingNode};
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ use bevy_render::{
|
|||
view::{ExtractedView, ViewDepthTexture, ViewTarget},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::{nonmax::NonMaxU32, tracing::warn, FloatOrd, HashMap};
|
||||
use bevy_utils::{tracing::warn, FloatOrd, HashMap};
|
||||
use nonmax::NonMaxU32;
|
||||
|
||||
use crate::{
|
||||
core_3d::main_transmissive_pass_3d_node::MainTransmissivePass3dNode,
|
||||
|
|
|
@ -10,7 +10,7 @@ use bevy_render::{
|
|||
render_phase::{CachedRenderPipelinePhaseItem, DrawFunctionId, PhaseItem},
|
||||
render_resource::{CachedRenderPipelineId, TextureFormat},
|
||||
};
|
||||
use bevy_utils::nonmax::NonMaxU32;
|
||||
use nonmax::NonMaxU32;
|
||||
|
||||
pub const DEFERRED_PREPASS_FORMAT: TextureFormat = TextureFormat::Rgba32Uint;
|
||||
pub const DEFERRED_LIGHTING_PASS_ID_FORMAT: TextureFormat = TextureFormat::R8Uint;
|
||||
|
|
|
@ -38,7 +38,7 @@ use bevy_render::{
|
|||
render_resource::{CachedRenderPipelineId, Extent3d, TextureFormat, TextureView},
|
||||
texture::ColorAttachment,
|
||||
};
|
||||
use bevy_utils::nonmax::NonMaxU32;
|
||||
use nonmax::NonMaxU32;
|
||||
|
||||
pub const NORMAL_PREPASS_FORMAT: TextureFormat = TextureFormat::Rgb10a2Unorm;
|
||||
pub const MOTION_VECTOR_PREPASS_FORMAT: TextureFormat = TextureFormat::Rg16Float;
|
||||
|
|
|
@ -21,6 +21,7 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", optional = tr
|
|||
bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||
bevy_ecs_macros = { path = "macros", version = "0.14.0-dev" }
|
||||
petgraph = "0.6"
|
||||
|
||||
bitflags = "2.3"
|
||||
concurrent-queue = "2.4.0"
|
||||
|
|
|
@ -52,8 +52,6 @@ pub mod prelude {
|
|||
};
|
||||
}
|
||||
|
||||
pub use bevy_utils::all_tuples;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate as bevy_ecs;
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
use bevy_utils::{
|
||||
petgraph::{algo::TarjanScc, graphmap::NodeTrait, prelude::*},
|
||||
HashMap, HashSet,
|
||||
};
|
||||
use bevy_utils::{HashMap, HashSet};
|
||||
use fixedbitset::FixedBitSet;
|
||||
use petgraph::{algo::TarjanScc, graphmap::NodeTrait, prelude::*};
|
||||
|
||||
use crate::schedule::set::*;
|
||||
|
||||
|
|
|
@ -7,13 +7,12 @@ use std::{
|
|||
use bevy_utils::tracing::info_span;
|
||||
use bevy_utils::{default, tracing::info};
|
||||
use bevy_utils::{
|
||||
petgraph::{algo::TarjanScc, prelude::*},
|
||||
thiserror::Error,
|
||||
tracing::{error, warn},
|
||||
HashMap, HashSet,
|
||||
};
|
||||
|
||||
use fixedbitset::FixedBitSet;
|
||||
use petgraph::{algo::TarjanScc, prelude::*};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{
|
||||
self as bevy_ecs,
|
||||
|
|
|
@ -7,10 +7,10 @@ use crate::{
|
|||
system::{IntoSystem, ResMut, Resource},
|
||||
};
|
||||
use bevy_utils::{
|
||||
thiserror::Error,
|
||||
tracing::{error, info, warn},
|
||||
TypeIdMap,
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(test)]
|
||||
use bevy_utils::tracing::debug;
|
||||
|
|
|
@ -23,11 +23,12 @@ bevy_math = { path = "../bevy_math", version = "0.14.0-dev" }
|
|||
bevy_asset = { path = "../bevy_asset", version = "0.14.0-dev" }
|
||||
bevy_render = { path = "../bevy_render", version = "0.14.0-dev" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||
bevy_core = { path = "../bevy_core", version = "0.14.0-dev" }
|
||||
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev" }
|
||||
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.14.0-dev" }
|
||||
bevy_transform = { path = "../bevy_transform", version = "0.14.0-dev" }
|
||||
bevy_gizmos_macros = { path = "macros", version = "0.14.0-dev" }
|
||||
|
||||
bytemuck = "1.0"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -57,7 +57,6 @@ use aabb::AabbGizmoPlugin;
|
|||
use bevy_app::{App, Last, Plugin};
|
||||
use bevy_asset::{load_internal_asset, Asset, AssetApp, Assets, Handle};
|
||||
use bevy_color::LinearRgba;
|
||||
use bevy_core::cast_slice;
|
||||
use bevy_ecs::{
|
||||
component::Component,
|
||||
query::ROQueryItem,
|
||||
|
@ -83,6 +82,7 @@ use bevy_render::{
|
|||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::TypeIdMap;
|
||||
use bytemuck::cast_slice;
|
||||
use config::{
|
||||
DefaultGizmoConfigGroup, GizmoConfig, GizmoConfigGroup, GizmoConfigStore, GizmoMeshConfig,
|
||||
};
|
||||
|
|
|
@ -54,6 +54,7 @@ base64 = "0.21.5"
|
|||
percent-encoding = "2.1"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
smallvec = "1.11"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -36,10 +36,7 @@ use bevy_scene::Scene;
|
|||
use bevy_tasks::IoTaskPool;
|
||||
use bevy_transform::components::Transform;
|
||||
use bevy_utils::tracing::{error, info_span, warn};
|
||||
use bevy_utils::{
|
||||
smallvec::{smallvec, SmallVec},
|
||||
HashMap, HashSet,
|
||||
};
|
||||
use bevy_utils::{HashMap, HashSet};
|
||||
use gltf::{
|
||||
accessor::Iter,
|
||||
mesh::{util::ReadIndices, Mode},
|
||||
|
@ -47,6 +44,7 @@ use gltf::{
|
|||
Material, Node, Primitive, Semantic,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::io::Error;
|
||||
use std::{
|
||||
collections::VecDeque,
|
||||
|
|
|
@ -21,8 +21,11 @@ bevy_core = { path = "../bevy_core", version = "0.14.0-dev", optional = true }
|
|||
bevy_ecs = { path = "../bevy_ecs", version = "0.14.0-dev", default-features = false }
|
||||
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [
|
||||
"bevy",
|
||||
"smallvec",
|
||||
], optional = true }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
||||
|
||||
smallvec = { version = "1.11", features = ["union", "const_generics"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -6,7 +6,7 @@ use bevy_ecs::{
|
|||
system::{Commands, EntityCommands},
|
||||
world::{Command, EntityWorldMut, World},
|
||||
};
|
||||
use bevy_utils::smallvec::{smallvec, SmallVec};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
// Do not use `world.send_event_batch` as it prints error message when the Events are not available in the world,
|
||||
// even though it's a valid use case to execute commands on a world without events. Loading a GLTF file for example
|
||||
|
@ -696,7 +696,7 @@ mod tests {
|
|||
components::{Children, Parent},
|
||||
HierarchyEvent::{self, ChildAdded, ChildMoved, ChildRemoved},
|
||||
};
|
||||
use bevy_utils::smallvec::{smallvec, SmallVec};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use bevy_ecs::{
|
||||
component::Component,
|
||||
|
|
|
@ -6,8 +6,8 @@ use bevy_ecs::{
|
|||
prelude::FromWorld,
|
||||
world::World,
|
||||
};
|
||||
use bevy_utils::smallvec::SmallVec;
|
||||
use core::slice;
|
||||
use smallvec::SmallVec;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// Contains references to the child entities of this entity.
|
||||
|
|
|
@ -40,6 +40,7 @@ fixedbitset = "0.4"
|
|||
bytemuck = { version = "1", features = ["derive"] }
|
||||
radsort = "0.1"
|
||||
smallvec = "1.6"
|
||||
nonmax = "0.5"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -18,10 +18,8 @@ use bevy_render::{
|
|||
use bevy_transform::{components::GlobalTransform, prelude::Transform};
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use bevy_utils::{
|
||||
nonmax::NonMaxU32,
|
||||
tracing::{error, warn},
|
||||
};
|
||||
use bevy_utils::tracing::{error, warn};
|
||||
use nonmax::NonMaxU32;
|
||||
use std::{hash::Hash, num::NonZeroU64, ops::Range};
|
||||
|
||||
use crate::*;
|
||||
|
|
|
@ -10,12 +10,13 @@ keywords = ["bevy"]
|
|||
readme = "README.md"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = ["smallvec"]
|
||||
# When enabled, provides Bevy-related reflection implementations
|
||||
bevy = ["smallvec", "bevy_math", "smol_str"]
|
||||
glam = ["dep:glam"]
|
||||
bevy_math = ["glam", "dep:bevy_math"]
|
||||
smallvec = []
|
||||
smallvec = ["dep:smallvec"]
|
||||
uuid = ["dep:uuid"]
|
||||
# When enabled, allows documentation comments to be accessed via reflection
|
||||
documentation = ["bevy_reflect_derive/documentation"]
|
||||
|
||||
|
@ -33,9 +34,11 @@ erased-serde = "0.4"
|
|||
downcast-rs = "1.2"
|
||||
thiserror = "1.0"
|
||||
serde = "1"
|
||||
smallvec = { version = "1.11", optional = true }
|
||||
|
||||
glam = { version = "0.25", features = ["serde"], optional = true }
|
||||
smol_str = { version = "0.2.0", optional = true }
|
||||
uuid = { version = "1.0", optional = true, features = ["v4", "serde"] }
|
||||
|
||||
[dev-dependencies]
|
||||
ron = "0.8.0"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use bevy_reflect_derive::impl_type_path;
|
||||
use bevy_utils::smallvec;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use std::any::Any;
|
||||
|
@ -154,7 +153,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl_type_path!(::bevy_utils::smallvec::SmallVec<T: smallvec::Array>);
|
||||
impl_type_path!(::smallvec::SmallVec<T: smallvec::Array>);
|
||||
|
||||
impl<T: smallvec::Array + TypePath + Send + Sync> FromReflect for SmallVec<T>
|
||||
where
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate as bevy_reflect;
|
|||
use crate::{std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_reflect_derive::impl_reflect_value;
|
||||
|
||||
impl_reflect_value!(::bevy_utils::Uuid(
|
||||
impl_reflect_value!(::uuid::Uuid(
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Default,
|
||||
|
|
|
@ -500,6 +500,7 @@ mod impls {
|
|||
mod smol_str;
|
||||
|
||||
mod std;
|
||||
#[cfg(feature = "uuid")]
|
||||
mod uuid;
|
||||
}
|
||||
|
||||
|
@ -1547,7 +1548,6 @@ mod tests {
|
|||
// List (SmallVec)
|
||||
#[cfg(feature = "smallvec")]
|
||||
{
|
||||
use bevy_utils::smallvec;
|
||||
type MySmallVec = smallvec::SmallVec<[String; 2]>;
|
||||
|
||||
let info = MySmallVec::type_info();
|
||||
|
|
|
@ -96,7 +96,8 @@ profiling = { version = "1", features = [
|
|||
"profile-with-tracing",
|
||||
], optional = true }
|
||||
async-channel = "2.2.0"
|
||||
|
||||
nonmax = "0.5"
|
||||
smallvec = "1.11"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
# Omit the `glsl` feature in non-WebAssembly by default.
|
||||
|
|
|
@ -4,7 +4,7 @@ use bevy_ecs::{
|
|||
prelude::Res,
|
||||
system::{Query, ResMut, StaticSystemParam, SystemParam, SystemParamItem},
|
||||
};
|
||||
use bevy_utils::nonmax::NonMaxU32;
|
||||
use nonmax::NonMaxU32;
|
||||
|
||||
use crate::{
|
||||
render_phase::{CachedRenderPipelinePhaseItem, DrawFunctionId, RenderPhase},
|
||||
|
|
|
@ -11,7 +11,6 @@ use crate::{
|
|||
renderer::RenderDevice,
|
||||
};
|
||||
use bevy_asset::{Asset, Handle};
|
||||
use bevy_core::cast_slice;
|
||||
use bevy_derive::EnumVariantMeta;
|
||||
use bevy_ecs::system::{
|
||||
lifetimeless::{SRes, SResMut},
|
||||
|
@ -19,8 +18,8 @@ use bevy_ecs::system::{
|
|||
};
|
||||
use bevy_math::*;
|
||||
use bevy_reflect::Reflect;
|
||||
use bevy_utils::tracing::error;
|
||||
use bevy_utils::tracing::warn;
|
||||
use bevy_utils::tracing::{error, warn};
|
||||
use bytemuck::cast_slice;
|
||||
use std::{collections::BTreeMap, hash::Hash, iter::FusedIterator};
|
||||
use thiserror::Error;
|
||||
use wgpu::{
|
||||
|
|
|
@ -14,9 +14,10 @@ use bevy_reflect::{
|
|||
ReflectFromReflect, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, ReflectSerialize,
|
||||
TypeInfo, TypePath, TypeRegistration, Typed, ValueInfo,
|
||||
};
|
||||
use bevy_utils::{thiserror::Error, HashMap, HashSet};
|
||||
use bevy_utils::{HashMap, HashSet};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::marker::PhantomData;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum PrepareAssetError<E: Send + Sync + 'static> {
|
||||
|
|
|
@ -29,9 +29,9 @@ mod draw;
|
|||
mod draw_state;
|
||||
mod rangefinder;
|
||||
|
||||
use bevy_utils::nonmax::NonMaxU32;
|
||||
pub use draw::*;
|
||||
pub use draw_state::*;
|
||||
use nonmax::NonMaxU32;
|
||||
pub use rangefinder::*;
|
||||
|
||||
use crate::render_resource::{CachedRenderPipelineId, PipelineCache};
|
||||
|
|
|
@ -3,11 +3,11 @@ use crate::{
|
|||
render_resource::DynamicUniformBuffer,
|
||||
renderer::{RenderDevice, RenderQueue},
|
||||
};
|
||||
use bevy_utils::nonmax::NonMaxU32;
|
||||
use encase::{
|
||||
private::{ArrayMetadata, BufferMut, Metadata, RuntimeSizedArray, WriteInto, Writer},
|
||||
ShaderType,
|
||||
};
|
||||
use nonmax::NonMaxU32;
|
||||
use std::{marker::PhantomData, num::NonZeroU64};
|
||||
use wgpu::{BindingResource, Limits};
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ use crate::{
|
|||
texture::FallbackImage,
|
||||
};
|
||||
pub use bevy_render_macros::AsBindGroup;
|
||||
use bevy_utils::thiserror::Error;
|
||||
use encase::ShaderType;
|
||||
use std::ops::Deref;
|
||||
use thiserror::Error;
|
||||
use wgpu::{BindGroupEntry, BindGroupLayoutEntry, BindingResource};
|
||||
|
||||
define_atomic_id!(BindGroupId);
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
render_resource::Buffer,
|
||||
renderer::{RenderDevice, RenderQueue},
|
||||
};
|
||||
use bevy_core::{cast_slice, Pod};
|
||||
use bytemuck::{cast_slice, Pod};
|
||||
use wgpu::BufferUsages;
|
||||
|
||||
/// A structure for storing raw bytes that have already been properly formatted
|
||||
|
|
|
@ -7,8 +7,8 @@ use crate::{
|
|||
renderer::{RenderDevice, RenderQueue},
|
||||
};
|
||||
use bevy_ecs::{prelude::Component, system::Resource};
|
||||
use bevy_utils::nonmax::NonMaxU32;
|
||||
use encase::{private::WriteInto, ShaderSize, ShaderType};
|
||||
use nonmax::NonMaxU32;
|
||||
use std::marker::PhantomData;
|
||||
use wgpu::BindingResource;
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
use bevy_ecs::{prelude::Entity, world::World};
|
||||
#[cfg(feature = "trace")]
|
||||
use bevy_utils::tracing::info_span;
|
||||
use bevy_utils::{
|
||||
smallvec::{smallvec, SmallVec},
|
||||
HashMap,
|
||||
};
|
||||
use bevy_utils::HashMap;
|
||||
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::{borrow::Cow, collections::VecDeque};
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ impl Image {
|
|||
is_srgb: bool,
|
||||
asset_usage: RenderAssetUsages,
|
||||
) -> Image {
|
||||
use bevy_core::cast_slice;
|
||||
use bytemuck::cast_slice;
|
||||
let width;
|
||||
let height;
|
||||
|
||||
|
|
|
@ -35,9 +35,11 @@ taffy = { version = "0.3.10" }
|
|||
serde = { version = "1", features = ["derive"], optional = true }
|
||||
bytemuck = { version = "1.5", features = ["derive"] }
|
||||
thiserror = "1.0.0"
|
||||
nonmax = "0.5"
|
||||
smallvec = "1.11"
|
||||
|
||||
[features]
|
||||
serialize = ["serde"]
|
||||
serialize = ["serde", "smallvec/serde"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -12,10 +12,11 @@ use bevy_math::{Rect, Vec2};
|
|||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||
use bevy_render::{camera::NormalizedRenderTarget, prelude::Camera, view::ViewVisibility};
|
||||
use bevy_transform::components::GlobalTransform;
|
||||
|
||||
use bevy_utils::{smallvec::SmallVec, HashMap};
|
||||
use bevy_utils::HashMap;
|
||||
use bevy_window::{PrimaryWindow, Window};
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ use bevy_render::{
|
|||
renderer::*,
|
||||
view::*,
|
||||
};
|
||||
use bevy_utils::{nonmax::NonMaxU32, FloatOrd};
|
||||
use bevy_utils::FloatOrd;
|
||||
use nonmax::NonMaxU32;
|
||||
|
||||
pub struct UiPassNode {
|
||||
ui_view_query: QueryState<
|
||||
|
|
|
@ -9,8 +9,9 @@ use bevy_render::{
|
|||
texture::Image,
|
||||
};
|
||||
use bevy_transform::prelude::GlobalTransform;
|
||||
use bevy_utils::{smallvec::SmallVec, warn_once};
|
||||
use bevy_utils::warn_once;
|
||||
use bevy_window::{PrimaryWindow, WindowRef};
|
||||
use smallvec::SmallVec;
|
||||
use std::num::{NonZeroI16, NonZeroU16};
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
|
@ -15,14 +15,9 @@ detailed_trace = []
|
|||
ahash = "0.8.7"
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
web-time = { version = "0.2" }
|
||||
uuid = { version = "1.1", features = ["v4", "serde"] }
|
||||
hashbrown = { version = "0.14", features = ["serde"] }
|
||||
bevy_utils_proc_macros = { version = "0.14.0-dev", path = "macros" }
|
||||
petgraph = "0.6"
|
||||
thiserror = "1.0"
|
||||
thread_local = "1.0"
|
||||
nonmax = "0.5"
|
||||
smallvec = { version = "1.11", features = ["serde", "union", "const_generics"] }
|
||||
|
||||
[dev-dependencies]
|
||||
static_assertions = "1.1.0"
|
||||
|
|
|
@ -15,8 +15,6 @@ pub use short_names::get_short_name;
|
|||
pub mod synccell;
|
||||
pub mod syncunsafecell;
|
||||
|
||||
pub mod uuid;
|
||||
|
||||
mod cow_arc;
|
||||
mod default;
|
||||
mod float_ord;
|
||||
|
@ -24,7 +22,6 @@ pub mod intern;
|
|||
mod once;
|
||||
mod parallel_queue;
|
||||
|
||||
pub use crate::uuid::Uuid;
|
||||
pub use ahash::{AHasher, RandomState};
|
||||
pub use bevy_utils_proc_macros::*;
|
||||
pub use cow_arc::*;
|
||||
|
@ -32,17 +29,9 @@ pub use default::default;
|
|||
pub use float_ord::*;
|
||||
pub use hashbrown;
|
||||
pub use parallel_queue::*;
|
||||
pub use petgraph;
|
||||
pub use smallvec;
|
||||
pub use thiserror;
|
||||
pub use tracing;
|
||||
pub use web_time::{Duration, Instant, SystemTime, SystemTimeError, TryFromFloatSecsError};
|
||||
|
||||
#[allow(missing_docs)]
|
||||
pub mod nonmax {
|
||||
pub use nonmax::*;
|
||||
}
|
||||
|
||||
use hashbrown::hash_map::RawEntryMut;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
//! UUID utilities.
|
||||
//!
|
||||
//! This module re-exports the [`Uuid`] type from the [`uuid`] crate,
|
||||
//! and provides additional utility functions.
|
||||
//!
|
||||
//! [`uuid`]: uuid
|
||||
|
||||
pub use ::uuid::Uuid;
|
||||
|
||||
/// Generates a new UUID from the given UUIDs `a` and `b`,
|
||||
/// where the bytes are generated by a bitwise `a ^ b.rotate_right(1)`.
|
||||
///
|
||||
/// The generated UUID will be a `UUIDv4`
|
||||
/// (meaning that the bytes should be random, not e.g. derived from the system time).
|
||||
#[allow(clippy::unusual_byte_groupings)] // unusual byte grouping is meant to signal the relevant bits
|
||||
pub const fn generate_composite_uuid(a: Uuid, b: Uuid) -> Uuid {
|
||||
let mut new = [0; 16];
|
||||
let mut i = 0;
|
||||
while i < new.len() {
|
||||
// rotating ensures different uuids for A<B<C>> and B<A<C>> because: A ^ (B ^ C) = B ^ (A ^ C)
|
||||
// notice that you have to rotate the second parameter: A.rr ^ (B.rr ^ C) = B.rr ^ (A.rr ^ C)
|
||||
// Solution: A ^ (B ^ C.rr).rr != B ^ (A ^ C.rr).rr
|
||||
new[i] = a.as_bytes()[i] ^ b.as_bytes()[i].rotate_right(1);
|
||||
|
||||
i += 1;
|
||||
}
|
||||
|
||||
// Version: the most significant 4 bits in the 6th byte: 11110000
|
||||
new[6] = new[6] & 0b0000_1111 | 0b0100_0000; // set version to v4
|
||||
|
||||
// Variant: the most significant 3 bits in the 8th byte: 11100000
|
||||
new[8] = new[8] & 0b000_11111 | 0b100_00000; // set variant to rfc4122
|
||||
|
||||
Uuid::from_bytes(new)
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
//! Implements loader for a Gzip compressed asset.
|
||||
|
||||
use bevy::utils::thiserror;
|
||||
use bevy::{
|
||||
asset::{
|
||||
io::{Reader, VecReader},
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//! Implements loader for a custom asset type.
|
||||
|
||||
use bevy::utils::thiserror;
|
||||
use bevy::{
|
||||
asset::{io::Reader, ron, AssetLoader, AsyncReadExt, LoadContext},
|
||||
prelude::*,
|
||||
|
|
|
@ -12,7 +12,7 @@ use bevy::{
|
|||
},
|
||||
prelude::*,
|
||||
reflect::TypePath,
|
||||
utils::{thiserror, BoxedFuture},
|
||||
utils::BoxedFuture,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::Infallible;
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
//! This example displays each contributor to the bevy source code as a bouncing bevy-ball.
|
||||
|
||||
use bevy::{
|
||||
math::bounding::Aabb2d,
|
||||
prelude::*,
|
||||
utils::{thiserror, HashMap},
|
||||
};
|
||||
use bevy::{math::bounding::Aabb2d, prelude::*, utils::HashMap};
|
||||
use rand::{prelude::SliceRandom, Rng};
|
||||
use std::{
|
||||
env::VarError,
|
||||
|
|
Loading…
Reference in a new issue