Skip to content

Commit a114044

Browse files
committed
Merge remote-tracking branch 'upstream/main' into thread-local
2 parents a89d19e + 283654c commit a114044

File tree

626 files changed

+33514
-10796
lines changed

Some content is hidden

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

626 files changed

+33514
-10796
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ jobs:
244244
steps:
245245
- uses: actions/checkout@v4
246246
- name: Check for typos
247-
uses: crate-ci/typos@v1.29.5
247+
uses: crate-ci/typos@v1.29.7
248248
- name: Typos info
249249
if: failure()
250250
run: |

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
env:
6060
# needs to be in sync with [package.metadata.docs.rs]
6161
RUSTFLAGS: --cfg docsrs_dep
62-
RUSTDOCFLAGS: -Zunstable-options --cfg=docsrs --generate-link-to-definition
62+
RUSTDOCFLAGS: -Zunstable-options --cfg=docsrs --generate-link-to-definition --html-after-content docs-rs/trait-tags.html
6363
run: |
6464
cargo doc \
6565
-Zunstable-options \

.github/workflows/validation-jobs.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ jobs:
161161
example_name=`basename $example .ron`
162162
echo -n $example_name > last_example_run
163163
echo "running $example_name - "`date`
164-
time WGPU_BACKEND=dx12 TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome"
164+
time WGPU_BACKEND=dx12 TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example cargo run --example $example_name --features "statically-linked-dxc,bevy_ci_testing,trace,trace_chrome"
165165
sleep 10
166166
if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
167167
mkdir screenshots-$example_name
@@ -186,6 +186,17 @@ jobs:
186186
name: example-run-windows
187187
path: example-run/
188188

189+
compare-windows-screenshots:
190+
name: Compare Windows screenshots
191+
needs: [run-examples-on-windows-dx12]
192+
uses: ./.github/workflows/send-screenshots-to-pixeleagle.yml
193+
with:
194+
commit: ${{ github.sha }}
195+
branch: ${{ github.ref_name }}
196+
artifact: screenshots-windows
197+
os: windows
198+
secrets: inherit
199+
189200
run-examples-on-wasm:
190201
if: ${{ github.event_name == 'merge_group' }}
191202
runs-on: ubuntu-latest
@@ -208,13 +219,6 @@ jobs:
208219
target/
209220
key: ${{ runner.os }}-wasm-run-examples-${{ hashFiles('**/Cargo.toml') }}
210221

