From 0ccbec9e1bf41da3449e5d9e64a3dc3c567b8d61 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 1 Aug 2024 14:02:38 -0500 Subject: [PATCH] Seemingly incremental builds --- Cargo.lock | 29 +++++++++++++++++++++++++++++ Cargo.toml | 1 + flake.nix | 35 +++-------------------------------- src/main.rs | 2 ++ 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 079d6ec..2d02563 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -523,6 +523,25 @@ dependencies = [ "encase_derive_impl", ] +[[package]] +name = "bevy_framepace" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa5f7d858e66d0f4c4fe3e1a678da440037ce383c4c51bff3c1fa06a121ebc0" +dependencies = [ + "bevy_app", + "bevy_diagnostic", + "bevy_ecs", + "bevy_log", + "bevy_reflect", + "bevy_render", + "bevy_time", + "bevy_utils", + "bevy_window", + "bevy_winit", + "spin_sleep", +] + [[package]] name = "bevy_gizmos" version = "0.14.0" @@ -2014,6 +2033,7 @@ name = "kodotag-rs" version = "0.1.0" dependencies = [ "bevy", + "bevy_framepace", ] [[package]] @@ -3083,6 +3103,15 @@ dependencies = [ "serde", ] +[[package]] +name = "spin_sleep" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368a978649eaf70006b082e79c832bd72556ac1393eaf564d686e919dca2347f" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "spirv" version = "0.3.0+sdk-1.3.268.0" diff --git a/Cargo.toml b/Cargo.toml index 6f0bb25..0cc5737 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ bevy = { version = "0.14.0", default-features = false, features = [ # "bevy_dev_tools", # possibly-useful development tools # "detailed_trace", # probably useful troubleshooting information during runtime ] } +bevy_framepace = "0.17.1" [profile.dev] opt-level = 1 diff --git a/flake.nix b/flake.nix index 1ffca33..6edd8f6 100644 --- a/flake.nix +++ b/flake.nix @@ -65,16 +65,10 @@ }; }; build = outputs.packages.${pkgs.system}.default; - build-no-crane = outputs.packages.${pkgs.system}.kodotag-no-crane; }); packages = genPkgs (pkgs: let - rustToolchainFor = p: - p.rust-bin.selectLatestNightlyWith (toolchain: - toolchain.default.override { - extensions = ["rust-src"]; - targets = ["x86_64-unknown-linux-gnu"]; - }); + rustToolchainFor = p: p.rust-bin.stable.latest.default; rustToolchain = rustToolchainFor pkgs; craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchainFor; @@ -92,10 +86,6 @@ }; in { kodotag = craneLib.buildPackage { - # TODO: incremental rust builds with nix would be awesome - pname = "kodotag"; - version = "0.1.0"; - inherit src; strictDeps = true; cargoVendorDir = craneLib.vendorMultipleCargoDeps { @@ -118,9 +108,7 @@ nativeBuildInputs = buildTimeDeps pkgs; buildInputs = linkTimeDeps pkgs; - hash = pkgs.lib.fakeHash; - # cargoHash = ""; - cargoHash = "sha256-d7luBIWHWn2ZpmSnIgpuLXsy1URUIojpPFboMtqa2ps="; + # hash = pkgs.lib.fakeHash; # a hack to avoid using mold as our linker when building with nix postUnpack = '' @@ -129,24 +117,7 @@ ''; }; - kodotag-no-crane = pkgs.rustPlatform.buildRustPackage { - pname = "kodotag"; - version = "0.1.0"; - nativeBuildInputs = buildTimeDeps pkgs; - buildInputs = linkTimeDeps pkgs; - src = ./.; - hash = pkgs.lib.fakeHash; - # cargoHash = ""; - cargoHash = "sha256-d7luBIWHWn2ZpmSnIgpuLXsy1URUIojpPFboMtqa2ps="; - - # a hack to avoid using mold as our linker when building with nix - postUnpack = '' - ls -la - rm -r ./*/.cargo - ''; - }; - - default = outputs.packages.${pkgs.system}.kodotag-no-crane; + default = outputs.packages.${pkgs.system}.kodotag; }); devShells = genPkgs (pkgs: { diff --git a/src/main.rs b/src/main.rs index 8283aec..93287d4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -58,6 +58,7 @@ fn main() -> AppExit { }) .set(ImagePlugin::default_nearest()), FrameTimeDiagnosticsPlugin, + // bevy_framepace::FramepacePlugin, )); load_internal_binary_asset!( @@ -105,6 +106,7 @@ fn main() -> AppExit { .after(player::control) .after(movement::resolve_velocity), ) + .after(input::process_input) .in_set(InGameSet), (main_menu::update).in_set(MainMenuSet), ),