Skip to content

Commit

Permalink
remove .system from pipelined code (bevyengine#2538)
Browse files Browse the repository at this point in the history
Now that we have main features, lets use them!
  • Loading branch information
cart committed Jul 26, 2021
1 parent 955c79f commit 2e99d84
Show file tree
Hide file tree
Showing 32 changed files with 94 additions and 155 deletions.
5 changes: 3 additions & 2 deletions .github/bors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ status = [
"build (stable, ubuntu-latest)",
"build (stable, macos-latest)",
"build (nightly, ubuntu-latest)",
"build-wasm (stable, ubuntu-latest)",
"build-wasm (nightly, ubuntu-latest)",
# TODO: re-enable after wasm works on pipelined-rendering
# "build-wasm (stable, ubuntu-latest)",
# "build-wasm (nightly, ubuntu-latest)",
"markdownlint",
"check-markdown-links",
"run-examples",
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ jobs:
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"

build-wasm:
strategy:
matrix:
toolchain: [stable, nightly]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: wasm32-unknown-unknown
override: true

- name: Check wasm
uses: actions-rs/cargo@v1
with:
command: check
args: --target wasm32-unknown-unknown --no-default-features --features bevy_winit,x11,hdr,bevy_gltf
# NOTE: temporarily disabled while we sort out pipelined-rendering support
# build-wasm:
# strategy:
# matrix:
# toolchain: [stable, nightly]
# os: [ubuntu-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v2

# - uses: actions-rs/toolchain@v1
# with:
# toolchain: ${{ matrix.toolchain }}
# target: wasm32-unknown-unknown
# override: true

# - name: Check wasm
# uses: actions-rs/cargo@v1
# with:
# command: check
# args: --target wasm32-unknown-unknown --no-default-features --features bevy_winit,x11,hdr,bevy_gltf

build-android:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ impl App {
/// #
/// # struct MyOwnPlugin;
/// # impl Plugin for MyOwnPlugin {
/// # fn build(&self, app: &mut AppBuilder){;}
/// # fn build(&self, app: &mut App) { }
/// # }
/// #
/// App::new()
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/exclusive_system.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
archetype::ArchetypeGeneration,
system::{check_system_change_tick, BoxedSystem, IntoSystem, System, SystemId},
system::{check_system_change_tick, BoxedSystem, IntoSystem, SystemId},
world::World,
};
use std::borrow::Cow;
Expand Down
8 changes: 6 additions & 2 deletions crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ use std::{
///
/// ```
/// # use bevy_ecs::prelude::*;
/// # use std::marker::PhantomData;
/// use bevy_ecs::system::SystemParam;
///
/// #[derive(SystemParam)]
/// struct MyParam<'a> {
/// foo: Res<'a, usize>,
/// struct MyParam<'s, 'w> {
/// foo: Res<'w, usize>,
/// // TODO: this isn't ideal ... maybe the SystemParam derive can be smarter about world and state lifetimes?
/// #[system_param(ignore)]
/// marker: PhantomData<&'s usize>,
/// }
///
/// fn my_system(param: MyParam) {
Expand Down
39 changes: 0 additions & 39 deletions crates/crevice/CHANGELOG.md

This file was deleted.

3 changes: 0 additions & 3 deletions crates/crevice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,4 @@ mint = "0.5.5"
glam = "0.15.1"

[dev-dependencies]
cgmath = { version = "0.17.0", features = ["mint"] }
insta = "0.16.1"
type-layout = { version = "0.2.0", features = ["serde1"] }
crevice-derive = { version = "0.6.0", path = "crevice-derive" }
9 changes: 5 additions & 4 deletions crates/crevice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Examples in this crate use cgmath, but any math crate that works with the mint
crate will also work. Some other crates include nalgebra, ultraviolet, glam, and
vek.

### Examples
## Examples

#### Single Value
### Single Value

Uploading many types can be done by deriving `AsStd140` and using
[`as_std140`][std140::AsStd140::as_std140] and
Expand Down Expand Up @@ -126,10 +126,11 @@ Crevice supports Rust 1.46.0 and newer due to use of new `const fn` features.

Licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0))
* MIT license ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
5 changes: 0 additions & 5 deletions crates/crevice/crevice-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ homepage = "https://github.com/LPGhatguy/crevice"
repository = "https://github.com/LPGhatguy/crevice"
license = "MIT OR Apache-2.0"

[features]
# Feature used for testing; enables type_layout derive on types.
# Requires crate using derive to depend on type_layout as well.
test_type_layout = []

[lib]
proc-macro = true

Expand Down
5 changes: 0 additions & 5 deletions crates/crevice/crevice-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,6 @@ impl EmitOptions {
},
);

// For testing purposes, we can optionally generate type layout
// information using the type-layout crate.
let type_layout_derive = quote!();

