Skip to content

Commit

Permalink
Merge branch 'pipelined-rendering' into directional-light-and-shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
superdump committed Jul 2, 2021
2 parents 7ed3832 + 9a79b79 commit bbb9a81
Show file tree
Hide file tree
Showing 39 changed files with 1,876 additions and 2,004 deletions.
12 changes: 5 additions & 7 deletions crates/bevy_app/src/ci_testing.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use serde::Deserialize;

use crate::{app::AppExit, AppBuilder};
use crate::app::{App, AppExit};
use bevy_ecs::system::IntoSystem;
use serde::Deserialize;

/// Configuration for automated testing on CI
#[derive(Deserialize)]
Expand All @@ -23,16 +22,15 @@ fn ci_testing_exit_after(
*current_frame += 1;
}

pub(crate) fn setup_app(app_builder: &mut AppBuilder) -> &mut AppBuilder {
pub(crate) fn setup_app(app: &mut App) -> &mut App {
let filename =
std::env::var("CI_TESTING_CONFIG").unwrap_or_else(|_| "ci_testing_config.ron".to_string());
let config: CiTestingConfig = ron::from_str(
&std::fs::read_to_string(filename).expect("error reading CI testing configuration file"),
)
.expect("error deserializing CI testing configuration file");
app_builder
.insert_resource(config)
app.insert_resource(config)
.add_system(ci_testing_exit_after.system());

app_builder
app
}
34 changes: 17 additions & 17 deletions crates/bevy_core/src/time/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,37 +375,37 @@ mod tests {
t.tick(Duration::from_secs_f32(0.25));
assert_eq!(t.elapsed_secs(), 0.25);
assert_eq!(t.duration(), Duration::from_secs_f32(10.0));
assert_eq!(t.finished(), false);
assert_eq!(t.just_finished(), false);
assert!(!t.finished());
assert!(!t.just_finished());
assert_eq!(t.times_finished(), 0);
assert_eq!(t.repeating(), false);
assert!(!t.repeating());
assert_eq!(t.percent(), 0.025);
assert_eq!(t.percent_left(), 0.975);
// Ticking while paused changes nothing
t.pause();
t.tick(Duration::from_secs_f32(500.0));
assert_eq!(t.elapsed_secs(), 0.25);
assert_eq!(t.duration(), Duration::from_secs_f32(10.0));
assert_eq!(t.finished(), false);
assert_eq!(t.just_finished(), false);
assert!(!t.finished());
assert!(!t.just_finished());
assert_eq!(t.times_finished(), 0);
assert_eq!(t.repeating(), false);
assert!(!t.repeating());
assert_eq!(t.percent(), 0.025);
assert_eq!(t.percent_left(), 0.975);
// Tick past the end and make sure elapsed doesn't go past 0.0 and other things update
t.unpause();
t.tick(Duration::from_secs_f32(500.0));
assert_eq!(t.elapsed_secs(), 10.0);
assert_eq!(t.finished(), true);
assert_eq!(t.just_finished(), true);
assert!(t.finished());
assert!(t.just_finished());
assert_eq!(t.times_finished(), 1);
assert_eq!(t.percent(), 1.0);
assert_eq!(t.percent_left(), 0.0);
// Continuing to tick when finished should only change just_finished
t.tick(Duration::from_secs_f32(1.0));
assert_eq!(t.elapsed_secs(), 10.0);
assert_eq!(t.finished(), true);
assert_eq!(t.just_finished(), false);
assert!(t.finished());
assert!(!t.just_finished());
assert_eq!(t.times_finished(), 0);
assert_eq!(t.percent(), 1.0);
assert_eq!(t.percent_left(), 0.0);
Expand All @@ -418,25 +418,25 @@ mod tests {
t.tick(Duration::from_secs_f32(0.75));
assert_eq!(t.elapsed_secs(), 0.75);
assert_eq!(t.duration(), Duration::from_secs_f32(2.0));
assert_eq!(t.finished(), false);
assert_eq!(t.just_finished(), false);
assert!(!t.finished());
assert!(!t.just_finished());
assert_eq!(t.times_finished(), 0);
assert_eq!(t.repeating(), true);
assert!(t.repeating());
assert_eq!(t.percent(), 0.375);
assert_eq!(t.percent_left(), 0.625);
// Tick past the end and make sure elapsed wraps
t.tick(Duration::from_secs_f32(1.5));
assert_eq!(t.elapsed_secs(), 0.25);
assert_eq!(t.finished(), true);
assert_eq!(t.just_finished(), true);
assert!(t.finished());
assert!(t.just_finished());
assert_eq!(t.times_finished(), 1);
assert_eq!(t.percent(), 0.125);
assert_eq!(t.percent_left(), 0.875);
// Continuing to tick should turn off both finished & just_finished for repeating timers
t.tick(Duration::from_secs_f32(1.0));
assert_eq!(t.elapsed_secs(), 1.25);
assert_eq!(t.finished(), false);
assert_eq!(t.just_finished(), false);
assert!(!t.finished());
assert!(!t.just_finished());
assert_eq!(t.times_finished(), 0);
assert_eq!(t.percent(), 0.625);
assert_eq!(t.percent_left(), 0.375);
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_dylib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::single_component_path_imports)]

//! Forces dynamic linking of Bevy.
//!
//! Dynamically linking Bevy makes the "link" step much faster. This can be achieved by adding
Expand All @@ -8,5 +10,4 @@

// Force linking of the main bevy crate
#[allow(unused_imports)]
#[allow(clippy::single_component_path_imports)]
use bevy_internal;
5 changes: 5 additions & 0 deletions crates/bevy_ecs/src/entity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ impl Entities {

/// Allocates space for entities previously reserved with `reserve_entity` or
/// `reserve_entities`, then initializes each one using the supplied function.
///
/// # Safety
/// Flush _must_ set the entity location to the correct ArchetypeId for the given Entity
/// each time init is called. This _can_ be ArchetypeId::invalid(), provided the Entity has
/// not been assigned to an Archetype.
pub unsafe fn flush(&mut self, mut init: impl FnMut(Entity, &mut EntityLocation)) {
let free_cursor = self.free_cursor.get_mut();
let current_free_cursor = *free_cursor;
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_ecs/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ mod tests {
run_system(&mut world, sys.system());

// ensure the system actually ran
assert_eq!(*world.get_resource::<bool>().unwrap(), true);
assert!(*world.get_resource::<bool>().unwrap());
}

#[test]
Expand Down Expand Up @@ -353,7 +353,7 @@ mod tests {
}

run_system(&mut world, validate_removed.system());
assert_eq!(*world.get_resource::<bool>().unwrap(), true, "system ran");
assert!(*world.get_resource::<bool>().unwrap(), "system ran");
}

#[test]
Expand All @@ -371,7 +371,7 @@ mod tests {
);

// ensure the system actually ran
assert_eq!(*world.get_resource::<bool>().unwrap(), true);
assert!(*world.get_resource::<bool>().unwrap());
}
#[test]
fn world_collections_system() {
Expand Down Expand Up @@ -414,7 +414,7 @@ mod tests {
run_system(&mut world, sys.system());

// ensure the system actually ran
assert_eq!(*world.get_resource::<bool>().unwrap(), true);
assert!(*world.get_resource::<bool>().unwrap());
}

#[test]
Expand Down
10 changes: 4 additions & 6 deletions crates/bevy_render/src/camera/visible_entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,12 @@ mod rendering_mask_tests {
"default masks match each other"
);

assert_eq!(
RenderLayers::layer(0).intersects(&RenderLayers::layer(1)),
false,
assert!(
!RenderLayers::layer(0).intersects(&RenderLayers::layer(1)),
"masks with differing layers do not match"
);
assert_eq!(
RenderLayers(0).intersects(&RenderLayers(0)),
false,
assert!(
!RenderLayers(0).intersects(&RenderLayers(0)),
"empty masks don't match"
);
assert_eq!(
Expand Down
5 changes: 1 addition & 4 deletions crates/bevy_tasks/src/countdown_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ mod tests {
let listener3 = event.listen();

// Verify that we are still blocked
assert_eq!(
false,
listener2.wait_timeout(instant::Duration::from_millis(10))
);
assert!(!listener2.wait_timeout(instant::Duration::from_millis(10)));

// Notify all and verify the remaining listener is notified
event.notify(std::usize::MAX);
Expand Down
5 changes: 2 additions & 3 deletions crates/bevy_transform/src/hierarchy/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ mod tests {

{
let children = world.get::<Children>(grandparent_entity).unwrap();
assert_eq!(
children.iter().any(|&i| i == parent_entity),
false,
assert!(
!children.iter().any(|&i| i == parent_entity),
"grandparent should no longer know about its child which has been removed"
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bevy_winit = { path = "../bevy_winit", optional = true, version = "0.5.0" }
bevy_utils = { path = "../bevy_utils", version = "0.5.0" }

# other
wgpu = "0.8"
wgpu = "0.9"
futures-lite = "1.4.0"
crossbeam-channel = "0.5.0"
crossbeam-utils = "0.8.1"
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_window/src/raw_window_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl RawWindowHandleWrapper {
/// have constraints on where/how this handle can be used. For example, some platforms don't support doing window
/// operations off of the main thread. The caller must ensure the [`RawWindowHandle`] is only used in valid contexts.
pub unsafe fn get_handle(&self) -> HasRawWindowHandleWrapper {
HasRawWindowHandleWrapper(self.0.clone())
HasRawWindowHandleWrapper(self.0)
}
}

Expand All @@ -32,6 +32,6 @@ pub struct HasRawWindowHandleWrapper(RawWindowHandle);
// SAFE: the caller has validated that this is a valid context to get RawWindowHandle
unsafe impl HasRawWindowHandle for HasRawWindowHandleWrapper {
fn raw_window_handle(&self) -> RawWindowHandle {
self.0.clone()
self.0
}
}
6 changes: 1 addition & 5 deletions crates/crevice/crevice-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,7 @@ impl EmitOptions {

// For testing purposes, we can optionally generate type layout
// information using the type-layout crate.
let type_layout_derive = if cfg!(feature = "test_type_layout") {
quote!(#[derive(::type_layout::TypeLayout)])
} else {
quote!()
};
let type_layout_derive = quote!();

quote! {
#[allow(non_snake_case)]
Expand Down
2 changes: 2 additions & 0 deletions crates/crevice/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::all)]

/*!
[![GitHub CI Status](https://github.com/LPGhatguy/crevice/workflows/CI/badge.svg)](https://github.com/LPGhatguy/crevice/actions)
[![crevice on crates.io](https://img.shields.io/crates/v/crevice.svg)](https://crates.io/crates/crevice)
Expand Down
2 changes: 1 addition & 1 deletion examples/2d/sprite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {

fn setup(
mut commands: Commands,
asset_server: Res<AssetServer>,
_asset_server: Res<AssetServer>,
// mut materials: ResMut<Assets<ColorMaterial>>,
) {
// let texture_handle = asset_server.load("branding/icon.png");
Expand Down
Loading

0 comments on commit bbb9a81

Please sign in to comment.