Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

The window's draw count is raea-sys-page's DRAWS, read directly: a draws() reading it was a copy of the page host's picking() (the dupes ratchet)

shinyobjectz1ff507df80e2
diff --git a/engine/page/host/src/idle.rs b/engine/page/host/src/idle.rs
index b8599a1b..40f8c5fa 100644
--- a/engine/page/host/src/idle.rs
+++ b/engine/page/host/src/idle.rs
@@ -24,7 +24,7 @@ impl Plugin for IdlePlugin {
fn rest(settings: Option<ResMut<WinitSettings>>, docs: Option<NonSend<raea_sys_page::Docs>>, mut last: Local<u64>, mut quiet: Local<u32>) {
let Some(mut settings) = settings else { return };
- let drawn = raea_sys_page::draws();
+ let drawn = raea_sys_page::DRAWS.load(std::sync::atomic::Ordering::Relaxed);
let moved = drawn != *last || docs.is_some_and(|d| d.0.values().any(|d| d.is_animating()));
*last = drawn;
*quiet = quieter(*quiet, moved);
diff --git a/systems/page/src/draw.rs b/systems/page/src/draw.rs
index 8873e17a..342bdaf2 100644
--- a/systems/page/src/draw.rs
+++ b/systems/page/src/draw.rs
@@ -13,14 +13,10 @@ pub struct Scenes {
pub todo: Vec<Drawn>,
}
-/// Pages drawn so far (each one Vello drew, not one skipped as painted the same): what the window reads to rest (draws).
-static DRAWS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
-
-/// How many pages have been drawn since the process started: unchanged from one frame to the next, nothing on any page
-/// changed (a playing video, a stage or a view draws its page every frame).
-pub fn draws() -> u64 {
- DRAWS.load(std::sync::atomic::Ordering::Relaxed)
-}
+/// How many pages have been drawn since the process started (each one Vello drew, not one skipped as painted the same):
+/// unchanged from one frame to the next, nothing on any page changed (a playing video, a stage or a view draws its page
+/// every frame). What the window reads to rest (raea-page-host's idle.rs).
+pub static DRAWS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
/// The one Vello renderer on Bevy's device (not `Sync`: its shader cache holds cells, so it's held in a SyncCell and the
/// render world can run on a thread of its own, as the engine's pipelined updates run it), made on first use; each page's
diff --git a/systems/page/src/lib.rs b/systems/page/src/lib.rs
index 5e802e85..363e83d2 100644
--- a/systems/page/src/lib.rs
+++ b/systems/page/src/lib.rs
@@ -31,7 +31,7 @@ mod snapshot;
pub use snapshot::{OFFSET_BODY, OFFSET_NONE, OFFSETS, STRIDE, snapshot, snapshot_by};
pub mod view3d;
-pub use draw::{Placed, draws, view, view_at};
+pub use draw::{DRAWS, Placed, view, view_at};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};