211-
- name: install xvfb, llvmpipe and lavapipe
212-
run: |
213-
sudo apt-get update -y -qq
214-
sudo add-apt-repository ppa:kisak/turtle -y
215-
sudo apt-get update
216-
sudo apt install -y xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
217-
218222
- name: Install wasm-bindgen
219223
run: cargo install --force wasm-bindgen-cli
220224

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ crates/**/target
77
benches/**/target
88
tools/**/target
99
**/*.rs.bk
10+
rustc-ice-*.txt
1011

1112
# DX12 wgpu backend
1213
dxcompiler.dll

CREDITS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
* Cake from [Kenney's Food Kit](https://www.kenney.nl/assets/food-kit) (CC0 1.0 Universal)
2121
* Ground tile from [Kenney's Tower Defense Kit](https://www.kenney.nl/assets/tower-defense-kit) (CC0 1.0 Universal)
2222
* Game icons from [Kenney's Game Icons](https://www.kenney.nl/assets/game-icons) (CC0 1.0 Universal)
23-
* Space ships from [Kenny's Simple Space Kit](https://www.kenney.nl/assets/simple-space) (CC0 1.0 Universal)
24-
* UI borders from [Kenny's Fantasy UI Borders Kit](https://kenney.nl/assets/fantasy-ui-borders) (CC0 1.0 Universal)
23+
* Space ships from [Kenney's Simple Space Kit](https://www.kenney.nl/assets/simple-space) (CC0 1.0 Universal)
24+
* UI borders from [Kenney's Fantasy UI Borders Kit](https://kenney.nl/assets/fantasy-ui-borders) (CC0 1.0 Universal)
2525
* glTF animated fox from [glTF Sample Models][fox]
2626
* Low poly fox [by PixelMannen] (CC0 1.0 Universal)
2727
* Rigging and animation [by @tomkranis on Sketchfab] ([CC-BY 4.0])
@@ -32,7 +32,7 @@
3232
* Epic orchestra music sample, modified to loop, from [Migfus20](https://freesound.org/people/Migfus20/sounds/560449/) ([CC BY 4.0 DEED](https://creativecommons.org/licenses/by/4.0/))
3333

3434
[MorphStressTest]: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/MorphStressTest
35-
[fox]: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Fox
35+
[fox]: https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/Fox
3636
[by PixelMannen]: https://opengameart.org/content/fox-and-shiba
3737
[by @tomkranis on Sketchfab]: https://sketchfab.com/models/371dea88d7e04a76af5763f2a36866bc
3838
[CC-BY 4.0]: https://creativecommons.org/licenses/by/4.0/

Cargo.toml

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ members = [
2929
# Bevy's error codes. This is a crate so we can automatically check all of the code blocks.
3030
"errors",
3131
]
32+
exclude = [
33+
# Integration tests are not part of the workspace
34+
"tests-integration",
35+
]
3236

3337
[workspace.lints.clippy]
3438
doc_markdown = "warn"
@@ -42,6 +46,7 @@ undocumented_unsafe_blocks = "warn"
4246
unwrap_or_default = "warn"
4347
needless_lifetimes = "allow"
4448
too_many_arguments = "allow"
49+
nonstandard_macro_braces = "warn"
4550

4651
ptr_as_ptr = "warn"
4752
ptr_cast_constness = "warn"
@@ -87,6 +92,7 @@ undocumented_unsafe_blocks = "warn"
8792
unwrap_or_default = "warn"
8893
needless_lifetimes = "allow"
8994
too_many_arguments = "allow"
95+
nonstandard_macro_braces = "warn"
9096

9197
ptr_as_ptr = "warn"
9298
ptr_cast_constness = "warn"
@@ -256,6 +262,9 @@ bevy_remote = ["bevy_internal/bevy_remote"]
256262
# Enable passthrough loading for SPIR-V shaders (Only supported on Vulkan, shader capabilities and extensions must agree with the platform implementation)
257263
spirv_shader_passthrough = ["bevy_internal/spirv_shader_passthrough"]
258264

265+
# Statically linked DXC shader compiler for DirectX 12
266+
statically-linked-dxc = ["bevy_internal/statically-linked-dxc"]
267+
259268
# Tracing support, saving a file in Chrome Tracing format
260269
trace_chrome = ["trace", "bevy_internal/trace_chrome"]
261270

@@ -270,7 +279,7 @@ trace_tracy_memory = [
270279
]
271280

272281
# Tracing support
273-
trace = ["bevy_internal/trace"]
282+
trace = ["bevy_internal/trace", "dep:tracing"]
274283

275284
# Basis Universal compressed texture support
276285
basis-universal = ["bevy_internal/basis-universal"]
@@ -457,9 +466,6 @@ meshlet = ["bevy_internal/meshlet"]
457466
# Enables processing meshes into meshlet meshes for bevy_pbr
458467
meshlet_processor = ["bevy_internal/meshlet_processor"]
459468

460-
# Enable support for the ios_simulator by downgrading some rendering capabilities
461-
ios_simulator = ["bevy_internal/ios_simulator"]
462-
463469
# Enable built in global state machines
464470
bevy_state = ["bevy_internal/bevy_state"]
465471

@@ -469,6 +475,9 @@ track_location = ["bevy_internal/track_location"]
469475
# Enable function reflection
470476
reflect_functions = ["bevy_internal/reflect_functions"]
471477

478+
# Enable documentation reflection
479+
reflect_documentation = ["bevy_internal/reflect_documentation"]
480+
472481
# Enable winit custom cursor support
473482
custom_cursor = ["bevy_internal/custom_cursor"]
474483

@@ -477,6 +486,7 @@ ghost_nodes = ["bevy_internal/ghost_nodes"]
477486

478487
[dependencies]
479488
bevy_internal = { path = "crates/bevy_internal", version = "0.16.0-dev", default-features = false }
489+
tracing = { version = "0.1", default-features = false, optional = true }
480490

481491
# Wasm does not support dynamic linking.
482492
[target.'cfg(not(target_family = "wasm"))'.dependencies]
@@ -491,6 +501,13 @@ serde = { version = "1", features = ["derive"] }
491501
serde_json = "1"
492502
bytemuck = "1.7"
493503
bevy_render = { path = "crates/bevy_render", version = "0.16.0-dev", default-features = false }
504+
# The following explicit dependencies are needed for proc macros to work inside of examples as they are part of the bevy crate itself.
505+
bevy_ecs = { path = "crates/bevy_ecs", version = "0.16.0-dev", default-features = false }
506+
bevy_state = { path = "crates/bevy_state", version = "0.16.0-dev", default-features = false }
507+
bevy_asset = { path = "crates/bevy_asset", version = "0.16.0-dev", default-features = false }
508+
bevy_reflect = { path = "crates/bevy_reflect", version = "0.16.0-dev", default-features = false }
509+
bevy_image = { path = "crates/bevy_image", version = "0.16.0-dev", default-features = false }
510+
bevy_gizmos = { path = "crates/bevy_gizmos", version = "0.16.0-dev", default-features = false }
494511
# Needed to poll Task examples
495512
futures-lite = "2.0.1"
496513
async-std = "1.13"
@@ -503,6 +520,7 @@ http-body-util = "0.1"
503520
anyhow = "1"
504521
macro_rules_attribute = "0.2"
505522
accesskit = "0.17"
523+
nonmax = "0.5"
506524

507525
[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
508526
smol = "2"
@@ -920,6 +938,17 @@ description = "Showcases different blend modes"
920938
category = "3D Rendering"
921939
wasm = true
922940

941+
[[example]]
942+
name = "edit_material_on_gltf"
943+
path = "examples/3d/edit_material_on_gltf.rs"
944+
doc-scrape-examples = true
945+
946+
[package.metadata.example.edit_material_on_gltf]
947+
name = "Edit Gltf Material"
948+
description = "Showcases changing materials of a Gltf after Scene spawn"
949+
category = "3D Rendering"
950+
wasm = true
951+
923952
[[example]]
924953
name = "lighting"
925954
path = "examples/3d/lighting.rs"
@@ -1996,6 +2025,17 @@ description = "Demonstrates how to send and receive events of the same type in a
19962025
category = "ECS (Entity Component System)"
19972026
wasm = false
19982027

2028+
[[example]]
2029+
name = "entity_disabling"
2030+
path = "examples/ecs/entity_disabling.rs"
2031+
doc-scrape-examples = true
2032+
2033+
[package.metadata.example.entity_disabling]
2034+
name = "Entity disabling"
2035+
description = "Demonstrates how to hide entities from the ECS without deleting them"
2036+
category = "ECS (Entity Component System)"
2037+
wasm = true
2038+
19992039
[[example]]
20002040
name = "fixed_timestep"
20012041
path = "examples/ecs/fixed_timestep.rs"
@@ -2121,6 +2161,7 @@ wasm = false
21212161
name = "fallible_systems"
21222162
path = "examples/ecs/fallible_systems.rs"
21232163
doc-scrape-examples = true
2164+
required-features = ["bevy_mesh_picking_backend"]
21242165

21252166
[package.metadata.example.fallible_systems]
21262167
name = "Fallible Systems"
@@ -2691,6 +2732,18 @@ description = "A shader that renders a mesh multiple times in one draw call usin
26912732
category = "Shaders"
26922733
wasm = true
26932734

2735+
[[example]]
2736+
name = "custom_render_phase"
2737+
path = "examples/shader/custom_render_phase.rs"
2738+
doc-scrape-examples = true
2739+
2740+
[package.metadata.example.custom_render_phase]
2741+
name = "Custom Render Phase"
2742+
description = "Shows how to make a complete render phase"
2743+
category = "Shaders"
2744+
wasm = true
2745+
2746+
26942747
[[example]]
26952748
name = "automatic_instancing"
26962749
path = "examples/shader/automatic_instancing.rs"
@@ -3952,7 +4005,6 @@ name = "Sprite Picking"
39524005
description = "Demonstrates picking sprites and sprite atlases"
39534006
category = "Picking"
39544007
wasm = true
3955-
required-features = ["bevy_sprite_picking_backend"]
39564008

39574009
[[example]]
39584010
name = "debug_picking"
@@ -4052,7 +4104,15 @@ panic = "abort"
40524104
# for details on why this is needed. Since dependencies don't expect to be built
40534105
# with `--cfg docsrs` (and thus fail to compile) we use a different cfg.
40544106
rustc-args = ["--cfg", "docsrs_dep"]
4055-
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
4107+
rustdoc-args = [
4108+
"-Zunstable-options",
4109+
"--generate-link-to-definition",
4110+
# Embed tags to the top of documentation pages for common Bevy traits
4111+
# that are implemented by the current type, like `Component` or `Resource`.
4112+
# This makes it easier to see at a glance what types are used for.
4113+
"--html-after-content",
4114+
"docs-rs/trait-tags.html",
4115+
]
40564116
all-features = true
40574117
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
40584118

assets/models/animated/Fox.glb

-4 Bytes
Binary file not shown.

assets/scenes/load_scene_example.scn.ron

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
entities: {
88
4294967296: (
99
components: {
10-
"bevy_ecs::name::Name": (
11-
hash: 17588334858059901562,
12-
name: "joe",
13-
),
10+
"bevy_ecs::name::Name": "joe",
1411
"bevy_transform::components::global_transform::GlobalTransform": ((1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0)),
1512
"bevy_transform::components::transform::Transform": (
1613
translation: (0.0, 0.0, 0.0),
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#import bevy_pbr::{
2+
mesh_functions,
3+
view_transformations::position_world_to_clip
4+
}
5+
6+
@group(2) @binding(0) var texture: texture_2d<f32>;
7+
@group(2) @binding(1) var texture_sampler: sampler;
8+
9+
struct Vertex {
10+
@builtin(instance_index) instance_index: u32,
11+
@location(0) position: vec3<f32>,
12+
};
13+
14+
struct VertexOutput {
15+
@builtin(position) clip_position: vec4<f32>,
16+
@location(0) world_position: vec4<f32>,
17+
@location(1) color: vec4<f32>,
18+
};
19+
20+
@vertex
21+
fn vertex(vertex: Vertex) -> VertexOutput {
22+
var out: VertexOutput;
23+
24+
// Lookup the tag for the given mesh
25+
let tag = mesh_functions::get_tag(vertex.instance_index);
26+
var world_from_local = mesh_functions::get_world_from_local(vertex.instance_index);
27+
out.world_position = mesh_functions::mesh_position_local_to_world(world_from_local, vec4(vertex.position, 1.0));
28+
out.clip_position = position_world_to_clip(out.world_position.xyz);
29+
30+
let tex_dim = textureDimensions(texture);
31+
// Find the texel coordinate as derived from the tag
32+
let texel_coord = vec2<u32>(tag % tex_dim.x, tag / tex_dim.x);
33+
34+
out.color = textureLoad(texture, texel_coord, 0);
35+
return out;
36+
}
37+
38+
@fragment
39+
fn fragment(
40+
mesh: VertexOutput,
41+
) -> @location(0) vec4<f32> {
42+
return mesh.color;
43+
}

assets/shaders/bindless_material.wgsl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
#import bevy_pbr::forward_io::VertexOutput
22
#import bevy_pbr::mesh_bindings::mesh
3+
#import bevy_render::bindless::{bindless_samplers_filtering, bindless_textures_2d}
34

45
struct Color {
56
base_color: vec4<f32>,
67
}
78

9+
// This structure is a mapping from bindless index to the index in the
10+
// appropriate slab
11+
struct MaterialBindings {
12+
material: u32, // 0
13+
color_texture: u32, // 1
14+
color_texture_sampler: u32, // 2
15+
}
16+
817
#ifdef BINDLESS
9-
@group(2) @binding(0) var<storage> material_color: binding_array<Color, 4>;
10-
@group(2) @binding(1) var material_color_texture: binding_array<texture_2d<f32>, 4>;
11-
@group(2) @binding(2) var material_color_sampler: binding_array<sampler, 4>;
18+
@group(2) @binding(0) var<storage> materials: binding_array<MaterialBindings>;
19+
@group(2) @binding(10) var<storage> material_color: binding_array<Color>;
1220
#else // BINDLESS
1321
@group(2) @binding(0) var<uniform> material_color: Color;
1422
@group(2) @binding(1) var material_color_texture: texture_2d<f32>;
@@ -19,15 +27,15 @@ struct Color {
1927
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
2028
#ifdef BINDLESS
2129
let slot = mesh[in.instance_index].material_and_lightmap_bind_group_slot & 0xffffu;
22-
let base_color = material_color[slot].base_color;
30+
let base_color = material_color[materials[slot].material].base_color;
2331
#else // BINDLESS
2432
let base_color = material_color.base_color;
2533
#endif // BINDLESS
2634

2735
return base_color * textureSampleLevel(
2836
#ifdef BINDLESS
29-
material_color_texture[slot],
30-
material_color_sampler[slot],
37+
bindless_textures_2d[materials[slot].color_texture],
38+
bindless_samplers_filtering[materials[slot].color_texture_sampler],
3139
#else // BINDLESS
3240
material_color_texture,
3341
material_color_sampler,

0 commit comments

Comments
 (0)