A native Tauri 2 + wgpu example that isolates the runtime-infrastructure concepts used by ShadeCore:
The example keeps one native wgpu renderer and one HTML/CSS controls window. The renderer remains independent from the files, state, and logging systems that configure and describe it.
At startup, the runtime resolves its editable asset root in this order:
--assets <absolute path> passed to the executableJUNKPILE_ASSETSSHADECORE_ASSETS compatibility aliasruntime-state.jsonThe UI displays the winning source and every resolved path. A custom root can be prepared by cloning the active assets into an absolute path and selecting it for the next launch.
The active asset root contains:
runtime.json
runtime.macos.json
runtime.windows.json
runtime.linux.json
runtime.json is loaded first. The current operating-system file is then merged over it and strictly validated.
Runtime policy is startup-owned. Editing a runtime config file produces a structured restart_required event. Shader and parameter files remain live-reloadable.
The application atomically saves:
State is restored only after the active asset catalog has been validated. If a saved shader or profile no longer exists, the restore is rejected and the valid startup defaults continue running.
Autosave runs on a dedicated thread. Clear state file pauses autosave for the current session; Save state now writes a fresh state file and resumes autosave.
Runtime events are stored as JSON Lines. Each event contains:
{
"timestampUnixMs": 0,
"level": "info",
"subsystem": "assets",
"event": "next_root_selected",
"message": "custom asset root saved for the next launch",
"fields": {}
}
The log destination resolves in this order:
--log-file <absolute path>JUNKPILE_LOG_FILESHADECORE_LOG_FILE compatibility aliasA bounded in-memory ring drives the UI while the JSONL file remains the durable record.
CLI / environment / saved state
↓
asset-root resolver
↓
runtime.json + platform override
↓
validated shaders + parameters
↓
native wgpu renderer
↙ ↘
atomic runtime state structured JSONL events
35-wgpu-assets-state-logging/
├── assets/
│ ├── runtime.json
│ ├── runtime.macos.json
│ ├── runtime.windows.json
│ ├── runtime.linux.json
│ ├── render.json
│ ├── params.json
│ └── shaders/
├── src/
│ ├── index.html
│ ├── app.js
│ └── styles.css
└── src-tauri/
└── src/
├── assets.rs
├── runtime.rs
├── watcher.rs
├── renderer.rs
├── preview.rs
├── frame.rs
├── config.rs
└── main.rs
npm install
npm run dev
npm run build
Enter an absolute directory in the UI and click:
Clone active assets + use next launch
Restart the application. The custom directory should become the active root and the authority source should read persisted runtime state.
Environment-variable tests:
JUNKPILE_ASSETS="/absolute/path/to/assets" npm run dev
JUNKPILE_LOG_FILE="/absolute/path/to/junkpile-runtime.jsonl" npm run dev
ShadeCore-compatible aliases are also supported:
SHADECORE_ASSETS="/absolute/path/to/assets" npm run dev
SHADECORE_LOG_FILE="/absolute/path/to/runtime.jsonl" npm run dev
render.json.active_frag controls startup only.