Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into thread-local
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-holmes committed Feb 25, 2025
2 parents a89d19e + 283654c commit a114044
Show file tree
Hide file tree
Showing 626 changed files with 33,514 additions and 10,796 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/[email protected].5
uses: crate-ci/[email protected].7
- name: Typos info
if: failure()
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
env:
# needs to be in sync with [package.metadata.docs.rs]
RUSTFLAGS: --cfg docsrs_dep
RUSTDOCFLAGS: -Zunstable-options --cfg=docsrs --generate-link-to-definition
RUSTDOCFLAGS: -Zunstable-options --cfg=docsrs --generate-link-to-definition --html-after-content docs-rs/trait-tags.html
run: |
cargo doc \
-Zunstable-options \
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/validation-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ jobs:
example_name=`basename $example .ron`
echo -n $example_name > last_example_run
echo "running $example_name - "`date`
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"
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"
sleep 10
if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
mkdir screenshots-$example_name
Expand All @@ -186,6 +186,17 @@ jobs:
name: example-run-windows
path: example-run/

compare-windows-screenshots:
name: Compare Windows screenshots
needs: [run-examples-on-windows-dx12]
uses: ./.github/workflows/send-screenshots-to-pixeleagle.yml
with:
commit: ${{ github.sha }}
branch: ${{ github.ref_name }}
artifact: screenshots-windows
os: windows
secrets: inherit

run-examples-on-wasm:
if: ${{ github.event_name == 'merge_group' }}
runs-on: ubuntu-latest
Expand All @@ -208,13 +219,6 @@ jobs:
target/
key: ${{ runner.os }}-wasm-run-examples-${{ hashFiles('**/Cargo.toml') }}

