rayzee 7.23.2 → 7.23.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,9 @@ A real-time WebGPU path tracing engine built on Three.js. Framework-agnostic —
|
|
|
31
31
|
- [engine.interactionManager](#engineinteractionmanager)
|
|
32
32
|
- [engine.transformManager](#enginetransformmanager)
|
|
33
33
|
- [Output Methods](#output-methods)
|
|
34
|
+
- [Render Resolution Reserve](#render-resolution-reserve)
|
|
34
35
|
- [Memory Monitoring](#memory-monitoring)
|
|
36
|
+
- [Logging](#logging)
|
|
35
37
|
- [Deterministic & Headless Rendering](#deterministic--headless-rendering)
|
|
36
38
|
- [Events](#events)
|
|
37
39
|
- [Advanced: Custom Pipeline Stages](#advanced-custom-pipeline-stages)
|
|
@@ -594,6 +596,36 @@ URL.revokeObjectURL(url);
|
|
|
594
596
|
|
|
595
597
|
---
|
|
596
598
|
|
|
599
|
+
### Render Resolution Reserve
|
|
600
|
+
|
|
601
|
+
Every compute `StorageTexture` and aux buffer is pre-allocated at one square dimension — the *reserve* — and `setCanvasSize()` refuses anything larger. The default is 2048, so 4K output needs the reserve raised first.
|
|
602
|
+
|
|
603
|
+
```js
|
|
604
|
+
engine.setReservedRenderResolution(4096) // raise to 4K (longest edge)
|
|
605
|
+
engine.setReservedRenderResolution(2048, { allowLower: true }) // lower, paying a rebuild, to reclaim VRAM
|
|
606
|
+
engine.getReservedRenderResolution() // the reserve actually in force
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
The request is **device-capped**: a 4096 reserve pins roughly 1.5 GB of MRT textures, so it is only granted on GPUs reporting ≥ 8 GB and a ≥ 1 GB `maxStorageBufferBindingSize`; weaker devices clamp to 2048. `MAX_RESERVABLE_RENDER_SIZE` (4096) is the ceiling on any request.
|
|
610
|
+
|
|
611
|
+
Raises are monotonic unless you pass `allowLower` — UI-driven callers ask for whatever the current view needs, and honouring every decrease made the reserve oscillate across preview↔render switches, paying a full kernel rebuild each time.
|
|
612
|
+
|
|
613
|
+
Callable at any point in the lifecycle:
|
|
614
|
+
|
|
615
|
+
- **Before `init()`** — recorded and applied during `init()`, after the device exists but before the stages are constructed, so they allocate at the raised size directly. The device gate cannot run without a device, so the return value here is the *request*, not the verdict.
|
|
616
|
+
- **After `init()`** — applied immediately, re-initialising the reserved GPU storage in place.
|
|
617
|
+
|
|
618
|
+
Either way the verdict arrives as a `reserved_render_size_changed` event (a plain string type, not an `EngineEvents` constant):
|
|
619
|
+
|
|
620
|
+
```js
|
|
621
|
+
engine.addEventListener('reserved_render_size_changed', e => console.log('reserve:', e.size));
|
|
622
|
+
engine.setReservedRenderResolution(4096);
|
|
623
|
+
await engine.init();
|
|
624
|
+
console.log(engine.getReservedRenderResolution()); // 4096, or 2048 if the device declined
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
597
629
|
### Memory Monitoring
|
|
598
630
|
|
|
599
631
|
Track GPU (VRAM) usage across the whole pipeline. Sizes are measured from live GPU resources (buffer `byteLength` + texture dimensions × format), so they are exact, not estimated.
|
|
@@ -612,6 +644,27 @@ The React app surfaces this as a `Memory: … | Peak: …` readout in the on-can
|
|
|
612
644
|
|
|
613
645
|
---
|
|
614
646
|
|
|
647
|
+
### Logging
|
|
648
|
+
|
|
649
|
+
Leveled, namespaced console output, shared with the engine's Web Workers. The default level is `info`, which hides per-mesh and per-texture detail; drop to `debug` to see it.
|
|
650
|
+
|
|
651
|
+
```js
|
|
652
|
+
import { Logger, createLogger, fmt, LOG_LEVELS } from 'rayzee';
|
|
653
|
+
|
|
654
|
+
Logger.setLevel('debug'); // 'silent' | 'error' | 'warn' | 'info' | 'debug'
|
|
655
|
+
Logger.getLevel();
|
|
656
|
+
Logger.isEnabled('debug'); // gate expensive message construction
|
|
657
|
+
Logger.only('bvh', 'gpu'); // restrict debug to these namespaces (implies setLevel('debug'))
|
|
658
|
+
Logger.only(); // clear the namespace filter
|
|
659
|
+
Logger.refresh(); // re-read the level from globals/localStorage
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
The chosen level persists in `localStorage` under `rayzeeLogLevel` (namespace filter: `rayzeeLogNamespaces`), so it survives a reload. The engine does not install a global itself — expose one from your host if you want console access without an import; the demo app does `globalThis.rayzee = { log: Logger, ... }`, which is what makes `rayzee.log.setLevel('debug')` work there.
|
|
663
|
+
|
|
664
|
+
`createLogger(namespace)` returns a channel with `error` / `warn` / `info` / `debug` plus `summary(headline, details)`, which prints one `info` line with the detail lines folded into a collapsed group. `fmt` holds the formatting helpers those summaries use — `n`, `ms`, `mb`, `px`, `count`, `list`. `LOG_LEVELS` is the name→severity map.
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
615
668
|
### Deterministic & Headless Rendering
|
|
616
669
|
|
|
617
670
|
For offline rendering, regression testing, and benchmarking — drive accumulation yourself instead of the rAF loop, and get bit-reproducible output.
|
|
@@ -724,8 +777,12 @@ import {
|
|
|
724
777
|
MEMORY_CONSTANTS,
|
|
725
778
|
PRODUCTION_RENDER_CONFIG,
|
|
726
779
|
INTERACTIVE_RENDER_CONFIG,
|
|
780
|
+
MAX_RESERVABLE_RENDER_SIZE,
|
|
727
781
|
} from 'rayzee';
|
|
728
782
|
|
|
783
|
+
// Leveled/namespaced logging, shared with the workers
|
|
784
|
+
import { Logger, createLogger, fmt, LOG_LEVELS } from 'rayzee';
|
|
785
|
+
|
|
729
786
|
// Asset URL / cache namespace overrides
|
|
730
787
|
import { configureAssets, getAssetConfig } from 'rayzee';
|
|
731
788
|
|