@forgeax/engine-runtime 0.1.6 → 0.1.19
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 +61 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/helpers/standard-material-manifest.d.ts +12 -0
- package/dist/__tests__/helpers/standard-material-manifest.d.ts.map +1 -0
- package/dist/__tests__/render-environment-consumer.integration.test.d.ts +2 -0
- package/dist/__tests__/render-environment-consumer.integration.test.d.ts.map +1 -0
- package/dist/__tests__/render-error-exhaustive.test-d.d.ts.map +1 -1
- package/dist/__tests__/render-feature-prepared-graphics.fixture.d.ts.map +1 -1
- package/dist/__tests__/renderer-host-fallback.unit.test.d.ts +2 -0
- package/dist/__tests__/renderer-host-fallback.unit.test.d.ts.map +1 -0
- package/dist/__tests__/skinned-shadow-mixed.dawn.test.d.ts +2 -0
- package/dist/__tests__/skinned-shadow-mixed.dawn.test.d.ts.map +1 -0
- package/dist/backend-selection.d.ts.map +1 -1
- package/dist/collect-scene-asset.d.ts +6 -3
- package/dist/collect-scene-asset.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +25 -4
- package/dist/index.mjs.map +1 -1
- package/dist/renderer-host.d.ts +2 -1
- package/dist/renderer-host.d.ts.map +1 -1
- package/dist/renderer-host.mjs +21 -2
- package/dist/renderer-host.mjs.map +1 -1
- package/package.json +30 -30
- package/src/__tests__/asset-registry-guid-reverse.test.ts +33 -0
- package/src/__tests__/dawn/instances-per-instance-pbr.dawn.test.ts +12 -11
- package/src/__tests__/dawn/material-cooked-fixture.dawn.test.ts +39 -6
- package/src/__tests__/errors.unit.test.ts +60 -0
- package/src/__tests__/extract-record-no-hardcoded-texture-fields.test.ts +4 -5
- package/src/__tests__/fullscreen-post-process-pass.dawn.test.ts +461 -18
- package/src/__tests__/geometry.unit.test.ts +3 -1
- package/src/__tests__/helpers/standard-material-manifest.ts +45 -0
- package/src/__tests__/lights.unit.test.ts +15 -11
- package/src/__tests__/material-texture-uv-scale.unit.test.ts +8 -14
- package/src/__tests__/materials.unit.test.ts +2 -0
- package/src/__tests__/pbr-pipeline.unit.test.ts +15 -12
- package/src/__tests__/pipeline-cache-keying.unit.test.ts +6 -4
- package/src/__tests__/pipeline.unit.test.ts +5 -2
- package/src/__tests__/render-environment-consumer.integration.test.ts +33 -0
- package/src/__tests__/render-error-exhaustive.test-d.ts +93 -0
- package/src/__tests__/render-feature-prepared-graphics.browser.test.ts +5 -1
- package/src/__tests__/render-feature-prepared-graphics.fixture.ts +10 -0
- package/src/__tests__/render-system-mega.test.ts +3 -1
- package/src/__tests__/render-system-record-multi-material-textureview.test.ts +3 -1
- package/src/__tests__/render-system-record-per-submesh-transparency.test.ts +3 -1
- package/src/__tests__/render-system-record.test.ts +8 -6
- package/src/__tests__/renderer-host-fallback.unit.test.ts +112 -0
- package/src/__tests__/renderer-lifecycle.integration.test.ts +10 -0
- package/src/__tests__/renderer-surface.unit.test.ts +66 -0
- package/src/__tests__/renderer.test-d.ts +2 -0
- package/src/__tests__/rhi-null-command-flow.unit.test.ts +14 -0
- package/src/__tests__/shadow-csm-cascade-loadop.test.ts +5 -1
- package/src/__tests__/shadow-csm-tile-consistency.test.ts +5 -1
- package/src/__tests__/skinned-shadow-mixed.dawn.test.ts +383 -0
- package/src/__tests__/sprite-lit-bgl-byte-identical.test.ts +10 -10
- package/src/__tests__/ssao-passes.test.ts +32 -12
- package/src/__tests__/systems.unit.test.ts +48 -31
- package/src/backend-selection.ts +4 -0
- package/src/collect-scene-asset.ts +14 -7
- package/src/index.ts +5 -1
- package/src/renderer-host.ts +30 -3
package/README.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# `@forgeax/engine-runtime`
|
|
2
2
|
|
|
3
|
+
## Host entry and frame evidence
|
|
4
|
+
|
|
5
|
+
`createRenderer` is the host assembly entry. It selects the backend services
|
|
6
|
+
and returns the render package's single `Renderer` contract; game code does
|
|
7
|
+
not construct a device, graph, or second submit path. Pass the attached lease,
|
|
8
|
+
camera, and environment facts to `draw`, then bind diagnostics to the
|
|
9
|
+
returned `FrameReceipt`:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const result = await createRenderer(canvas);
|
|
13
|
+
if (!result.ok) throw result.error;
|
|
14
|
+
const renderer = result.value;
|
|
15
|
+
const lease = renderer.attach(world);
|
|
16
|
+
if (!lease.ok) throw lease.error;
|
|
17
|
+
const frame = renderer.draw({
|
|
18
|
+
leases: [lease.value],
|
|
19
|
+
camera: { lease: lease.value },
|
|
20
|
+
environment: { lease: lease.value },
|
|
21
|
+
});
|
|
22
|
+
if (!frame.ok) throw frame.error;
|
|
23
|
+
const facts = renderer.inspect();
|
|
24
|
+
const observation = await renderer.observe(frame.value, { include: ['timings'] });
|
|
25
|
+
void facts;
|
|
26
|
+
void observation;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Progressive recovery index
|
|
30
|
+
|
|
31
|
+
Start with the public host route: `createRenderer`, `attach`, and `draw`. Then
|
|
32
|
+
use `inspect()` for detached state and `observe(receipt, request)` for evidence
|
|
33
|
+
bound to the successful receipt. If `draw` returns an error, use its closed
|
|
34
|
+
`code` and typed `detail` to repair the named producer or capability, and retry
|
|
35
|
+
the identical request. Do not parse text or reach into graph, device, or
|
|
36
|
+
history state.
|
|
37
|
+
|
|
38
|
+
Carrier manifests and schemas expose current source/build provenance, backend,
|
|
39
|
+
runner, and frame identity. Structural graph checks are distinct from real
|
|
40
|
+
Browser/Dawn readback and PNG evidence; a historical oracle is reference data,
|
|
41
|
+
not a runtime pass. `unavailable` remains an explicit result.
|
|
42
|
+
|
|
43
|
+
`inspect()` is detached and bounded. `observe()` is receipt-bound, so a
|
|
44
|
+
stale receipt is a structured failure rather than an implicit read of the
|
|
45
|
+
current frame. Repair the owner named by `error.detail`, then retry the same
|
|
46
|
+
request.
|
|
47
|
+
|
|
3
48
|
## Render happy path
|
|
4
49
|
|
|
5
50
|
`createRenderer -> attach -> draw -> inspect/observe/recover` assembles one
|
|
@@ -110,6 +155,22 @@ its structured construction error. After construction, `attach`, `draw`,
|
|
|
110
155
|
`inspect`, `observe`, and `recover` remain receipt-bound and `dispose()` is
|
|
111
156
|
idempotent.
|
|
112
157
|
|
|
158
|
+
### Browser backend selection and diagnosis
|
|
159
|
+
|
|
160
|
+
The default browser path prefers native WebGPU and can retry through the
|
|
161
|
+
`wgpu`/WebGL2 downlevel backend. Consequently, a native-channel
|
|
162
|
+
`adapter-unavailable` error means only that `navigator.gpu.requestAdapter()` did
|
|
163
|
+
not produce an adapter; it is not a verdict that the machine cannot run the
|
|
164
|
+
game. A thrown `requestAdapter()` failure is reported separately as
|
|
165
|
+
`webgpu-runtime-error` with the original name/message in `detail.error`, while a
|
|
166
|
+
literal `null` remains `adapter-unavailable`.
|
|
167
|
+
|
|
168
|
+
Always diagnose the final structured error rather than matching the word
|
|
169
|
+
“WebGPU”. Inspect `.code`, `.expected`, `.hint`, and nested backend causes. Asset,
|
|
170
|
+
shader, Pack, permission-policy, and application bootstrap failures belong to
|
|
171
|
+
their own owners and must not be repaired by replacing ForgeaX with a second
|
|
172
|
+
Canvas renderer or by swallowing the entry-module exception.
|
|
173
|
+
|
|
113
174
|
## Import each domain from its owner
|
|
114
175
|
|
|
115
176
|
| Need | Canonical package | Example imports |
|