@null3d/engine 0.1.2 → 0.1.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.
Files changed (49) hide show
  1. package/dist/wasm/single/null3d.js +4 -4
  2. package/dist/wasm/single/null3d_bg.wasm +0 -0
  3. package/dist/wasm/threaded/null3d.js +4 -4
  4. package/dist/wasm/threaded/null3d_bg.wasm +0 -0
  5. package/docs/api/reference/engine.md +1 -1
  6. package/docs/cli/null3d.md +60 -4
  7. package/docs/concepts/quality-presets.md +2 -0
  8. package/docs/errors/E1404.md +5 -1
  9. package/docs/getting-started/cdn.md +1 -1
  10. package/docs/getting-started/first-scene.md +3 -1
  11. package/docs/getting-started/hosting.md +11 -3
  12. package/docs/getting-started/install.md +20 -0
  13. package/docs/getting-started/project-structure.md +1 -1
  14. package/docs/guides/agents.md +1 -1
  15. package/docs/guides/assets-pipeline.md +31 -6
  16. package/docs/guides/debugging.md +2 -0
  17. package/docs/guides/deploying.md +1 -1
  18. package/docs/guides/deterministic-simulation.md +5 -2
  19. package/docs/guides/performance.md +2 -0
  20. package/docs/guides/start-time.md +2 -0
  21. package/docs/guides/testing.md +20 -0
  22. package/docs/pages.md +1 -1
  23. package/docs/porting/verification.md +1 -1
  24. package/lib/errors/codes.js +6 -0
  25. package/lib/errors/fixes.js +1 -1
  26. package/lib/gpu/device-shaders.d.ts +5 -0
  27. package/lib/gpu/device-shaders.js +10 -1
  28. package/lib/gpu/variants.d.ts +25 -0
  29. package/lib/gpu/variants.js +75 -5
  30. package/lib/gpu/webgl2/backend.d.ts +22 -3
  31. package/lib/gpu/webgl2/backend.js +108 -22
  32. package/lib/gpu/webgl2/programs.d.ts +5 -0
  33. package/lib/gpu/webgl2/programs.js +25 -2
  34. package/lib/gpu/webgpu/backend.d.ts +34 -1
  35. package/lib/gpu/webgpu/backend.js +173 -27
  36. package/lib/gpu/webgpu/pipelines.d.ts +2 -2
  37. package/lib/gpu/webgpu/pipelines.js +15 -15
  38. package/lib/page/engine.js +62 -3
  39. package/lib/page/permutation-recording.d.ts +5 -3
  40. package/lib/page/permutation-recording.js +13 -7
  41. package/lib/quality/chooser.d.ts +2 -0
  42. package/lib/quality/chooser.js +4 -0
  43. package/lib/shader-artifact.json +1 -1
  44. package/lib/shared/version.d.ts +1 -1
  45. package/lib/shared/version.js +1 -1
  46. package/lib/workers/protocol.d.ts +29 -0
  47. package/lib/workers/render-worker.js +6 -3
  48. package/lib/workers/sketch-worker.js +6 -3
  49. package/package.json +1 -1
@@ -188,6 +188,35 @@ export type WorkerReply = {
188
188
  role: 'sketch' | 'render';
189
189
  permutations: number[];
190
190
  }
