Skip to content

Commit 2cec73b

Browse files
authored
Merge branch 'main' into improve-box-shadow
2 parents b6580fa + 2946de4 commit 2cec73b

File tree

258 files changed

+5987
-4351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+5987
-4351
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
CARGO_PROFILE_TEST_DEBUG: 0
1414
CARGO_PROFILE_DEV_DEBUG: 0
1515
# If nightly is breaking CI, modify this variable to target a specific nightly version.
16-
NIGHTLY_TOOLCHAIN: nightly-2025-05-16 # pinned until a fix for https://github.com/rust-lang/miri/issues/4323 is released
16+
NIGHTLY_TOOLCHAIN: nightly
1717
RUSTFLAGS: "-D warnings"
1818
BINSTALL_VERSION: "v1.12.3"
1919

Cargo.toml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
1010
license = "MIT OR Apache-2.0"
1111
repository = "https://github.com/bevyengine/bevy"
1212
documentation = "https://docs.rs/bevy"
13-
rust-version = "1.85.0"
13+
rust-version = "1.86.0"
1414

1515
[workspace]
1616
resolver = "2"
@@ -548,7 +548,7 @@ rand_chacha = "0.3.1"
548548
ron = "0.8.0"
549549
flate2 = "1.0"
550550
serde = { version = "1", features = ["derive"] }
551-
serde_json = "1"
551+
serde_json = "1.0.140"
552552
bytemuck = "1.7"
553553
bevy_render = { path = "crates/bevy_render", version = "0.16.0-dev", default-features = false }
554554
# The following explicit dependencies are needed for proc macros to work inside of examples as they are part of the bevy crate itself.
@@ -569,7 +569,7 @@ hyper = { version = "1", features = ["server", "http1"] }
569569
http-body-util = "0.1"
570570
anyhow = "1"
571571
macro_rules_attribute = "0.2"
572-
accesskit = "0.18"
572+
accesskit = "0.19"
573573
nonmax = "0.5"
574574