- name: install xvfb, llvmpipe and lavapipe
run: |
sudo apt-get update -y -qq
sudo add-apt-repository ppa:kisak/turtle -y
sudo apt-get update
sudo apt install -y xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: Install wasm-bindgen
run: cargo install --force wasm-bindgen-cli

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ crates/**/target
benches/**/target
tools/**/target
**/*.rs.bk
rustc-ice-*.txt

# DX12 wgpu backend
dxcompiler.dll
Expand Down
6 changes: 3 additions & 3 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* Cake from [Kenney's Food Kit](https://www.kenney.nl/assets/food-kit) (CC0 1.0 Universal)
* Ground tile from [Kenney's Tower Defense Kit](https://www.kenney.nl/assets/tower-defense-kit) (CC0 1.0 Universal)
* Game icons from [Kenney's Game Icons](https://www.kenney.nl/assets/game-icons) (CC0 1.0 Universal)
* Space ships from [Kenny's Simple Space Kit](https://www.kenney.nl/assets/simple-space) (CC0 1.0 Universal)
* UI borders from [Kenny's Fantasy UI Borders Kit](https://kenney.nl/assets/fantasy-ui-borders) (CC0 1.0 Universal)
* Space ships from [Kenney's Simple Space Kit](https://www.kenney.nl/assets/simple-space) (CC0 1.0 Universal)
* UI borders from [Kenney's Fantasy UI Borders Kit](https://kenney.nl/assets/fantasy-ui-borders) (CC0 1.0 Universal)
* glTF animated fox from [glTF Sample Models][fox]
* Low poly fox [by PixelMannen] (CC0 1.0 Universal)
* Rigging and animation [by @tomkranis on Sketchfab] ([CC-BY 4.0])
Expand All @@ -32,7 +32,7 @@
* 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/))

[MorphStressTest]: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/MorphStressTest
[fox]: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Fox
[fox]: https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/Fox
[by PixelMannen]: https://opengameart.org/content/fox-and-shiba
[by @tomkranis on Sketchfab]: https://sketchfab.com/models/371dea88d7e04a76af5763f2a36866bc
[CC-BY 4.0]: https://creativecommons.org/licenses/by/4.0/
72 changes: 66 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ members = [
# Bevy's error codes. This is a crate so we can automatically check all of the code blocks.
"errors",
]
exclude = [
# Integration tests are not part of the workspace
"tests-integration",
]

[workspace.lints.clippy]
doc_markdown = "warn"
Expand All @@ -42,6 +46,7 @@ undocumented_unsafe_blocks = "warn"
unwrap_or_default = "warn"
needless_lifetimes = "allow"
too_many_arguments = "allow"
nonstandard_macro_braces = "warn"

ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
Expand Down Expand Up @@ -87,6 +92,7 @@ undocumented_unsafe_blocks = "warn"
unwrap_or_default = "warn"
needless_lifetimes = "allow"
too_many_arguments = "allow"
nonstandard_macro_braces = "warn"

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

# Statically linked DXC shader compiler for DirectX 12
statically-linked-dxc = ["bevy_internal/statically-linked-dxc"]

# Tracing support, saving a file in Chrome Tracing format
trace_chrome = ["trace", "bevy_internal/trace_chrome"]

Expand All @@ -270,7 +279,7 @@ trace_tracy_memory = [
]

# Tracing support
trace = ["bevy_internal/trace"]
trace = ["bevy_internal/trace", "dep:tracing"]

# Basis Universal compressed texture support
basis-universal = ["bevy_internal/basis-universal"]
Expand Down Expand Up @@ -457,9 +466,6 @@ meshlet = ["bevy_internal/meshlet"]
# Enables processing meshes into meshlet meshes for bevy_pbr
meshlet_processor = ["bevy_internal/meshlet_processor"]

# Enable support for the ios_simulator by downgrading some rendering capabilities
ios_simulator = ["bevy_internal/ios_simulator"]

# Enable built in global state machines
bevy_state = ["bevy_internal/bevy_state"]

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

# Enable documentation reflection
reflect_documentation = ["bevy_internal/reflect_documentation"]

# Enable winit custom cursor support
custom_cursor = ["bevy_internal/custom_cursor"]

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

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

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

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

[[example]]
name = "edit_material_on_gltf"
path = "examples/3d/edit_material_on_gltf.rs"
doc-scrape-examples = true

[package.metadata.example.edit_material_on_gltf]
name = "Edit Gltf Material"
description = "Showcases changing materials of a Gltf after Scene spawn"
category = "3D Rendering"
wasm = true

[[example]]
name = "lighting"
path = "examples/3d/lighting.rs"
Expand Down Expand Up @@ -1996,6 +2025,17 @@ description = "Demonstrates how to send and receive events of the same type in a
category = "ECS (Entity Component System)"
wasm = false

[[example]]
name = "entity_disabling"
path = "examples/ecs/entity_disabling.rs"
doc-scrape-examples = true

[package.metadata.example.entity_disabling]
name = "Entity disabling"
description = "Demonstrates how to hide entities from the ECS without deleting them"
category = "ECS (Entity Component System)"
wasm = true

[[example]]
name = "fixed_timestep"
path = "examples/ecs/fixed_timestep.rs"
Expand Down Expand Up @@ -2121,6 +2161,7 @@ wasm = false
name = "fallible_systems"
path = "examples/ecs/fallible_systems.rs"
doc-scrape-examples = true
required-features = ["bevy_mesh_picking_backend"]

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

[[example]]
name = "custom_render_phase"
path = "examples/shader/custom_render_phase.rs"
doc-scrape-examples = true

[package.metadata.example.custom_render_phase]
name = "Custom Render Phase"
description = "Shows how to make a complete render phase"
category = "Shaders"
wasm = true


[[example]]
name = "automatic_instancing"
path = "examples/shader/automatic_instancing.rs"
Expand Down Expand Up @@ -3952,7 +4005,6 @@ name = "Sprite Picking"
description = "Demonstrates picking sprites and sprite atlases"
category = "Picking"
wasm = true
required-features = ["bevy_sprite_picking_backend"]

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

Expand Down
Binary file modified assets/models/animated/Fox.glb
Binary file not shown.
5 changes: 1 addition & 4 deletions assets/scenes/load_scene_example.scn.ron
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
entities: {
4294967296: (
components: {
"bevy_ecs::name::Name": (
hash: 17588334858059901562,
name: "joe",
),
"bevy_ecs::name::Name": "joe",
"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)),
"bevy_transform::components::transform::Transform": (
translation: (0.0, 0.0, 0.0),
Expand Down
43 changes: 43 additions & 0 deletions assets/shaders/automatic_instancing.wgsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#import bevy_pbr::{
mesh_functions,
view_transformations::position_world_to_clip
}

@group(2) @binding(0) var texture: texture_2d<f32>;
@group(2) @binding(1) var texture_sampler: sampler;

struct Vertex {
@builtin(instance_index) instance_index: u32,
@location(0) position: vec3<f32>,
};

struct VertexOutput {
@builtin(position) clip_position: vec4<f32>,
@location(0) world_position: vec4<f32>,
@location(1) color: vec4<f32>,
};

@vertex
fn vertex(vertex: Vertex) -> VertexOutput {
var out: VertexOutput;

// Lookup the tag for the given mesh
let tag = mesh_functions::get_tag(vertex.instance_index);
var world_from_local = mesh_functions::get_world_from_local(vertex.instance_index);
out.world_position = mesh_functions::mesh_position_local_to_world(world_from_local, vec4(vertex.position, 1.0));
out.clip_position = position_world_to_clip(out.world_position.xyz);

let tex_dim = textureDimensions(texture);
// Find the texel coordinate as derived from the tag
let texel_coord = vec2<u32>(tag % tex_dim.x, tag / tex_dim.x);

out.color = textureLoad(texture, texel_coord, 0);
return out;
}

@fragment
fn fragment(
mesh: VertexOutput,
) -> @location(0) vec4<f32> {
return mesh.color;
}
20 changes: 14 additions & 6 deletions assets/shaders/bindless_material.wgsl
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#import bevy_pbr::forward_io::VertexOutput
#import bevy_pbr::mesh_bindings::mesh
#import bevy_render::bindless::{bindless_samplers_filtering, bindless_textures_2d}

struct Color {
base_color: vec4<f32>,
}

// This structure is a mapping from bindless index to the index in the
// appropriate slab
struct MaterialBindings {
material: u32, // 0
color_texture: u32, // 1
color_texture_sampler: u32, // 2
}

#ifdef BINDLESS
@group(2) @binding(0) var<storage> material_color: binding_array<Color, 4>;
@group(2) @binding(1) var material_color_texture: binding_array<texture_2d<f32>, 4>;
@group(2) @binding(2) var material_color_sampler: binding_array<sampler, 4>;
@group(2) @binding(0) var<storage> materials: binding_array<MaterialBindings>;
@group(2) @binding(10) var<storage> material_color: binding_array<Color>;
#else // BINDLESS
@group(2) @binding(0) var<uniform> material_color: Color;
@group(2) @binding(1) var material_color_texture: texture_2d<f32>;
Expand All @@ -19,15 +27,15 @@ struct Color {
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
#ifdef BINDLESS
let slot = mesh[in.instance_index].material_and_lightmap_bind_group_slot & 0xffffu;
let base_color = material_color[slot].base_color;
let base_color = material_color[materials[slot].material].base_color;
#else // BINDLESS
let base_color = material_color.base_color;
#endif // BINDLESS

return base_color * textureSampleLevel(
#ifdef BINDLESS
material_color_texture[slot],
material_color_sampler[slot],
bindless_textures_2d[materials[slot].color_texture],
bindless_samplers_filtering[materials[slot].color_texture_sampler],
#else // BINDLESS
material_color_texture,
material_color_sampler,
Expand Down
Loading

0 comments on commit a114044

Please sign in to comment.