mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
multi_threaded feature rename (#12997)
# Objective Fixes #12966 ## Solution Renaming multi_threaded feature to match snake case ## Migration Guide Bevy feature multi-threaded should be refered to multi_threaded from now on.
This commit is contained in:
parent
59b52fc94e
commit
bb76a2c69c
21 changed files with 53 additions and 53 deletions
|
@ -67,7 +67,7 @@ default = [
|
|||
"bevy_sprite",
|
||||
"bevy_text",
|
||||
"bevy_ui",
|
||||
"multi-threaded",
|
||||
"multi_threaded",
|
||||
"png",
|
||||
"hdr",
|
||||
"vorbis",
|
||||
|
@ -252,7 +252,7 @@ symphonia-wav = ["bevy_internal/symphonia-wav"]
|
|||
serialize = ["bevy_internal/serialize"]
|
||||
|
||||
# Enables multithreaded parallelism in the engine. Disabling it forces all engine tasks to run on a single thread.
|
||||
multi-threaded = ["bevy_internal/multi-threaded"]
|
||||
multi_threaded = ["bevy_internal/multi_threaded"]
|
||||
|
||||
# Use async-io's implementation of block_on instead of futures-lite's implementation. This is preferred if your application uses async-io.
|
||||
async-io = ["bevy_internal/async-io"]
|
||||
|
|
|
@ -11,7 +11,7 @@ rand = "0.8"
|
|||
rand_chacha = "0.3"
|
||||
criterion = { version = "0.3", features = ["html_reports"] }
|
||||
bevy_app = { path = "../crates/bevy_app" }
|
||||
bevy_ecs = { path = "../crates/bevy_ecs", features = ["multi-threaded"] }
|
||||
bevy_ecs = { path = "../crates/bevy_ecs", features = ["multi_threaded"] }
|
||||
bevy_reflect = { path = "../crates/bevy_reflect" }
|
||||
bevy_tasks = { path = "../crates/bevy_tasks" }
|
||||
bevy_utils = { path = "../crates/bevy_utils" }
|
||||
|
|
|
@ -13,7 +13,7 @@ keywords = ["bevy"]
|
|||
[features]
|
||||
file_watcher = ["notify-debouncer-full", "watch"]
|
||||
embedded_watcher = ["file_watcher"]
|
||||
multi-threaded = ["bevy_tasks/multi-threaded"]
|
||||
multi_threaded = ["bevy_tasks/multi_threaded"]
|
||||
asset_processor = []
|
||||
watch = []
|
||||
trace = []
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#[cfg(feature = "file_watcher")]
|
||||
mod file_watcher;
|
||||
|
||||
#[cfg(feature = "multi-threaded")]
|
||||
#[cfg(feature = "multi_threaded")]
|
||||
mod file_asset;
|
||||
#[cfg(not(feature = "multi-threaded"))]
|
||||
#[cfg(not(feature = "multi_threaded"))]
|
||||
mod sync_file_asset;
|
||||
|
||||
use bevy_utils::tracing::error;
|
||||
|
|
|
@ -62,11 +62,11 @@ use bevy_reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath};
|
|||
use bevy_utils::{tracing::error, HashSet};
|
||||
use std::{any::TypeId, sync::Arc};
|
||||
|
||||
#[cfg(all(feature = "file_watcher", not(feature = "multi-threaded")))]
|
||||
#[cfg(all(feature = "file_watcher", not(feature = "multi_threaded")))]
|
||||
compile_error!(
|
||||
"The \"file_watcher\" feature for hot reloading requires the \
|
||||
\"multi-threaded\" feature to be functional.\n\
|
||||
Consider either disabling the \"file_watcher\" feature or enabling \"multi-threaded\""
|
||||
\"multi_threaded\" feature to be functional.\n\
|
||||
Consider either disabling the \"file_watcher\" feature or enabling \"multi_threaded\""
|
||||
);
|
||||
|
||||
/// Provides "asset" loading and processing functionality. An [`Asset`] is a "runtime value" that is loaded from an [`AssetSource`],
|
||||
|
@ -659,8 +659,8 @@ mod tests {
|
|||
#[test]
|
||||
fn load_dependencies() {
|
||||
// The particular usage of GatedReader in this test will cause deadlocking if running single-threaded
|
||||
#[cfg(not(feature = "multi-threaded"))]
|
||||
panic!("This test requires the \"multi-threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi-threaded");
|
||||
#[cfg(not(feature = "multi_threaded"))]
|
||||
panic!("This test requires the \"multi_threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi_threaded");
|
||||
|
||||
let dir = Dir::default();
|
||||
|
||||
|
@ -980,8 +980,8 @@ mod tests {
|
|||
#[test]
|
||||
fn failure_load_states() {
|
||||
// The particular usage of GatedReader in this test will cause deadlocking if running single-threaded
|
||||
#[cfg(not(feature = "multi-threaded"))]
|
||||
panic!("This test requires the \"multi-threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi-threaded");
|
||||
#[cfg(not(feature = "multi_threaded"))]
|
||||
panic!("This test requires the \"multi_threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi_threaded");
|
||||
|
||||
let dir = Dir::default();
|
||||
|
||||
|
@ -1145,8 +1145,8 @@ mod tests {
|
|||
#[test]
|
||||
fn manual_asset_management() {
|
||||
// The particular usage of GatedReader in this test will cause deadlocking if running single-threaded
|
||||
#[cfg(not(feature = "multi-threaded"))]
|
||||
panic!("This test requires the \"multi-threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi-threaded");
|
||||
#[cfg(not(feature = "multi_threaded"))]
|
||||
panic!("This test requires the \"multi_threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi_threaded");
|
||||
|
||||
let dir = Dir::default();
|
||||
let dep_path = "dep.cool.ron";
|
||||
|
@ -1246,8 +1246,8 @@ mod tests {
|
|||
#[test]
|
||||
fn load_folder() {
|
||||
// The particular usage of GatedReader in this test will cause deadlocking if running single-threaded
|
||||
#[cfg(not(feature = "multi-threaded"))]
|
||||
panic!("This test requires the \"multi-threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi-threaded");
|
||||
#[cfg(not(feature = "multi_threaded"))]
|
||||
panic!("This test requires the \"multi_threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi_threaded");
|
||||
|
||||
let dir = Dir::default();
|
||||
|
||||
|
|
|
@ -152,9 +152,9 @@ impl AssetProcessor {
|
|||
|
||||
/// Starts the processor in a background thread.
|
||||
pub fn start(_processor: Res<Self>) {
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
|
||||
error!("Cannot run AssetProcessor in single threaded mode (or WASM) yet.");
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
{
|
||||
let processor = _processor.clone();
|
||||
std::thread::spawn(move || {
|
||||
|
@ -171,7 +171,7 @@ impl AssetProcessor {
|
|||
/// * Scan the unprocessed [`AssetReader`] and remove any final processed assets that are invalid or no longer exist.
|
||||
/// * For each asset in the unprocessed [`AssetReader`], kick off a new "process job", which will process the asset
|
||||
/// (if the latest version of the asset has not been processed).
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
pub fn process_assets(&self) {
|
||||
let start_time = std::time::Instant::now();
|
||||
debug!("Processing Assets");
|
||||
|
@ -322,9 +322,9 @@ impl AssetProcessor {
|
|||
"Folder {} was added. Attempting to re-process",
|
||||
AssetPath::from_path(&path).with_source(source.id())
|
||||
);
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
|
||||
error!("AddFolder event cannot be handled in single threaded mode (or WASM) yet.");
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
IoTaskPool::get().scope(|scope| {
|
||||
scope.spawn(async move {
|
||||
self.process_assets_internal(scope, source, path)
|
||||
|
@ -439,7 +439,7 @@ impl AssetProcessor {
|
|||
}
|
||||
|
||||
#[allow(unused)]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
async fn process_assets_internal<'scope>(
|
||||
&'scope self,
|
||||
scope: &'scope bevy_tasks::Scope<'scope, '_, ()>,
|
||||
|
|
|
@ -11,7 +11,7 @@ categories = ["game-engines", "data-structures"]
|
|||
|
||||
[features]
|
||||
trace = []
|
||||
multi-threaded = ["bevy_tasks/multi-threaded", "arrayvec"]
|
||||
multi_threaded = ["bevy_tasks/multi_threaded", "arrayvec"]
|
||||
bevy_debug_stepping = []
|
||||
default = ["bevy_reflect"]
|
||||
|
||||
|
|
|
@ -928,12 +928,12 @@ impl<'a, E: Event> EventParIter<'a, E> {
|
|||
///
|
||||
/// [`ComputeTaskPool`]: bevy_tasks::ComputeTaskPool
|
||||
pub fn for_each_with_id<FN: Fn(&'a E, EventId<E>) + Send + Sync + Clone>(self, func: FN) {
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
|
||||
{
|
||||
self.into_iter().for_each(|(e, i)| func(e, i));
|
||||
}
|
||||
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
{
|
||||
let pool = bevy_tasks::ComputeTaskPool::get();
|
||||
let thread_count = pool.thread_num();
|
||||
|
|
|
@ -78,7 +78,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> {
|
|||
func(&mut init, item);
|
||||
init
|
||||
};
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
|
||||
{
|
||||
let init = init();
|
||||
// SAFETY:
|
||||
|
@ -93,7 +93,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> {
|
|||
.fold(init, func);
|
||||
}
|
||||
}
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
{
|
||||
let thread_count = bevy_tasks::ComputeTaskPool::get().thread_num();
|
||||
if thread_count <= 1 {
|
||||
|
@ -122,7 +122,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
fn get_batch_size(&self, thread_count: usize) -> usize {
|
||||
let max_items = || {
|
||||
let id_iter = self.state.matched_storage_ids.iter();
|
||||
|
|
|
@ -1393,7 +1393,7 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
|
|||
/// with a mismatched [`WorldId`] is unsound.
|
||||
///
|
||||
/// [`ComputeTaskPool`]: bevy_tasks::ComputeTaskPool
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
pub(crate) unsafe fn par_fold_init_unchecked_manual<'w, T, FN, INIT>(
|
||||
&self,
|
||||
init_accum: INIT,
|
||||
|
|
|
@ -38,18 +38,18 @@ pub enum ExecutorKind {
|
|||
///
|
||||
/// Useful if you're dealing with a single-threaded environment, saving your threads for
|
||||
/// other things, or just trying minimize overhead.
|
||||
#[cfg_attr(any(target_arch = "wasm32", not(feature = "multi-threaded")), default)]
|
||||
#[cfg_attr(any(target_arch = "wasm32", not(feature = "multi_threaded")), default)]
|
||||
SingleThreaded,
|
||||
/// Like [`SingleThreaded`](ExecutorKind::SingleThreaded) but calls [`apply_deferred`](crate::system::System::apply_deferred)
|
||||
/// immediately after running each system.
|
||||
Simple,
|
||||
/// Runs the schedule using a thread pool. Non-conflicting systems can run in parallel.
|
||||
#[cfg_attr(all(not(target_arch = "wasm32"), feature = "multi-threaded"), default)]
|
||||
#[cfg_attr(all(not(target_arch = "wasm32"), feature = "multi_threaded"), default)]
|
||||
MultiThreaded,
|
||||
}
|
||||
|
||||
/// Holds systems and conditions of a [`Schedule`](super::Schedule) sorted in topological order
|
||||
/// (along with dependency information for multi-threaded execution).
|
||||
/// (along with dependency information for `multi_threaded` execution).
|
||||
///
|
||||
/// Since the arrays are sorted in the same order, elements are referenced by their index.
|
||||
/// [`FixedBitSet`] is used as a smaller, more efficient substitute of `HashSet<usize>`.
|
||||
|
|
|
@ -317,7 +317,7 @@ impl<'scope, 'env: 'scope, 'sys> Context<'scope, 'env, 'sys> {
|
|||
}
|
||||
|
||||
impl MultiThreadedExecutor {
|
||||
/// Creates a new multi-threaded executor for use with a [`Schedule`].
|
||||
/// Creates a new `multi_threaded` executor for use with a [`Schedule`].
|
||||
///
|
||||
/// [`Schedule`]: crate::schedule::Schedule
|
||||
pub fn new() -> Self {
|
||||
|
|
|
@ -1419,7 +1419,7 @@ impl ScheduleGraph {
|
|||
let hg_node_count = self.hierarchy.graph.node_count();
|
||||
|
||||
// get the number of dependencies and the immediate dependents of each system
|
||||
// (needed by multi-threaded executor to run systems in the correct order)
|
||||
// (needed by multi_threaded executor to run systems in the correct order)
|
||||
let mut system_dependencies = Vec::with_capacity(sys_count);
|
||||
let mut system_dependents = Vec::with_capacity(sys_count);
|
||||
for &sys_id in &dg_system_ids {
|
||||
|
|
|
@ -77,11 +77,11 @@ serialize = [
|
|||
"bevy_ui?/serialize",
|
||||
"bevy_color?/serialize",
|
||||
]
|
||||
multi-threaded = [
|
||||
"bevy_asset?/multi-threaded",
|
||||
"bevy_ecs/multi-threaded",
|
||||
"bevy_render?/multi-threaded",
|
||||
"bevy_tasks/multi-threaded",
|
||||
multi_threaded = [
|
||||
"bevy_asset?/multi_threaded",
|
||||
"bevy_ecs/multi_threaded",
|
||||
"bevy_render?/multi_threaded",
|
||||
"bevy_tasks/multi_threaded",
|
||||
]
|
||||
async-io = ["bevy_tasks/async-io"]
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ impl PluginGroup for DefaultPlugins {
|
|||
// compressed texture formats
|
||||
.add(bevy_render::texture::ImagePlugin::default());
|
||||
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
{
|
||||
group = group.add(bevy_render::pipelined_rendering::PipelinedRenderingPlugin);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ bmp = ["image/bmp"]
|
|||
webp = ["image/webp"]
|
||||
dds = ["ddsfile"]
|
||||
pnm = ["image/pnm"]
|
||||
multi-threaded = ["bevy_tasks/multi-threaded"]
|
||||
multi_threaded = ["bevy_tasks/multi_threaded"]
|
||||
|
||||
shader_format_glsl = ["naga/glsl-in", "naga/wgsl-out", "naga_oil/glsl"]
|
||||
shader_format_spirv = ["wgpu/spirv", "naga/spv-in", "naga/spv-out"]
|
||||
|
|
|
@ -96,7 +96,7 @@ use std::{
|
|||
pub struct RenderPlugin {
|
||||
pub render_creation: RenderCreation,
|
||||
/// If `true`, disables asynchronous pipeline compilation.
|
||||
/// This has no effect on macOS, Wasm, iOS, or without the `multi-threaded` feature.
|
||||
/// This has no effect on macOS, Wasm, iOS, or without the `multi_threaded` feature.
|
||||
pub synchronous_pipeline_compilation: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -982,7 +982,7 @@ impl PipelineCache {
|
|||
#[cfg(all(
|
||||
not(target_arch = "wasm32"),
|
||||
not(target_os = "macos"),
|
||||
feature = "multi-threaded"
|
||||
feature = "multi_threaded"
|
||||
))]
|
||||
fn create_pipeline_task(
|
||||
task: impl Future<Output = Result<Pipeline, PipelineCacheError>> + Send + 'static,
|
||||
|
@ -1001,7 +1001,7 @@ fn create_pipeline_task(
|
|||
#[cfg(any(
|
||||
target_arch = "wasm32",
|
||||
target_os = "macos",
|
||||
not(feature = "multi-threaded")
|
||||
not(feature = "multi_threaded")
|
||||
))]
|
||||
fn create_pipeline_task(
|
||||
task: impl Future<Output = Result<Pipeline, PipelineCacheError>> + Send + 'static,
|
||||
|
|
|
@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
|
|||
keywords = ["bevy"]
|
||||
|
||||
[features]
|
||||
multi-threaded = ["dep:async-channel", "dep:concurrent-queue"]
|
||||
multi_threaded = ["dep:async-channel", "dep:concurrent-queue"]
|
||||
|
||||
[dependencies]
|
||||
futures-lite = "2.0.1"
|
||||
|
|
|
@ -11,14 +11,14 @@ pub use slice::{ParallelSlice, ParallelSliceMut};
|
|||
mod task;
|
||||
pub use task::Task;
|
||||
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
mod task_pool;
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
pub use task_pool::{Scope, TaskPool, TaskPoolBuilder};
|
||||
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
|
||||
mod single_threaded_task_pool;
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
|
||||
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
|
||||
pub use single_threaded_task_pool::{FakeTask, Scope, TaskPool, TaskPoolBuilder, ThreadExecutor};
|
||||
|
||||
mod usages;
|
||||
|
@ -26,9 +26,9 @@ mod usages;
|
|||
pub use usages::tick_global_task_pools_on_main_thread;
|
||||
pub use usages::{AsyncComputeTaskPool, ComputeTaskPool, IoTaskPool};
|
||||
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
mod thread_executor;
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
pub use thread_executor::{ThreadExecutor, ThreadExecutorTicker};
|
||||
|
||||
#[cfg(feature = "async-io")]
|
||||
|
|
|
@ -31,7 +31,7 @@ The default feature set enables most of the expected features of a game engine,
|
|||
|default_font|Include a default font, containing only ASCII characters, at the cost of a 20kB binary size increase|
|
||||
|hdr|HDR image format support|
|
||||
|ktx2|KTX2 compressed texture support|
|
||||
|multi-threaded|Enables multithreaded parallelism in the engine. Disabling it forces all engine tasks to run on a single thread.|
|
||||
|multi_threaded|Enables multithreaded parallelism in the engine. Disabling it forces all engine tasks to run on a single thread.|
|
||||
|png|PNG image format support|
|
||||
|sysinfo_plugin|Enables system information diagnostic plugin|
|
||||
|tonemapping_luts|Include tonemapping Look Up Tables KTX2 files. If everything is pink, you need to enable this feature or change the `Tonemapping` method on your `Camera2dBundle` or `Camera3dBundle`.|
|
||||
|
|
Loading…
Reference in a new issue