Skip to content

Commit

Permalink
Merge main into fixed-reflect-hash
Browse files Browse the repository at this point in the history
Conflicts:

- crates/bevy_reflect/src/list.rs
  • Loading branch information
johanhelsing committed Feb 14, 2023
2 parents d4475d1 + fae61ad commit 9ce4f42
Show file tree
Hide file tree
Showing 258 changed files with 7,036 additions and 10,393 deletions.
16 changes: 12 additions & 4 deletions .cargo/config_fast_builds
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
linker = "clang"
rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]

# NOTE: you must manually install https://github.com/michaeleisel/zld on mac. you can easily do this with the "brew" package manager:
# `brew install michaeleisel/zld/zld`
# NOTE: you must install [Mach-O LLD Port](https://lld.llvm.org/MachO/index.html) on mac. you can easily do this by installing llvm which includes lld with the "brew" package manager:
# `brew install llvm`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Zshare-generics=y"]
rustflags = [
"-C",
"link-arg=-fuse-ld=/usr/local/opt/llvm/bin/ld64.lld",
"-Zshare-generics=y",
]

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/bin/zld", "-Zshare-generics=y"]
rustflags = [
"-C",
"link-arg=-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld",
"-Zshare-generics=y",
]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
Expand Down
2 changes: 1 addition & 1 deletion .github/contributing/example_style_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ For more advice on writing examples, see the [relevant section](../../CONTRIBUTI
4. In Queries, prefer `With<T>` filters over actually fetching unused data with `&T`.
5. Prefer disjoint queries using `With` and `Without` over param sets when you need more than one query in a single system.
6. Prefer structs with named fields over tuple structs except in the case of single-field wrapper types.
7. Use enum-labels over string-labels for system / stage / etc. labels.
7. Use enum-labels over string-labels for system / schedule / etc. labels.

## "Feature" examples

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/action-on-PR-labeled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Action on PR labeled

# This workflow has write permissions on the repo
# It must not checkout a PR and run untrusted code

on:
pull_request_target:
types:
- labeled

permissions:
pull-requests: 'write'

jobs:
comment-on-breaking-change-label:
runs-on: ubuntu-latest
if: github.event.label.name == 'C-Breaking-Change' && !contains(github.event.pull_request.body, '## Migration Guide')
steps:
- uses: actions/github-script@v6
with:
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `It looks like your PR is a breaking change, but you didn't provide a migration guide.
Could you add some context on what users should update when this change get released in a new version of Bevy?
It will be used to help writing the migration guide for the version. Putting it after a \`## Migration Guide\` will help it get automatically picked up by our tooling.`
})
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ jobs:
- name: Build bevy
# this uses the same command as when running the example to ensure build is reused
run: |
TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome"
TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome,ktx2,zstd"
- name: Run examples
run: |
for example in .github/example-run/*.ron; do
example_name=`basename $example .ron`
echo -n $example_name > last_example_run
echo "running $example_name - "`date`
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome"
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome,ktx2,zstd"
sleep 10
done
zip traces.zip trace*.json
Expand Down Expand Up @@ -332,14 +332,15 @@ jobs:
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Run cargo check
id: check
run: cargo check
- name: Save PR number
if: ${{ failure() && github.event_name == 'pull_request' }}
if: ${{ failure() && github.event_name == 'pull_request' && steps.check.conclusion == 'failure' }}
run: |
mkdir -p ./msrv
echo ${{ github.event.number }} > ./msrv/NR
- uses: actions/upload-artifact@v2
if: ${{ failure() && github.event_name == 'pull_request' }}
if: ${{ failure() && github.event_name == 'pull_request' && steps.check.conclusion == 'failure' }}
with:
name: msrv
path: msrv/
2 changes: 1 addition & 1 deletion .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
--no-push \
--exclude ci \
--exclude errors \
--exclude bevy-ios-example \
--exclude bevy_mobile_example \
--exclude build-wasm-example
- name: Create PR
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
--dependent-version upgrade \
--exclude ci \
--exclude errors \
--exclude bevy-ios-example \
--exclude bevy_mobile_example \
--exclude build-wasm-example
- name: Create PR
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/validation-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: rustup target add aarch64-apple-ios x86_64-apple-ios

- name: Build and install iOS app in iOS Simulator.
run: cd examples/ios && make install
run: cd examples/mobile && make install

build-android:
runs-on: ubuntu-latest
Expand All @@ -56,7 +56,7 @@ jobs:
run: cargo install --force cargo-apk

- name: Build APK
run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --package bevy-android-example
run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --package bevy_mobile_example

run-examples-on-windows-dx12:
runs-on: windows-latest
Expand All @@ -80,15 +80,15 @@ jobs:
shell: bash
# this uses the same command as when running the example to ensure build is reused
run: |
WGPU_BACKEND=dx12 CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing"
WGPU_BACKEND=dx12 CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,ktx2,zstd"
- name: Run examples
shell: bash
run: |
for example in .github/example-run/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing"
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing,ktx2,zstd"
sleep 10
done
Expand Down
24 changes: 11 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ rust-version = "1.67.0"
exclude = ["benches", "crates/bevy_ecs_compile_fail_tests", "crates/bevy_reflect_compile_fail_tests"]
members = [
"crates/*",
"examples/android",
"examples/ios",
"examples/mobile",
"tools/ci",
"tools/build-example-pages",
"tools/build-wasm-example",
Expand All @@ -44,6 +43,7 @@ default = [
"vorbis",
"x11",
"filesystem_watcher",
"android_shared_stdcxx"
]

# Force dynamic linking, which improves iterative compile times
Expand Down Expand Up @@ -118,6 +118,13 @@ debug_asset_server = ["bevy_internal/debug_asset_server"]
# Enable animation support, and glTF animation loading
animation = ["bevy_internal/animation"]

# Enable using a shared stdlib for cxx on Android.
android_shared_stdcxx = ["bevy_internal/android_shared_stdcxx"]

# Enable detailed trace event logging.
# These trace events are expensive even when off, thus they require compile time opt-in.
detailed_trace = ["bevy_internal/detailed_trace"]

[dependencies]
bevy_dylib = { path = "crates/bevy_dylib", version = "0.9.0", default-features = false, optional = true }
bevy_internal = { path = "crates/bevy_internal", version = "0.9.0", default-features = false }
Expand Down Expand Up @@ -419,6 +426,7 @@ wasm = true
[[example]]
name = "pbr"
path = "examples/3d/pbr.rs"
required-features = ["ktx2", "zstd"]

[package.metadata.example.pbr]
name = "Physically Based Rendering"
Expand Down Expand Up @@ -920,7 +928,7 @@ path = "examples/ecs/removal_detection.rs"

[package.metadata.example.removal_detection]
name = "Removal Detection"
description = "Query for entities that had a specific component removed in a previous stage during the current frame"
description = "Query for entities that had a specific component removed earlier in the current frame"
category = "ECS (Entity Component System)"
wasm = false

Expand Down Expand Up @@ -974,16 +982,6 @@ description = "Illustrates creating custom system parameters with `SystemParam`"
category = "ECS (Entity Component System)"
wasm = false

[[example]]
name = "system_sets"
path = "examples/ecs/system_sets.rs"

[package.metadata.example.system_sets]
name = "System Sets"
description = "Shows `SystemSet` use along with run criterion"
category = "ECS (Entity Component System)"
wasm = false

[[example]]
name = "timers"
path = "examples/ecs/timers.rs"
Expand Down
6 changes: 6 additions & 0 deletions assets/environment_maps/info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The pisa_*.ktx2 files were generated from https://github.com/KhronosGroup/glTF-Sample-Environments/blob/master/pisa.hdr using the following tools and commands:
- IBL environment map prefiltering to cubemaps: https://github.com/KhronosGroup/glTF-IBL-Sampler
- Diffuse: ./cli -inputPath pisa.hdr -outCubeMap pisa_diffuse.ktx2 -distribution Lambertian -cubeMapResolution 32
- Specular: ./cli -inputPath pisa.hdr -outCubeMap pisa_specular.ktx2 -distribution GGX -cubeMapResolution 512
- Converting to rgb9e5 format with zstd 'supercompression': https://github.com/DGriffin91/bevy_mod_environment_map_tools
- cargo run --release -- --inputs pisa_diffuse.ktx2,pisa_specular.ktx2 --outputs pisa_diffuse_rgb9e5_zstd.ktx2,pisa_specular_rgb9e5_zstd.ktx2
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions assets/shaders/array_texture.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import bevy_pbr::shadows
#import bevy_pbr::fog
#import bevy_pbr::pbr_functions
#import bevy_pbr::pbr_ambient

@group(1) @binding(0)
var my_array_texture: texture_2d_array<f32>;
Expand Down
28 changes: 12 additions & 16 deletions benches/benches/bevy_ecs/components/archetype_updates.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
use bevy_ecs::{
component::Component,
schedule::{Stage, SystemStage},
world::World,
};
use bevy_ecs::{component::Component, schedule::Schedule, world::World};
use criterion::{BenchmarkId, Criterion};

#[derive(Component)]
struct A<const N: u16>(f32);

fn setup(system_count: usize) -> (World, SystemStage) {
fn setup(system_count: usize) -> (World, Schedule) {
let mut world = World::new();
fn empty() {}
let mut stage = SystemStage::parallel();
let mut schedule = Schedule::new();
for _ in 0..system_count {
stage.add_system(empty);
schedule.add_system(empty);
}
stage.run(&mut world);
(world, stage)
schedule.run(&mut world);
(world, schedule)
}

/// create `count` entities with distinct archetypes
Expand Down Expand Up @@ -78,13 +74,13 @@ pub fn no_archetypes(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("no_archetypes");
for i in 0..=5 {
let system_count = i * 20;
let (mut world, mut stage) = setup(system_count);
let (mut world, mut schedule) = setup(system_count);
group.bench_with_input(
BenchmarkId::new("system_count", system_count),
&system_count,
|bencher, &_system_count| {
bencher.iter(|| {
stage.run(&mut world);
schedule.run(&mut world);
});
},
);
Expand All @@ -101,12 +97,12 @@ pub fn added_archetypes(criterion: &mut Criterion) {
|bencher, &archetype_count| {
bencher.iter_batched(
|| {
let (mut world, stage) = setup(SYSTEM_COUNT);
let (mut world, schedule) = setup(SYSTEM_COUNT);
add_archetypes(&mut world, archetype_count);
(world, stage)
(world, schedule)
},
|(mut world, mut stage)| {
stage.run(&mut world);
|(mut world, mut schedule)| {
schedule.run(&mut world);
},
criterion::BatchSize::LargeInput,
);
Expand Down
Loading

0 comments on commit 9ce4f42

Please sign in to comment.