quote! {
#[allow(non_snake_case)]
mod #alignment_mod_name {
Expand All @@ -257,7 +253,6 @@ impl EmitOptions {
}

#[derive(Debug, Clone, Copy)]
#type_layout_derive
#[repr(C)]
#visibility struct #generated_name #ty_generics #where_clause {
#( #generated_fields )*
Expand Down
4 changes: 2 additions & 2 deletions crates/crevice/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ uniform MAIN {
} main;
```
```rust
```skip
use crevice::std140::{AsStd140, Std140};
use cgmath::prelude::*;
use cgmath::{Matrix3, Vector3};
Expand Down Expand Up @@ -76,7 +76,7 @@ buffer POINT_LIGHTS {
} point_lights;
```
```rust
```skip
use crevice::std140::{self, AsStd140};
#[derive(AsStd140)]
Expand Down
2 changes: 1 addition & 1 deletion crates/crevice/src/std140/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ uniform CAMERA {
} camera;
```
```
```skip
use cgmath::prelude::*;
use cgmath::{Matrix4, Deg, perspective};
use crevice::std140::{AsStd140, Std140};
Expand Down
6 changes: 3 additions & 3 deletions examples/3d/3d_scene_pipelined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ fn main() {
.add_plugins(PipelinedDefaultPlugins)
.add_plugin(FrameTimeDiagnosticsPlugin::default())
.add_plugin(LogDiagnosticsPlugin::default())
.add_startup_system(setup.system())
.add_system(movement.system())
.add_system(animate_light_direction.system())
.add_startup_system(setup)
.add_system(movement)
.add_system(animate_light_direction)
.run();
}

Expand Down
2 changes: 1 addition & 1 deletion examples/3d/cornell_box_pipelined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn main() {
.add_plugins(PipelinedDefaultPlugins)
.add_plugin(FrameTimeDiagnosticsPlugin::default())
.add_plugin(LogDiagnosticsPlugin::default())
.add_startup_system(setup.system())
.add_startup_system(setup)
.run();
}

Expand Down
12 changes: 6 additions & 6 deletions examples/3d/shadow_biases_pipelined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ fn main() {
);
App::new()
.add_plugins(PipelinedDefaultPlugins)
.add_startup_system(setup.system())
.add_system(adjust_point_light_biases.system())
.add_system(toggle_light.system())
.add_system(adjust_directional_light_biases.system())
.add_system(camera_controller.system())
.add_startup_system(setup)
.add_system(adjust_point_light_biases)
.add_system(toggle_light)
.add_system(adjust_directional_light_biases)
.add_system(camera_controller)
.run();
}

Expand Down Expand Up @@ -119,7 +119,7 @@ fn setup(
mesh: meshes.add(Mesh::from(shape::Plane {
size: 2.0 * spawn_plane_depth,
})),
material: white_handle.clone(),
material: white_handle,
..Default::default()
});
}
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/texture_pipelined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bevy::{
fn main() {
App::new()
.add_plugins(PipelinedDefaultPlugins)
.add_startup_system(setup.system())
.add_startup_system(setup)
.run();
}

Expand Down
6 changes: 6 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,19 @@ Example | File | Description
Example | File | Description
--- | --- | ---
`3d_scene` | [`3d/3d_scene.rs`](./3d/3d_scene.rs) | Simple 3D scene with basic shapes and lighting
`3d_scene_pipelined` | [`3d/3d_scene_pipelined.rs`](./3d/3d_scene_pipelined.rs) | Simple 3D scene with basic shapes and lighting
`cornell_box_pipelined` | [`3d/cornell_box_pipelined.rs`](./3d/cornell_box_pipelined.rs) | Re-production of the cornell box
`load_gltf` | [`3d/load_gltf.rs`](./3d/load_gltf.rs) | Loads and renders a gltf file as a scene
`msaa` | [`3d/msaa.rs`](./3d/msaa.rs) | Configures MSAA (Multi-Sample Anti-Aliasing) for smoother edges
`orthographic` | [`3d/orthographic.rs`](./3d/orthographic.rs) | Shows how to create a 3D orthographic view (for isometric-look games or CAD applications)
`parenting` | [`3d/parenting.rs`](./3d/parenting.rs) | Demonstrates parent->child relationships and relative transformations
`pbr` | [`3d/pbr.rs`](./3d/pbr.rs) | Demonstrates use of Physically Based Rendering (PBR) properties
`pbr_pipelined` | [`3d/pbr_pipelined.rs`](./3d/pbr_pipelined.rs) | Demonstrates use of Physically Based Rendering (PBR) properties
`render_to_texture` | [`3d/render_to_texture.rs`](./3d/render_to_texture.rs) | Shows how to render to texture
`shadow_biases_pipelined` | [`3d/shadow_biases_pipelined.rs`](./3d/shadow_biases_pipelined.rs) | Demonstrates how shadow biases affect shadows in a 3d scene
`spawner` | [`3d/spawner.rs`](./3d/spawner.rs) | Renders a large number of cubes with changing position and material
`texture` | [`3d/texture.rs`](./3d/texture.rs) | Shows configuration of texture materials
`texture_pipelined` | [`3d/texture_pipelined.rs`](./3d/texture_pipelined.rs) | Shows configuration of texture materials
`update_gltf_scene` | [`3d/update_gltf_scene.rs`](./3d/update_gltf_scene.rs) | Update a scene from a gltf file, either by spawning the scene as a child of another entity, or by accessing the entities of the scene
`wireframe` | [`3d/wireframe.rs`](./3d/wireframe.rs) | Showcases wireframe rendering
`z_sort_debug` | [`3d/z_sort_debug.rs`](./3d/z_sort_debug.rs) | Visualizes camera Z-ordering
Expand Down Expand Up @@ -230,6 +235,7 @@ Example | File | Description
Example | File | Description
--- | --- | ---
`bevymark` | [`tools/bevymark.rs`](./tools/bevymark.rs) | A heavy workload to benchmark your system with Bevy
`bevymark_pipelined` | [`tools/bevymark_pipelined.rs`](./tools/bevymark_pipelined.rs) | A heavy workload to benchmark your system with Bevy

## UI (User Interface)

Expand Down
10 changes: 5 additions & 5 deletions examples/tools/bevymark_pipelined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ fn main() {
// .add_plugin(WgpuResourceDiagnosticsPlugin::default())
.insert_resource(BevyCounter { count: 0 })
// .init_resource::<BirdMaterial>()
.add_startup_system(setup.system())
.add_system(mouse_handler.system())
.add_system(movement_system.system())
.add_system(collision_system.system())
.add_system(counter_system.system())
.add_startup_system(setup)
.add_system(mouse_handler)
.add_system(movement_system)
.add_system(collision_system)
.add_system(counter_system)
.run();
}

Expand Down
2 changes: 1 addition & 1 deletion pipelined/bevy_pbr2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ bevy_utils = { path = "../../crates/bevy_utils", version = "0.5.0" }
bitflags = "1.2"
# direct dependency required for derive macro
bytemuck = { version = "1", features = ["derive"] }
crevice = { path = "../../crates/crevice" }
crevice = { path = "../../crates/crevice", version = "0.6.0" }
wgpu = "0.9"
13 changes: 5 additions & 8 deletions pipelined/bevy_pbr2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,17 @@ impl Plugin for PbrPlugin {

let render_app = app.sub_app_mut(0);
render_app
.add_system_to_stage(RenderStage::Extract, render::extract_meshes.system())
.add_system_to_stage(RenderStage::Extract, render::extract_lights.system())
.add_system_to_stage(RenderStage::Prepare, render::prepare_meshes.system())
.add_system_to_stage(RenderStage::Extract, render::extract_meshes)
.add_system_to_stage(RenderStage::Extract, render::extract_lights)
.add_system_to_stage(RenderStage::Prepare, render::prepare_meshes)
.add_system_to_stage(
RenderStage::Prepare,
// this is added as an exclusive system because it contributes new views. it must run (and have Commands applied)
// _before_ the `prepare_views()` system is run. ideally this becomes a normal system when "stageless" features come out
render::prepare_lights.exclusive_system(),
)
.add_system_to_stage(RenderStage::Queue, render::queue_meshes.system())
.add_system_to_stage(
RenderStage::PhaseSort,
sort_phase_system::<ShadowPhase>.system(),
)
.add_system_to_stage(RenderStage::Queue, render::queue_meshes)
.add_system_to_stage(RenderStage::PhaseSort, sort_phase_system::<ShadowPhase>)
// FIXME: Hack to ensure RenderCommandQueue is initialized when PbrShaders is being initialized
// .init_resource::<RenderCommandQueue>()
.init_resource::<PbrShaders>()
Expand Down
6 changes: 3 additions & 3 deletions pipelined/bevy_render2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ image = { version = "0.23.12", default-features = false }

# misc
wgpu = "0.9"
naga = { git = "https://github.com/gfx-rs/naga", rev = "0cf5484bba530f1134badbd2a1c1a8e9daf2e9c3", features = ["glsl-in", "spv-in", "spv-out", "wgsl-in", "wgsl-out"] }
naga = { version = "0.5", features = ["glsl-in", "spv-in", "spv-out", "wgsl-in", "wgsl-out"] }
serde = { version = "1", features = ["derive"] }
bitflags = "1.2.1"
smallvec = { version = "1.6", features = ["union", "const_generics"] }
Expand All @@ -40,9 +40,9 @@ thiserror = "1.0"
futures-lite = "1.4.0"
anyhow = "1.0"
hex = "0.4.2"
hexasphere = "3.4"
hexasphere = "4.0"
parking_lot = "0.11.0"
crevice = { path = "../../crates/crevice" }
crevice = { path = "../../crates/crevice", version = "0.6.0" }

[features]
png = ["image/png"]
Expand Down
Loading

0 comments on commit 2e99d84

Please sign in to comment.