From 8deda87a214ea7e3d71d35fbd46b594af895f601 Mon Sep 17 00:00:00 2001 From: Aevyrie Date: Sun, 30 Jun 2024 15:37:54 -0700 Subject: [PATCH] Fix framepace not working --- Cargo.toml | 33 +++++++++++---------------------- src/lib.rs | 39 +++++++++++---------------------------- 2 files changed, 22 insertions(+), 50 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ed9e596..323f351 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,16 +11,16 @@ documentation = "https://docs.rs/bevy_framepace" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = "0.14.0-rc.2" -bevy_ecs = "0.14.0-rc.2" -bevy_diagnostic = "0.14.0-rc.2" -bevy_log = "0.14.0-rc.2" -bevy_render = "0.14.0-rc.2" -bevy_reflect = "0.14.0-rc.2" -bevy_time = "0.14.0-rc.2" -bevy_utils = "0.14.0-rc.2" -bevy_window = "0.14.0-rc.2" -bevy_winit = "0.14.0-rc.2" +bevy_app = "0.14.0-rc.4" +bevy_ecs = "0.14.0-rc.4" +bevy_diagnostic = "0.14.0-rc.4" +bevy_log = "0.14.0-rc.4" +bevy_render = "0.14.0-rc.4" +bevy_reflect = "0.14.0-rc.4" +bevy_time = "0.14.0-rc.4" +bevy_utils = "0.14.0-rc.4" +bevy_window = "0.14.0-rc.4" +bevy_winit = "0.14.0-rc.4" # Non-bevy spin_sleep = "1.0" @@ -29,18 +29,7 @@ default = ["framepace_debug", "bevy_winit/x11"] framepace_debug = [] [dev-dependencies] -bevy = { version = "0.14.0-rc.2", default-features = false, features = [ - "bevy_gizmos", - "bevy_text", - "bevy_ui", - "default_font", - "multi_threaded", - "x11", - # The following should not be needed: https://github.com/bevyengine/bevy/issues/13571 - "ktx2", - "zstd", - "bevy_pbr", -] } +bevy = "0.14.0-rc.4" [[example]] name = "demo" diff --git a/src/lib.rs b/src/lib.rs index ff75ce3..52a8bee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,8 +33,6 @@ use bevy_reflect::prelude::*; use bevy_render::{Render, RenderApp, RenderSet}; use bevy_utils::Instant; -#[cfg(not(target_arch = "wasm32"))] -use bevy_render::pipelined_rendering::RenderExtractApp; #[cfg(not(target_arch = "wasm32"))] use bevy_window::prelude::*; #[cfg(not(target_arch = "wasm32"))] @@ -48,12 +46,6 @@ use std::{ #[cfg(feature = "framepace_debug")] pub mod debug; -/// Bevy does not export `RenderExtractApp` on wasm32, so we create a dummy label to ensure this -/// compiles on wasm32. -#[cfg(target_arch = "wasm32")] -#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, bevy_app::AppLabel)] -struct RenderExtractApp; - /// Adds framepacing and framelimiting functionality to your [`App`]. #[derive(Debug, Clone, Component)] pub struct FramepacePlugin; @@ -75,26 +67,17 @@ impl Plugin for FramepacePlugin { #[cfg(not(target_arch = "wasm32"))] app.add_systems(Update, get_display_refresh_rate); - if let Some(sub_app) = app.get_sub_app_mut(RenderExtractApp) { - sub_app - .insert_resource(FrameTimer::default()) - .insert_resource(settings_proxy) - .insert_resource(limit) - .insert_resource(stats) - .add_systems(Main, framerate_limiter); - } else { - app.sub_app_mut(RenderApp) - .insert_resource(FrameTimer::default()) - .insert_resource(settings_proxy) - .insert_resource(limit) - .insert_resource(stats) - .add_systems( - Render, - framerate_limiter - .in_set(RenderSet::Cleanup) - .after(World::clear_entities), - ); - } + app.sub_app_mut(RenderApp) + .insert_resource(FrameTimer::default()) + .insert_resource(settings_proxy) + .insert_resource(limit) + .insert_resource(stats) + .add_systems( + Render, + framerate_limiter + .in_set(RenderSet::Cleanup) + .after(World::clear_entities), + ); } }