Optimize render graph and add GPU profiling

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-20 11:48:06 +00:00
co-authored by heaust
parent ded70a3cb4
commit 000bfd63bf
22 changed files with 1622 additions and 203 deletions
+16 -1
View File
@@ -39,10 +39,25 @@ const id = await core.allocateObject("application.values");
values.row(id).set([1, 2, 3, 4]);
```
Graph frontends serialize plain data to `(yawn-graph 1 ...)`. Named `after` edges preserve DAG fan-out; Rust sorts passes, detects cycles, culls unused declarations, plans compatible transient lifetimes, and allocates the active loadout.
Graph frontends serialize plain data to `(yawn-graph 1 ...)`. Named `after` edges preserve DAG fan-out; Rust sorts passes, detects cycles, culls unused declarations, aliases compatible transient lifetimes, merges compatible render passes into bundles, and allocates the active loadout. Unchanged persistent textures survive loadout rebuilds.
The `Scene` addon is one such frontend. It is replaceable and has no privileged core API.
## Profile physical GPU passes
```ts
const stop = core.onProfile((frame) => {
console.table(frame.passes); // name + GPU milliseconds
});
const supported = await core.setProfiler(true);
// Later:
await core.setProfiler(false);
stop();
```
`new YawnCore(canvas, { debug: true })` enables the same timestamp-query mode at startup. Timings describe the physical compute and render passes produced by graph compilation, so 138 compatible draws appear as one bundled forward pass. The fullscreen playgrounds **Profile** button shows the stream in a toggleable sidebar.
<Playground example="core" />
<script setup>