Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6aafecb
Channel-based mesh collection and prep.
aevyrie Dec 29, 2025
1ba8491
Tweak chunk size
aevyrie Dec 29, 2025
3eba77c
Revert toml formatter changes
aevyrie Dec 29, 2025
a2cfded
Fix bug in mesh material indexing
aevyrie Dec 29, 2025
cd40ac6
fix clippy lints
aevyrie Dec 29, 2025
d360eb9
more lints
aevyrie Dec 29, 2025
8e4780f
reduce diff
aevyrie Dec 29, 2025
860d3cf
better handle mesh re-extraction, fix single threaded deadlock, impro…
aevyrie Dec 30, 2025
8917e4d
Fix doc links
aevyrie Dec 30, 2025
04de8fc
Merge branch 'main' into par-mesh-collection
aevyrie Dec 30, 2025
6f785cb
Tune chunk size
aevyrie Dec 30, 2025
eca0c30
Refactor order and comments for readability
aevyrie Dec 30, 2025
d1cd1e5
Refactor buffered channel logic into a struct.
aevyrie Jan 2, 2026
7735924
Async buffered channel
aevyrie Jan 2, 2026
9d8680a
Correctly instrument async closure, add doc comments to gpu struct
aevyrie Jan 2, 2026
fa4f1d3
fmt
aevyrie Jan 2, 2026
7b2e3cb
Consolidate block_on impl to fix WASM build error
aevyrie Jan 2, 2026
716e632
Remove unnecessary qualification
aevyrie Jan 2, 2026
809bc66
Fix doc link
aevyrie Jan 2, 2026
69f235e
Fix vecs not being reused when consumed by intoiterator
aevyrie Jan 2, 2026
23c8f08
Merge branch 'main' into par-mesh-collection
aevyrie Jan 2, 2026
a3aa5a7
Merge branch 'main' into par-mesh-collection
aevyrie Jan 9, 2026
ae85d1f
Merge branch 'main' into par-mesh-collection
aevyrie Jan 17, 2026
9e4f42f
Fix bevy_tasks dep missing
aevyrie Jan 17, 2026
f732eca
Merge branch 'main' into par-mesh-collection
aevyrie Jan 17, 2026
2cc67d2
chore: Trigger CI/CD pipeline
aevyrie Jan 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/bevy_pbr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bluenoise_texture = ["bevy_image/ktx2", "bevy_image/zstd"]
shader_format_glsl = ["bevy_shader/shader_format_glsl"]
trace = ["bevy_render/trace"]
# Enables the meshlet renderer for dense high-poly scenes (experimental)
meshlet = ["dep:lz4_flex", "dep:range-alloc", "dep:bevy_tasks"]
meshlet = ["dep:lz4_flex", "dep:range-alloc"]
# Enables processing meshes into meshlet meshes
meshlet_processor = [
"meshlet",
Expand Down Expand Up @@ -56,7 +56,7 @@ bevy_render = { path = "../bevy_render", version = "0.19.0-dev", features = [
"morph",
] }
bevy_camera = { path = "../bevy_camera", version = "0.19.0-dev" }
bevy_tasks = { path = "../bevy_tasks", version = "0.19.0-dev", optional = true }
bevy_tasks = { path = "../bevy_tasks", version = "0.19.0-dev" }
bevy_transform = { path = "../bevy_transform", version = "0.19.0-dev" }
bevy_utils = { path = "../bevy_utils", version = "0.19.0-dev" }
bevy_platform = { path = "../bevy_platform", version = "0.19.0-dev", default-features = false, features = [
Expand Down
313 changes: 209 additions & 104 deletions crates/bevy_pbr/src/render/mesh.rs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions crates/bevy_platform/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ rayon = ["dep:rayon", "hashbrown/rayon"]

# Platform Compatibility

## Provides an implementation of `block_on` from `futures-lite`.
futures-lite = ["std", "dep:futures-lite", "futures-lite?/std"]

## Provides an implementation of `block_on` from `async-io`.
async-io = ["std", "dep:async-io"]

## Allows access to the `std` crate. Enabling this feature will prevent compilation
## on `no_std` targets, but provides access to certain additional features on
## supported platforms.
Expand Down Expand Up @@ -72,6 +78,8 @@ hashbrown = { version = "0.16.1", features = [
], optional = true, default-features = false }
serde = { version = "1", default-features = false, optional = true }
rayon = { version = "1", default-features = false, optional = true }
futures-lite = { version = "2.0.1", default-features = false, optional = true }
async-io = { version = "2.0.0", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-time = { version = "1.1", default-features = false, optional = true }
Expand Down
32 changes: 32 additions & 0 deletions crates/bevy_platform/src/future.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//! Platform-aware future utilities.

crate::cfg::switch! {
#[cfg(feature = "async-io")] => {
pub use async_io::block_on;
}
#[cfg(feature = "futures-lite")] => {
pub use futures_lite::future::block_on;
}
_ => {
/// Blocks on the supplied `future`.
/// This implementation will busy-wait until it is completed.
/// Consider enabling the `async-io` or `futures-lite` features.
pub fn block_on<T>(future: impl Future<Output = T>) -> T {
use core::task::{Poll, Context};

// Pin the future on the stack.
let mut future = core::pin::pin!(future);

// We don't care about the waker as we're just going to poll as fast as possible.
let cx = &mut Context::from_waker(core::task::Waker::noop());

// Keep polling until the future is ready.
loop {
match future.as_mut().poll(cx) {
Poll::Ready(output) => return output,
Poll::Pending => core::hint::spin_loop(),
}
}
}
}
}
1 change: 1 addition & 0 deletions crates/bevy_platform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cfg::alloc! {

pub mod cell;
pub mod cfg;
pub mod future;
pub mod hash;
pub mod sync;
pub mod thread;
Expand Down
5 changes: 2 additions & 3 deletions crates/bevy_tasks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ multi_threaded = [
async_executor = ["bevy_platform/std", "dep:async-executor", "futures-lite"]

# Provide an implementation of `block_on` from `futures-lite`.
futures-lite = ["bevy_platform/std", "futures-lite/std"]
futures-lite = ["bevy_platform/futures-lite"]

# 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_platform/std", "dep:async-io"]
async-io = ["bevy_platform/async-io"]

[dependencies]
bevy_platform = { path = "../bevy_platform", version = "0.19.0-dev", default-features = false, features = [
Expand All @@ -46,7 +46,6 @@ derive_more = { version = "2", default-features = false, features = [
] }
async-executor = { version = "1.11", optional = true }
async-channel = { version = "2.3.0", optional = true }
async-io = { version = "2.0.0", optional = true }
concurrent-queue = { version = "2.0.0", optional = true }
atomic-waker = { version = "1", default-features = false }
crossbeam-queue = { version = "0.3", default-features = false, features = [
Expand Down
40 changes: 1 addition & 39 deletions crates/bevy_tasks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ pub mod cfg {
conditional_send
}

#[cfg(feature = "async-io")] => {
/// Indicates `async-io` will be used for the implementation of `block_on`.
async_io
}

#[cfg(feature = "futures-lite")] => {
/// Indicates `futures-lite` will be used for the implementation of `block_on`.
futures_lite
}
}
}

Expand Down Expand Up @@ -114,36 +105,7 @@ cfg::multi_threaded! {
}
}

cfg::switch! {
cfg::async_io => {
pub use async_io::block_on;
}
cfg::futures_lite => {
pub use futures_lite::future::block_on;
}
_ => {
/// Blocks on the supplied `future`.
/// This implementation will busy-wait until it is completed.
/// Consider enabling the `async-io` or `futures-lite` features.
pub fn block_on<T>(future: impl Future<Output = T>) -> T {
use core::task::{Poll, Context};

// Pin the future on the stack.
let mut future = core::pin::pin!(future);

// We don't care about the waker as we're just going to poll as fast as possible.
let cx = &mut Context::from_waker(core::task::Waker::noop());

// Keep polling until the future is ready.
loop {
match future.as_mut().poll(cx) {
Poll::Ready(output) => return output,
Poll::Pending => core::hint::spin_loop(),
}
}
}
}
}
pub use bevy_platform::future::block_on;

/// The tasks prelude.
///
Expand Down
8 changes: 7 additions & 1 deletion crates/bevy_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ license = "MIT OR Apache-2.0"
keywords = ["bevy"]

[features]
default = ["parallel"]
default = ["parallel", "buffered_channel"]

# Provides access to the `Parallel` type.
parallel = ["bevy_platform/std", "dep:thread_local"]

buffered_channel = ["bevy_platform/std", "dep:async-channel"]

std = ["disqualified/alloc"]

debug = ["bevy_platform/alloc"]
Expand All @@ -23,9 +25,13 @@ bevy_platform = { path = "../bevy_platform", version = "0.19.0-dev", default-fea

disqualified = { version = "1.0", default-features = false }
thread_local = { version = "1.0", optional = true }
async-channel = { version = "2.3.0", optional = true }

[dev-dependencies]
static_assertions = "1.1.0"
bevy_ecs = { path = "../bevy_ecs", version = "0.19.0-dev", default-features = false }
bevy_app = { path = "../bevy_app", version = "0.19.0-dev", default-features = false }
bevy_tasks = { path = "../bevy_tasks", version = "0.19.0-dev", default-features = false }

[lints]
workspace = true
Expand Down
Loading