Rebuild core around render graph AST and shared memory

Amp-Thread-ID: https://ampcode.com/threads/T-01a01380-b478-77d0-84a0-102880a5c5ae
Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-08-18 11:58:31 +00:00
co-authored by heaust
parent a23ef37b4d
commit 0e44917f9e
101 changed files with 4409 additions and 2610 deletions
+1 -24
View File
@@ -8,6 +8,7 @@ pub mod render_data;
pub mod render_graph;
pub mod renderer;
pub mod shared_snapshot;
pub mod shared_soa;
#[cfg(target_arch = "wasm32")]
thread_local! { static PAYLOADS: std::cell::RefCell<std::collections::HashMap<u32, Vec<u8>>> = Default::default(); }
@@ -43,27 +44,3 @@ pub(crate) fn take_payload(id: u32) -> Option<Vec<u8>> {
pub(crate) fn take_payload(_id: u32) -> Option<Vec<u8>> {
None
}
/// Worker entrypoint helper - executes the closure it is spawned with
/// Applications should export this with #[wasm_bindgen]
pub fn worker_entrypoint_impl(ptr: u32) {
let work = unsafe { Box::from_raw(ptr as *mut Box<dyn FnOnce()>) };
(*work)();
}
/// Macro to export the worker_entrypoint function in application crates
///
/// Usage:
/// ```rust
/// use renderer::export_worker_entrypoint;
/// export_worker_entrypoint!();
/// ```
#[macro_export]
macro_rules! export_worker_entrypoint {
() => {
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn worker_entrypoint(ptr: u32) {
$crate::worker_entrypoint_impl(ptr);
}
};
}