diff --git a/pax-chassis-web/Cargo.toml b/pax-chassis-web/Cargo.toml index 2dcd63bda..0ae77e3ad 100644 --- a/pax-chassis-web/Cargo.toml +++ b/pax-chassis-web/Cargo.toml @@ -13,16 +13,16 @@ include = ["/src", "/interface/public"] crate-type = ["cdylib", "rlib"] [features] -default = ["console_error_panic_hook", "gpu"] +default = ["console_error_panic_hook"] designtime = ["dep:pax-designtime", "pax-runtime/designtime"] gpu = [] [dependencies] piet = "0.7.0" piet-web = "0.7.0" -pax-runtime = { path = "../pax-runtime", version="0.38.3" } +pax-pixels = {path = "../pax-pixels", version = "0.38.3"} +pax-runtime = { path = "../pax-runtime", version="0.38.3"} pax-message = {path = "../pax-message", version="0.38.3"} -pax-runtime-api = { path = "../pax-runtime-api", version="0.38.3" } pax-manifest = {path="../pax-manifest", version="0.38.3"} pax-designtime = {path="../pax-designtime", version="0.38.3", optional=true} serde-wasm-bindgen = "0.6" diff --git a/pax-chassis-web/src/lib.rs b/pax-chassis-web/src/lib.rs index a2614d2da..b940b73f9 100644 --- a/pax-chassis-web/src/lib.rs +++ b/pax-chassis-web/src/lib.rs @@ -4,28 +4,19 @@ use js_sys::Uint8Array; use pax_message::ImageLoadInterruptArgs; use pax_message::ScreenshotData; -use pax_pixels::render_backend::RenderBackend; -use pax_pixels::render_backend::RenderConfig; -use pax_pixels::WgpuRenderer; use pax_runtime::api::borrow; +use pax_runtime::api::borrow_mut; use pax_runtime::api::math::Point2; use pax_runtime::api::use_RefCell; use pax_runtime::api::ButtonClick; +use pax_runtime::api::Event; +use pax_runtime::api::Focus; use pax_runtime::api::Platform; use pax_runtime::api::RenderContext; +use pax_runtime::api::SelectStart; use pax_runtime::api::TextboxChange; use pax_runtime::api::OS; -use pax_runtime::pax_pixels_render_context::PaxPixelsRenderer; -use pax_runtime::piet_render_context::PietRenderer; use pax_runtime::DefinitionToInstanceTraverser; -use pax_runtime_api::borrow_mut; -use pax_runtime_api::Event; -use pax_runtime_api::Focus; -use pax_runtime_api::SelectStart; -use piet_web::WebRenderContext; -use web_sys::CanvasRenderingContext2d; -use web_sys::WebGl2RenderingContext; -use web_sys::WebGlRenderingContext; use web_time::Instant; use_RefCell!(); @@ -34,8 +25,7 @@ pub mod web_render_contexts; use pax_runtime::PaxEngine; use std::rc::Rc; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; -use web_sys::{window, HtmlCanvasElement}; +use web_sys::window; pub use {console_error_panic_hook, console_log}; diff --git a/pax-chassis-web/src/web_render_contexts.rs b/pax-chassis-web/src/web_render_contexts.rs index 9ed494020..fd0a0ad5c 100644 --- a/pax-chassis-web/src/web_render_contexts.rs +++ b/pax-chassis-web/src/web_render_contexts.rs @@ -1,4 +1,4 @@ -use pax_runtime_api::RenderContext; +use pax_runtime::api::RenderContext; use wasm_bindgen::JsCast; use web_sys::{HtmlCanvasElement, Window}; diff --git a/pax-compiler/tests/data/code_serialization/serialization_test_project/.gitignore b/pax-compiler/tests/data/code_serialization/serialization_test_project/.gitignore new file mode 100644 index 000000000..530f45cf0 --- /dev/null +++ b/pax-compiler/tests/data/code_serialization/serialization_test_project/.gitignore @@ -0,0 +1 @@ +.pax diff --git a/pax-designer/src/project_mode_toggle/mod.pax b/pax-designer/src/project_mode_toggle/mod.pax index 0965d3637..a635fa4f8 100644 --- a/pax-designer/src/project_mode_toggle/mod.pax +++ b/pax-designer/src/project_mode_toggle/mod.pax @@ -1,7 +1,7 @@ if self.edit_mode { - + } if self.running_mode { diff --git a/pax-pixels/Cargo.toml b/pax-pixels/Cargo.toml index de9abc39c..87df6b230 100644 --- a/pax-pixels/Cargo.toml +++ b/pax-pixels/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pax-pixels" -version = "0.10.7" +version = "0.38.3" edition = "2021" authors = ["Samuel Selleck "] license = "MIT OR Apache-2.0" @@ -8,11 +8,8 @@ homepage = "https://pax.dev/" repository = "https://www.github.com/pax-lang/pax" description = "WGPU rendering library for the pax framework" -[lib] -crate-type = ["cdylib", "rlib"] - [dependencies] -pax-runtime-api = {path = "../pax-runtime-api", version="0.38.1"} +pax-runtime-api = {path = "../pax-runtime-api", version="0.38.3"} log = "0.4.20" bytemuck = { version = "1.14", features = ["derive"] } anyhow = "1.0" diff --git a/pax-runtime/Cargo.toml b/pax-runtime/Cargo.toml index 27d1d32f5..1118fb4d5 100644 --- a/pax-runtime/Cargo.toml +++ b/pax-runtime/Cargo.toml @@ -22,7 +22,7 @@ pax-designtime = {version="0.38.3", path = "../pax-designtime", optional = true} pax-runtime-api = {version="0.38.3", path = "../pax-runtime-api"} piet = "0.7.0" piet-common = "0.7.0" -pax-pixels = {path = "../pax-pixels"} +pax-pixels = {path = "../pax-pixels", version = "0.38.3"} serde = {version="1.0.196", features=["derive"]} wasm-bindgen = {version = "0.2.93", features=["serde-serialize"]} wasm-bindgen-futures = "0.4.42" diff --git a/pax-runtime/src/engine/mod.rs b/pax-runtime/src/engine/mod.rs index 589bcf6e5..e52fa05f8 100644 --- a/pax-runtime/src/engine/mod.rs +++ b/pax-runtime/src/engine/mod.rs @@ -3,6 +3,7 @@ use crate::{ }; use_RefCell!(); use std::collections::HashMap; +use std::ops::Range; use std::rc::Rc; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -270,7 +271,6 @@ impl PaxEngine { /// a. find lowest node (last child of last node) /// b. start rendering, from lowest node on-up, throughout tree pub fn tick(&mut self) -> Vec { - // self.runtime_context.set_all_canvases_dirty(); // // 1. UPDATE NODES (properties, etc.). This part we should be able to // completely remove once reactive properties dirty-dag is a thing. @@ -289,18 +289,7 @@ impl PaxEngine { } pub fn render(&mut self, rcs: &mut dyn RenderContext) { - static LAST_LAYER_COUNT: AtomicUsize = AtomicUsize::new(0); // last-patch layer_count - let curr_layer_count = self.runtime_context.layer_count.get(); - let old_layer_count = LAST_LAYER_COUNT.load(Ordering::Relaxed); - if old_layer_count != curr_layer_count { - rcs.resize_layers_to( - curr_layer_count, - Rc::clone(&self.runtime_context.dirty_canvases), - ); - self.runtime_context - .resize_canvas_layers_to(curr_layer_count); - LAST_LAYER_COUNT.store(curr_layer_count, Ordering::Relaxed) - } + let new_range = self.update_layer_count(rcs); for i in 0..rcs.layers() { if self @@ -325,8 +314,8 @@ impl PaxEngine { } self.runtime_context.clear_all_dirty_canvases(); - //dirtify the canvases that where created this frame (why is this needed?) - for i in old_layer_count..curr_layer_count { + //dirtify the canvases that where created this frame + for i in new_range { self.runtime_context.set_canvas_dirty(i); } } @@ -345,6 +334,22 @@ impl PaxEngine { }); } + pub fn update_layer_count(&self, rcs: &mut dyn RenderContext) -> Range { + static LAST_LAYER_COUNT: AtomicUsize = AtomicUsize::new(0); // last-patch layer_count + let curr_layer_count = self.runtime_context.layer_count.get(); + let old_layer_count = LAST_LAYER_COUNT.load(Ordering::Relaxed); + if old_layer_count != curr_layer_count { + rcs.resize_layers_to( + curr_layer_count, + Rc::clone(&self.runtime_context.dirty_canvases), + ); + self.runtime_context + .resize_canvas_layers_to(curr_layer_count); + LAST_LAYER_COUNT.store(curr_layer_count, Ordering::Relaxed) + } + old_layer_count..curr_layer_count + } + pub fn global_dispatch_focus(&self, args: Focus) -> bool { let mut prevent_default = false; self.root_expanded_node diff --git a/pax-runtime/src/engine/occlusion.rs b/pax-runtime/src/engine/occlusion.rs index e0202450c..6ebd29996 100644 --- a/pax-runtime/src/engine/occlusion.rs +++ b/pax-runtime/src/engine/occlusion.rs @@ -119,15 +119,6 @@ fn update_node_occlusion_recursive( .map(|v| v.to_u32()), }; - let cp = borrow!(node.common_properties); - let cp = borrow!(cp); - if cp - .id - .read(|i| i.as_ref().is_some_and(|i| i == "play_symbol")) - { - log::debug!("new occl: {:#?}", new_occlusion); - } - if (layer == Layer::Native || borrow!(node.instance_node).clips_content(&node)) && node.occlusion.get() != new_occlusion { diff --git a/pax-runtime/src/properties.rs b/pax-runtime/src/properties.rs index 2e86b12d0..25b301ed1 100644 --- a/pax-runtime/src/properties.rs +++ b/pax-runtime/src/properties.rs @@ -158,7 +158,6 @@ impl RuntimeContext { pub fn clear_all_dirty_canvases(&self) { let mut dirty_canvases = borrow_mut!(self.dirty_canvases); - log::debug!("dirty canvases: {:#?}", dirty_canvases); for v in dirty_canvases.iter_mut() { *v = false; }