575575
[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
@@ -582,6 +582,17 @@ ureq = { version = "3.0.8", features = ["json"] }
582582
wasm-bindgen = { version = "0.2" }
583583
web-sys = { version = "0.3", features = ["Window"] }
584584

585+
[[example]]
586+
name = "context_menu"
587+
path = "examples/usages/context_menu.rs"
588+
doc-scrape-examples = true
589+
590+
[package.metadata.example.context_menu]
591+
name = "Context Menu"
592+
description = "Example of a context menu"
593+
category = "Usage"
594+
wasm = true
595+
585596
[[example]]
586597
name = "hello_world"
587598
path = "examples/hello_world.rs"
@@ -4390,3 +4401,14 @@ name = "Extended Bindless Material"
43904401
description = "Demonstrates bindless `ExtendedMaterial`"
43914402
category = "Shaders"
43924403
wasm = false
4404+
4405+
[[example]]
4406+
name = "cooldown"
4407+
path = "examples/usage/cooldown.rs"
4408+
doc-scrape-examples = true
4409+
4410+
[package.metadata.example.cooldown]
4411+
name = "Cooldown"
4412+
description = "Example for cooldown on button clicks"
4413+
category = "Usage"
4414+
wasm = true

assets/textures/food_kenney.png

65.7 KB
Loading

benches/benches/bevy_ecs/world/commands.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ pub fn spawn_commands(criterion: &mut Criterion) {
6262
group.finish();
6363
}
6464

65+
pub fn nonempty_spawn_commands(criterion: &mut Criterion) {
66+
let mut group = criterion.benchmark_group("nonempty_spawn_commands");
67+
group.warm_up_time(core::time::Duration::from_millis(500));
68+
group.measurement_time(core::time::Duration::from_secs(4));
69+
70+
for entity_count in [100, 1_000, 10_000] {
71+
group.bench_function(format!("{}_entities", entity_count), |bencher| {
72+
let mut world = World::default();
73+
let mut command_queue = CommandQueue::default();
74+
75+
bencher.iter(|| {
76+
let mut commands = Commands::new(&mut command_queue, &world);
77+
for i in 0..entity_count {
78+
if black_box(i % 2 == 0) {
79+
commands.spawn(A);
80+
}
81+
}
82+
command_queue.apply(&mut world);
83+
});
84+
});
85+
}
86+
87+
group.finish();
88+
}
89+
6590
#[derive(Default, Component)]
6691
struct Matrix([[f32; 4]; 4]);
6792

benches/benches/bevy_ecs/world/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ criterion_group!(
1717
benches,
1818
empty_commands,
1919
spawn_commands,
20+
nonempty_spawn_commands,
2021
insert_commands,
2122
fake_commands,
2223
zero_sized_commands,

crates/bevy_a11y/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev", default-features = fa
4646
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", default-features = false, optional = true }
4747

4848
# other
49-
accesskit = { version = "0.18", default-features = false }
49+
accesskit = { version = "0.19", default-features = false }
5050
serde = { version = "1", default-features = false, features = [
5151
"alloc",
5252
], optional = true }

crates/bevy_anti_aliasing/src/contrast_adaptive_sharpening/mod.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bevy_app::prelude::*;
2-
use bevy_asset::{load_internal_asset, weak_handle, Handle};
2+
use bevy_asset::{embedded_asset, load_embedded_asset, Handle};
33
use bevy_core_pipeline::{
44
core_2d::graph::{Core2d, Node2d},
55
core_3d::graph::{Core3d, Node3d},
@@ -95,20 +95,12 @@ impl ExtractComponent for ContrastAdaptiveSharpening {
9595
}
9696
}
9797

98-
const CONTRAST_ADAPTIVE_SHARPENING_SHADER_HANDLE: Handle<Shader> =
99-
weak_handle!("ef83f0a5-51df-4b51-9ab7-b5fd1ae5a397");
100-
10198
/// Adds Support for Contrast Adaptive Sharpening (CAS).
10299
pub struct CasPlugin;
103100

104101
impl Plugin for CasPlugin {
105102
fn build(&self, app: &mut App) {
106-
load_internal_asset!(
107-
app,
108-
CONTRAST_ADAPTIVE_SHARPENING_SHADER_HANDLE,
109-
"robust_contrast_adaptive_sharpening.wgsl",
110-
Shader::from_wgsl
111-
);
103+
embedded_asset!(app, "robust_contrast_adaptive_sharpening.wgsl");
112104

113105
app.register_type::<ContrastAdaptiveSharpening>();
114106
app.add_plugins((
@@ -171,6 +163,7 @@ impl Plugin for CasPlugin {
171163
pub struct CasPipeline {
172164
texture_bind_group: BindGroupLayout,
173165
sampler: Sampler,
166+
shader: Handle<Shader>,
174167
}
175168

176169
impl FromWorld for CasPipeline {
@@ -194,6 +187,7 @@ impl FromWorld for CasPipeline {
194187
CasPipeline {
195188
texture_bind_group,
196189
sampler,
190+
shader: load_embedded_asset!(render_world, "robust_contrast_adaptive_sharpening.wgsl"),
197191
}
198192
}
199193
}
@@ -217,7 +211,7 @@ impl SpecializedRenderPipeline for CasPipeline {
217211
layout: vec![self.texture_bind_group.clone()],
218212
vertex: fullscreen_shader_vertex_state(),
219213
fragment: Some(FragmentState {
220-
shader: CONTRAST_ADAPTIVE_SHARPENING_SHADER_HANDLE,
214+
shader: self.shader.clone(),
221215
shader_defs,
222216
entry_point: "fragment".into(),
223217
targets: vec![Some(ColorTargetState {

crates/bevy_anti_aliasing/src/fxaa/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bevy_app::prelude::*;
2-
use bevy_asset::{load_internal_asset, weak_handle, Handle};
2+
use bevy_asset::{embedded_asset, load_embedded_asset, Handle};
33
use bevy_core_pipeline::{
44
core_2d::graph::{Core2d, Node2d},
55
core_3d::graph::{Core3d, Node3d},
@@ -80,13 +80,11 @@ impl Default for Fxaa {
8080
}
8181
}
8282

83-
const FXAA_SHADER_HANDLE: Handle<Shader> = weak_handle!("fc58c0a8-01c0-46e9-94cc-83a794bae7b0");
84-
8583
/// Adds support for Fast Approximate Anti-Aliasing (FXAA)
8684
pub struct FxaaPlugin;
8785
impl Plugin for FxaaPlugin {
8886
fn build(&self, app: &mut App) {
89-
load_internal_asset!(app, FXAA_SHADER_HANDLE, "fxaa.wgsl", Shader::from_wgsl);
87+
embedded_asset!(app, "fxaa.wgsl");
9088

9189
app.register_type::<Fxaa>();
9290
app.add_plugins(ExtractComponentPlugin::<Fxaa>::default());
@@ -132,6 +130,7 @@ impl Plugin for FxaaPlugin {
132130
pub struct FxaaPipeline {
133131
texture_bind_group: BindGroupLayout,
134132
sampler: Sampler,
133+
shader: Handle<Shader>,
135134
}
136135

137136
impl FromWorld for FxaaPipeline {
@@ -158,6 +157,7 @@ impl FromWorld for FxaaPipeline {
158157
FxaaPipeline {
159158
texture_bind_group,
160159
sampler,
160+
shader: load_embedded_asset!(render_world, "fxaa.wgsl"),
161161
}
162162
}
163163
}
@@ -183,7 +183,7 @@ impl SpecializedRenderPipeline for FxaaPipeline {
183183
layout: vec![self.texture_bind_group.clone()],
184184
vertex: fullscreen_shader_vertex_state(),
185185
fragment: Some(FragmentState {
186-
shader: FXAA_SHADER_HANDLE,
186+
shader: self.shader.clone(),
187187
shader_defs: vec![
188188
format!("EDGE_THRESH_{}", key.edge_threshold.get_str()).into(),
189189
format!("EDGE_THRESH_MIN_{}", key.edge_threshold_min.get_str()).into(),

crates/bevy_anti_aliasing/src/smaa/mod.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
use bevy_app::{App, Plugin};
3333
#[cfg(feature = "smaa_luts")]
3434
use bevy_asset::load_internal_binary_asset;
35-
use bevy_asset::{load_internal_asset, weak_handle, Handle};
35+
use bevy_asset::{embedded_asset, load_embedded_asset, weak_handle, Handle};
3636
#[cfg(not(feature = "smaa_luts"))]
3737
use bevy_core_pipeline::tonemapping::lut_placeholder;
3838
use bevy_core_pipeline::{
@@ -80,8 +80,6 @@ use bevy_render::{
8080
};
8181
use bevy_utils::prelude::default;
8282

83-
/// The handle of the `smaa.wgsl` shader.
84-
const SMAA_SHADER_HANDLE: Handle<Shader> = weak_handle!("fdd9839f-1ab4-4e0d-88a0-240b67da2ddf");
8583
/// The handle of the area LUT, a KTX2 format texture that SMAA uses internally.
8684
const SMAA_AREA_LUT_TEXTURE_HANDLE: Handle<Image> =
8785
weak_handle!("569c4d67-c7fa-4958-b1af-0836023603c0");
@@ -147,6 +145,8 @@ struct SmaaEdgeDetectionPipeline {
147145
postprocess_bind_group_layout: BindGroupLayout,
148146
/// The bind group layout for data specific to this pass.
149147
edge_detection_bind_group_layout: BindGroupLayout,
148+
/// The shader asset handle.
149+
shader: Handle<Shader>,
150150
}
151151

152152
/// The pipeline data for phase 2 of SMAA: blending weight calculation.
@@ -155,6 +155,8 @@ struct SmaaBlendingWeightCalculationPipeline {
155155
postprocess_bind_group_layout: BindGroupLayout,
156156
/// The bind group layout for data specific to this pass.
157157
blending_weight_calculation_bind_group_layout: BindGroupLayout,
158+
/// The shader asset handle.
159+
shader: Handle<Shader>,
158160
}
159161

160162
/// The pipeline data for phase 3 of SMAA: neighborhood blending.
@@ -163,6 +165,8 @@ struct SmaaNeighborhoodBlendingPipeline {
163165
postprocess_bind_group_layout: BindGroupLayout,
164166
/// The bind group layout for data specific to this pass.
165167
neighborhood_blending_bind_group_layout: BindGroupLayout,
168+
/// The shader asset handle.
169+
shader: Handle<Shader>,
166170
}
167171

168172
/// A unique identifier for a set of SMAA pipelines.
@@ -287,7 +291,7 @@ pub struct SmaaSpecializedRenderPipelines {
287291
impl Plugin for SmaaPlugin {
288292
fn build(&self, app: &mut App) {
289293
// Load the shader.
290-
load_internal_asset!(app, SMAA_SHADER_HANDLE, "smaa.wgsl", Shader::from_wgsl);
294+
embedded_asset!(app, "smaa.wgsl");
291295

292296
// Load the two lookup textures. These are compressed textures in KTX2
293297
// format.
@@ -431,18 +435,23 @@ impl FromWorld for SmaaPipelines {
431435
),
432436
);
433437

438+
let shader = load_embedded_asset!(world, "smaa.wgsl");
439+
434440
SmaaPipelines {
435441
edge_detection: SmaaEdgeDetectionPipeline {
436442
postprocess_bind_group_layout: postprocess_bind_group_layout.clone(),
437443
edge_detection_bind_group_layout,
444+
shader: shader.clone(),
438445
},
439446
blending_weight_calculation: SmaaBlendingWeightCalculationPipeline {
440447
postprocess_bind_group_layout: postprocess_bind_group_layout.clone(),
441448
blending_weight_calculation_bind_group_layout,
449+
shader: shader.clone(),
442450
},
443451
neighborhood_blending: SmaaNeighborhoodBlendingPipeline {
444452
postprocess_bind_group_layout,
445453
neighborhood_blending_bind_group_layout,
454+
shader,
446455
},
447456
}
448457
}
@@ -472,13 +481,13 @@ impl SpecializedRenderPipeline for SmaaEdgeDetectionPipeline {
472481
self.edge_detection_bind_group_layout.clone(),
473482
],
474483
vertex: VertexState {
475-
shader: SMAA_SHADER_HANDLE,
484+
shader: self.shader.clone(),
476485
shader_defs: shader_defs.clone(),
477486
entry_point: "edge_detection_vertex_main".into(),
478487
buffers: vec![],
479488
},
480489
fragment: Some(FragmentState {
481-
shader: SMAA_SHADER_HANDLE,
490+
shader: self.shader.clone(),
482491
shader_defs,
483492
entry_point: "luma_edge_detection_fragment_main".into(),
484493
targets: vec![Some(ColorTargetState {
@@ -532,13 +541,13 @@ impl SpecializedRenderPipeline for SmaaBlendingWeightCalculationPipeline {
532541
self.blending_weight_calculation_bind_group_layout.clone(),
533542
],
534543
vertex: VertexState {
535-
shader: SMAA_SHADER_HANDLE,
544+
shader: self.shader.clone(),
536545
shader_defs: shader_defs.clone(),
537546
entry_point: "blending_weight_calculation_vertex_main".into(),
538547
buffers: vec![],
539548
},
540549
fragment: Some(FragmentState {
541-
shader: SMAA_SHADER_HANDLE,
550+
shader: self.shader.clone(),
542551
shader_defs,
543552
entry_point: "blending_weight_calculation_fragment_main".into(),
544553
targets: vec![Some(ColorTargetState {
@@ -580,13 +589,13 @@ impl SpecializedRenderPipeline for SmaaNeighborhoodBlendingPipeline {
580589
self.neighborhood_blending_bind_group_layout.clone(),
581590
],
582591
vertex: VertexState {
583-
shader: SMAA_SHADER_HANDLE,
592+
shader: self.shader.clone(),
584593
shader_defs: shader_defs.clone(),
585594
entry_point: "neighborhood_blending_vertex_main".into(),
586595
buffers: vec![],
587596
},
588597
fragment: Some(FragmentState {
589-
shader: SMAA_SHADER_HANDLE,
598+
shader: self.shader.clone(),
590599
shader_defs,
591600
entry_point: "neighborhood_blending_fragment_main".into(),
592601
targets: vec![Some(ColorTargetState {

crates/bevy_anti_aliasing/src/taa/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bevy_app::{App, Plugin};
2-
use bevy_asset::{load_internal_asset, weak_handle, Handle};
2+
use bevy_asset::{embedded_asset, load_embedded_asset, Handle};
33
use bevy_core_pipeline::{
44
core_3d::graph::{Core3d, Node3d},
55
fullscreen_vertex_shader::fullscreen_shader_vertex_state,
@@ -40,16 +40,14 @@ use bevy_render::{
4040
};
4141
use tracing::warn;
4242

43-
const TAA_SHADER_HANDLE: Handle<Shader> = weak_handle!("fea20d50-86b6-4069-aa32-374346aec00c");
44-
4543
/// Plugin for temporal anti-aliasing.
4644
///
4745
/// See [`TemporalAntiAliasing`] for more details.
4846
pub struct TemporalAntiAliasPlugin;
4947

5048
impl Plugin for TemporalAntiAliasPlugin {
5149
fn build(&self, app: &mut App) {
52-
load_internal_asset!(app, TAA_SHADER_HANDLE, "taa.wgsl", Shader::from_wgsl);
50+
embedded_asset!(app, "taa.wgsl");
5351

5452
app.register_type::<TemporalAntiAliasing>();
5553

@@ -243,6 +241,7 @@ struct TaaPipeline {
243241
taa_bind_group_layout: BindGroupLayout,
244242
nearest_sampler: Sampler,
245243
linear_sampler: Sampler,
244+
shader: Handle<Shader>,
246245
}
247246

248247
impl FromWorld for TaaPipeline {
@@ -287,6 +286,7 @@ impl FromWorld for TaaPipeline {
287286
taa_bind_group_layout,
288287
nearest_sampler,
289288
linear_sampler,
289+
shader: load_embedded_asset!(world, "taa.wgsl"),
290290
}
291291
}
292292
}
@@ -319,7 +319,7 @@ impl SpecializedRenderPipeline for TaaPipeline {
319319
layout: vec![self.taa_bind_group_layout.clone()],
320320
vertex: fullscreen_shader_vertex_state(),
321321
fragment: Some(FragmentState {
322-
shader: TAA_SHADER_HANDLE,
322+
shader: self.shader.clone(),
323323
shader_defs,
324324
entry_point: "taa".into(),
325325
targets: vec![

0 commit comments

Comments
 (0)