191
+ /**
192
+ * A permutation word that the drawing thread's pipelines reached while it recorded, sent as it
193
+ * arrives so a live page streams its growing set to the tool that records it.
194
+ */
195
+ | {
196
+ type: 'recorded-word';
197
+ role: 'sketch' | 'render';
198
+ word: number;
199
+ }
200
+ /**
201
+ * An object pipeline whose shader variant the loaded set lacks. Its draws draw nothing, and the
202
+ * page publishes the word for a production build's check.
203
+ */
204
+ | {
205
+ type: 'missing-word';
206
+ role: 'sketch' | 'render';
207
+ pipeline: string;
208
+ word: number;
209
+ }
210
+ /**
211
+ * A pipeline or pass whose shader file failed to load. The engine draws without it, and the
212
+ * page warns once.
213
+ */
214
+ | {
215
+ type: 'unavailable-shader';
216
+ role: 'sketch' | 'render';
217
+ pipeline: string;
218
+ reason: string;
219
+ }
191
220
  /**
192
221
  * In a development build, a permutation word that the drawing thread's pipelines found for the
193
222
  * first time, which the page hands to the dev server to compare with the project's shader list.
@@ -5,7 +5,7 @@
5
5
  // the engine's memory, and the next engine on the same canvas starts it again with its own.
6
6
  import { DEV } from '../errors/checks.js';
7
7
  import { messageOf } from '../errors/message.js';
8
- import { recordPermutations, reportPermutations, stopRecordingPermutations } from '../gpu/variants.js';
8
+ import { receiveMissingVariants, receiveUnavailableShaders, recordPermutations, reportPermutations, stopRecordingPermutations, } from '../gpu/variants.js';
9
9
  import { captureFrame, captureImage, startDrawing, startEarly } from '../render/draw.js';
10
10
  import { controlViews } from '../shared/control.js';
11
11
  import { setWakeByMessage } from '../shared/wake.js';
@@ -39,9 +39,12 @@ startWorker('render', step, async (event) => {
39
39
  if (!canvas)
40
40
  throw new Error('the page gave the render worker no canvas');
41
41
  // A recording starts here, before the scene's draws ask for their pipelines, and the
42
- // page stops it once the held frame has drawn them.
42
+ // page stops it once the held frame has drawn them. Each word reaches the page as it
43
+ // arrives, so a live page streams its growing set to the tool that records it.
43
44
  if (message.recordPermutations)
44
- recordPermutations();
45
+ recordPermutations((word) => replyToPage({ type: 'recorded-word', role: 'render', word }));
46
+ receiveMissingVariants((pipeline, word) => replyToPage({ type: 'missing-word', role: 'render', pipeline, word }));
47
+ receiveUnavailableShaders((pipeline, reason) => replyToPage({ type: 'unavailable-shader', role: 'render', pipeline, reason }));
45
48
  if (DEV)
46
49
  reportPermutations((word) => replyToPage({ type: 'permutation', word }));
47
50
  host = new DrawingHost();
@@ -9,7 +9,7 @@
9
9
  // starts it again.
10
10
  import { DEV } from '../errors/checks.js';
11
11
  import { messageOf } from '../errors/message.js';
12
- import { recordPermutations, reportPermutations, stopRecordingPermutations } from '../gpu/variants.js';
12
+ import { receiveMissingVariants, receiveUnavailableShaders, recordPermutations, reportPermutations, stopRecordingPermutations, } from '../gpu/variants.js';
13
13
  import { loadDrawModule, preloadDrawing } from '../render/load-draw.js';
14
14
  import { awaitLater } from '../shared/await-later.js';
15
15
  import { controlViews } from '../shared/control.js';
@@ -157,9 +157,12 @@ startWorker('sketch', step, async (event) => {
157
157
  if (message.renderer && drawModule) {
158
158
  draw = await drawModule;
159
159
  // This thread draws in low-latency mode, so a recording here lists the words that its
160
- // pipelines ask for. The page stops it once the held frame has drawn them.
160
+ // pipelines ask for. The page stops it once the held frame has drawn them, and each
161
+ // word reaches the page as it arrives.
161
162
  if (message.renderer.recordPermutations)
162
- recordPermutations();
163
+ recordPermutations((word) => replyToPage({ type: 'recorded-word', role: 'sketch', word }));
164
+ receiveMissingVariants((pipeline, word) => replyToPage({ type: 'missing-word', role: 'sketch', pipeline, word }));
165
+ receiveUnavailableShaders((pipeline, reason) => replyToPage({ type: 'unavailable-shader', role: 'sketch', pipeline, reason }));
163
166
  if (DEV)
164
167
  reportPermutations((word) => replyToPage({ type: 'permutation', word }));
165
168
  step('renderer loaded');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@null3d/engine",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "The null3D engine, a high-performance browser 3D engine for agents, faster than three.js, with wide device compatibility: the TypeScript API, the page shim, the worker entry points, both WebAssembly builds and the docs.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "Ramesh Nair (https://hiddentao.com)",