core: manual buffer sync with sync-rows, reuse unchanged buffers and pipelines across activations

Also lets the screenshot suite point at another reference directory and settle longer.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0b2dd-db32-712d-99ce-12ce4a86d979
Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-09-18 05:53:44 +00:00
co-authored by heaust
parent 49c80a209e
commit 31d3ae21ff
15 changed files with 185 additions and 48 deletions
+14
View File
@@ -186,6 +186,20 @@ impl Core {
Ok(())
}
/// Uploads rows `first .. first + count` of `name` to every active GPU buffer bound to it.
pub fn sync_rows(&self, name: &str, first: u32, count: u32) -> Result<(), JsError> {
let gpu = self.gpu.borrow();
let gpu = gpu
.as_ref()
.ok_or_else(|| JsError::new("WEBGPU_UNINITIALIZED"))?;
self.store
.borrow()
.sync_rows(name, first, count, gpu, &self.data.borrow())
.map_err(|error| JsError::new(&error))?;
self.data.borrow_mut().mark_dirty();
Ok(())
}
pub fn compile_graph(&self, source: &str) -> Result<String, JsError> {
let graph = compiler::compile(source).map_err(JsError::new)?;
Ok(self.store.borrow_mut().save(graph))