@null3d/engine 0.1.0 → 0.1.2
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/dist/wasm/single/null3d.js +10 -8
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +10 -8
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +96 -24
- package/docs/api/assets.md +99 -29
- package/docs/api/cameras.md +38 -7
- package/docs/api/controls.md +47 -23
- package/docs/api/debug.md +105 -35
- package/docs/api/engine.md +108 -32
- package/docs/api/feature-draws.md +21 -15
- package/docs/api/feature-effects.md +8 -8
- package/docs/api/feature-instances.md +68 -17
- package/docs/api/features.md +68 -37
- package/docs/api/geometry.md +83 -14
- package/docs/api/grass.md +55 -13
- package/docs/api/impostors.md +92 -50
- package/docs/api/input.md +22 -9
- package/docs/api/lights.md +67 -16
- package/docs/api/lines.md +38 -13
- package/docs/api/materials.md +187 -59
- package/docs/api/math.md +6 -6
- package/docs/api/objects.md +40 -15
- package/docs/api/page.md +58 -7
- package/docs/api/particles.md +36 -11
- package/docs/api/points.md +18 -8
- package/docs/api/post.md +57 -23
- package/docs/api/quality.md +36 -16
- package/docs/api/raycast.md +57 -24
- package/docs/api/reference/animation.md +1 -2
- package/docs/api/reference/assets.md +7 -4
- package/docs/api/reference/cameras.md +3 -2
- package/docs/api/reference/controls.md +59 -2
- package/docs/api/reference/debug.md +58 -6
- package/docs/api/reference/engine.md +40 -10
- package/docs/api/reference/feature-draws.md +3 -4
- package/docs/api/reference/feature-effects.md +2 -3
- package/docs/api/reference/feature-instances.md +5 -4
- package/docs/api/reference/features.md +7 -4
- package/docs/api/reference/geometry.md +132 -21
- package/docs/api/reference/grass.md +62 -2
- package/docs/api/reference/impostors.md +120 -16
- package/docs/api/reference/input.md +1 -2
- package/docs/api/reference/lights.md +4 -3
- package/docs/api/reference/lines.md +3 -4
- package/docs/api/reference/materials.md +7 -6
- package/docs/api/reference/math.md +13 -2
- package/docs/api/reference/objects.md +2 -3
- package/docs/api/reference/particles.md +31 -6
- package/docs/api/reference/points.md +2 -3
- package/docs/api/reference/post.md +4 -3
- package/docs/api/reference/quality.md +1 -2
- package/docs/api/reference/raycast.md +1 -2
- package/docs/api/reference/render.md +4 -3
- package/docs/api/reference/scene.md +24 -5
- package/docs/api/reference/sketch.md +11 -11
- package/docs/api/reference/sound.md +33 -2
- package/docs/api/reference/splats.md +42 -3
- package/docs/api/reference/sprites.md +2 -3
- package/docs/api/reference/tasks.md +16 -3
- package/docs/api/reference/terrain.md +26 -5
- package/docs/api/reference/textures.md +1 -2
- package/docs/api/reference/three-compat.md +18 -7
- package/docs/api/reference/time.md +1 -2
- package/docs/api/reference/ui.md +10 -7
- package/docs/api/reference/vertex-draws.md +2 -3
- package/docs/api/reference/water.md +78 -5
- package/docs/api/reference/wind.md +15 -2
- package/docs/api/render.md +67 -25
- package/docs/api/scene.md +129 -36
- package/docs/api/sketch.md +45 -19
- package/docs/api/sound.md +48 -12
- package/docs/api/splats.md +42 -15
- package/docs/api/sprites.md +8 -6
- package/docs/api/tasks.md +31 -22
- package/docs/api/terrain.md +44 -12
- package/docs/api/textures.md +61 -12
- package/docs/api/three-compat.md +15 -7
- package/docs/api/time.md +3 -5
- package/docs/api/ui.md +18 -10
- package/docs/api/vertex-draws.md +13 -12
- package/docs/api/water.md +111 -67
- package/docs/api/wind.md +61 -15
- package/docs/cli/null3d.md +90 -15
- package/docs/concepts/architecture.md +69 -23
- package/docs/concepts/assets.md +57 -16
- package/docs/concepts/backends.md +68 -24
- package/docs/concepts/color-management.md +42 -13
- package/docs/concepts/culling.md +68 -47
- package/docs/concepts/handles.md +14 -5
- package/docs/concepts/instances.md +72 -23
- package/docs/concepts/large-worlds.md +17 -7
- package/docs/concepts/lighting.md +117 -44
- package/docs/concepts/lod.md +128 -33
- package/docs/concepts/materials.md +43 -12
- package/docs/concepts/particle-buffer.md +48 -35
- package/docs/concepts/post-processing.md +77 -14
- package/docs/concepts/quality-preset-tables.md +3 -2
- package/docs/concepts/quality-presets.md +122 -39
- package/docs/concepts/render-graph.md +56 -21
- package/docs/concepts/render-layers.md +9 -5
- package/docs/concepts/shadows.md +96 -25
- package/docs/concepts/static-dynamic.md +22 -7
- package/docs/cookbook/index.md +163 -119
- package/docs/data/threejs-mapping.json +301 -340
- package/docs/errors/E1101.md +23 -5
- package/docs/errors/E1102.md +11 -3
- package/docs/errors/E1103.md +11 -3
- package/docs/errors/E1104.md +11 -3
- package/docs/errors/E1105.md +13 -5
- package/docs/errors/E1106.md +11 -3
- package/docs/errors/E1107.md +15 -5
- package/docs/errors/E1108.md +11 -3
- package/docs/errors/E1109.md +32 -6
- package/docs/errors/E1110.md +23 -5
- package/docs/errors/E1111.md +11 -3
- package/docs/errors/E1112.md +11 -3
- package/docs/errors/E1203.md +12 -4
- package/docs/errors/E1204.md +11 -3
- package/docs/errors/E1205.md +11 -3
- package/docs/errors/E1206.md +28 -6
- package/docs/errors/E1207.md +11 -3
- package/docs/errors/E1208.md +12 -3
- package/docs/errors/E1209.md +11 -3
- package/docs/errors/E1213.md +27 -5
- package/docs/errors/E1214.md +11 -3
- package/docs/errors/E1215.md +31 -6
- package/docs/errors/E1216.md +31 -6
- package/docs/errors/E1217.md +29 -6
- package/docs/errors/E1218.md +22 -6
- package/docs/errors/E1219.md +11 -3
- package/docs/errors/E1220.md +24 -5
- package/docs/errors/E1221.md +24 -5
- package/docs/errors/E1222.md +11 -3
- package/docs/errors/E1223.md +39 -6
- package/docs/errors/E1224.md +11 -3
- package/docs/errors/E1225.md +11 -3
- package/docs/errors/E1301.md +11 -3
- package/docs/errors/E1302.md +11 -3
- package/docs/errors/E1303.md +11 -3
- package/docs/errors/E1304.md +11 -3
- package/docs/errors/E1305.md +13 -3
- package/docs/errors/E1306.md +11 -3
- package/docs/errors/E1307.md +23 -6
- package/docs/errors/E1308.md +31 -0
- package/docs/errors/E1401.md +11 -3
- package/docs/errors/E1402.md +13 -5
- package/docs/errors/E1403.md +11 -3
- package/docs/errors/E1404.md +13 -3
- package/docs/errors/E1405.md +15 -4
- package/docs/errors/E1406.md +31 -5
- package/docs/errors/E1407.md +11 -3
- package/docs/errors/E1408.md +11 -3
- package/docs/errors/E1409.md +11 -3
- package/docs/errors/E1410.md +13 -5
- package/docs/errors/E1411.md +11 -3
- package/docs/errors/E1412.md +29 -6
- package/docs/errors/E1413.md +11 -3
- package/docs/errors/E1414.md +11 -3
- package/docs/errors/E1415.md +11 -3
- package/docs/errors/E1416.md +27 -6
- package/docs/errors/E1417.md +11 -3
- package/docs/errors/E1418.md +12 -3
- package/docs/errors/E1419.md +13 -5
- package/docs/errors/E1420.md +11 -3
- package/docs/errors/E1421.md +11 -3
- package/docs/errors/E1422.md +12 -3
- package/docs/errors/E1423.md +12 -3
- package/docs/errors/E1424.md +24 -5
- package/docs/errors/E1425.md +11 -3
- package/docs/errors/E1426.md +11 -3
- package/docs/errors/E1430.md +11 -3
- package/docs/errors/E1431.md +11 -3
- package/docs/errors/E1432.md +11 -3
- package/docs/errors/E1433.md +11 -3
- package/docs/errors/E1434.md +15 -6
- package/docs/errors/E1435.md +11 -3
- package/docs/errors/E1436.md +11 -3
- package/docs/errors/E1437.md +14 -6
- package/docs/errors/E1501.md +41 -6
- package/docs/errors/E1502.md +13 -3
- package/docs/errors/E1503.md +11 -3
- package/docs/errors/E1504.md +11 -3
- package/docs/errors/E1505.md +23 -5
- package/docs/errors/E1506.md +11 -3
- package/docs/errors/index.md +53 -29
- package/docs/getting-started/cdn.md +15 -9
- package/docs/getting-started/first-scene.md +20 -12
- package/docs/getting-started/hosting.md +113 -63
- package/docs/getting-started/install.md +39 -24
- package/docs/getting-started/network-use.md +31 -21
- package/docs/getting-started/project-structure.md +20 -8
- package/docs/getting-started/third-party-notices.md +6 -10
- package/docs/guides/accessibility.md +4 -4
- package/docs/guides/add-ons.md +83 -13
- package/docs/guides/agents.md +13 -14
- package/docs/guides/assets-pipeline.md +294 -72
- package/docs/guides/audio.md +17 -15
- package/docs/guides/baked-light-data.md +44 -23
- package/docs/guides/car-paint.md +37 -31
- package/docs/guides/content-pages.md +86 -29
- package/docs/guides/custom-passes.md +59 -17
- package/docs/guides/custom-shaders.md +54 -37
- package/docs/guides/debugging.md +31 -41
- package/docs/guides/deploying.md +10 -27
- package/docs/guides/deterministic-simulation.md +23 -16
- package/docs/guides/first-use-shaders.md +83 -45
- package/docs/guides/lens-kit.md +29 -26
- package/docs/guides/loading-screens.md +74 -30
- package/docs/guides/multiple-views.md +22 -11
- package/docs/guides/performance.md +188 -37
- package/docs/guides/phones.md +71 -19
- package/docs/guides/physics.md +6 -10
- package/docs/guides/screens.md +41 -29
- package/docs/guides/start-time.md +126 -85
- package/docs/guides/testing.md +137 -98
- package/docs/guides/ui-overlays.md +17 -12
- package/docs/guides/video-textures.md +14 -13
- package/docs/images/api/animation/character.webp +0 -0
- package/docs/images/api/animation/look-at-ring.webp +0 -0
- package/docs/images/api/animation/morph-tulips.webp +0 -0
- package/docs/images/api/animation/skeleton-lines.webp +0 -0
- package/docs/images/api/controls/gizmo-handles.webp +0 -0
- package/docs/images/api/controls/walk-and-fly.webp +0 -0
- package/docs/images/api/debug/debug-shapes.webp +0 -0
- package/docs/images/api/debug/levels-view.webp +0 -0
- package/docs/images/api/engine/transparent-canvas.webp +0 -0
- package/docs/images/api/feature-draws/feature-draw-clouds.webp +0 -0
- package/docs/images/api/feature-instances/compute-instances.webp +0 -0
- package/docs/images/api/feature-instances/instances-shadow.webp +0 -0
- package/docs/images/api/geometry/extra-shapes.webp +0 -0
- package/docs/images/api/geometry/generators.webp +0 -0
- package/docs/images/api/geometry/mesh-arrays.webp +0 -0
- package/docs/images/api/geometry/vertex-updates.webp +0 -0
- package/docs/images/api/grass/grass-grove.webp +0 -0
- package/docs/images/api/grass/grass-presets.webp +0 -0
- package/docs/images/api/grass/grass-shadow.webp +0 -0
- package/docs/images/api/impostors/impostor-handover.webp +0 -0
- package/docs/images/api/impostors/impostor-shadow.webp +0 -0
- package/docs/images/api/impostors/impostors-forest.webp +0 -0
- package/docs/images/api/lights/spot-cookies.webp +0 -0
- package/docs/images/api/lines/lines-lit.webp +0 -0
- package/docs/images/api/lines/lines-widths.webp +0 -0
- package/docs/images/api/materials/coat-and-sheen.webp +0 -0
- package/docs/images/api/materials/decals.webp +0 -0
- package/docs/images/api/materials/iridescence-and-anisotropy.webp +0 -0
- package/docs/images/api/materials/relief.webp +0 -0
- package/docs/images/api/materials/shader-inputs.webp +0 -0
- package/docs/images/api/materials/standard-grid.webp +0 -0
- package/docs/images/api/materials/subsurface.webp +0 -0
- package/docs/images/api/materials/translucency.webp +0 -0
- package/docs/images/api/objects/objects-turntable.webp +0 -0
- package/docs/images/api/particles/campfire.webp +0 -0
- package/docs/images/api/points/galaxy.webp +0 -0
- package/docs/images/api/reference/textures/texture-wrap.webp +0 -0
- package/docs/images/api/render/fullscreen-glow.webp +0 -0
- package/docs/images/api/render/reflection-mirror.webp +0 -0
- package/docs/images/api/render/security-camera.webp +0 -0
- package/docs/images/api/scene/aurora-sky-layer.webp +0 -0
- package/docs/images/api/sound/sound-demo.webp +0 -0
- package/docs/images/api/splats/splats-demo.webp +0 -0
- package/docs/images/api/sprites/sprites-lines.webp +0 -0
- package/docs/images/api/terrain/terrain-demo.webp +0 -0
- package/docs/images/api/textures/canvas-screen.webp +0 -0
- package/docs/images/api/textures/mipmaps.webp +0 -0
- package/docs/images/api/vertex-draws/rain.webp +0 -0
- package/docs/images/api/water/ocean.webp +0 -0
- package/docs/images/api/water/water-demo.webp +0 -0
- package/docs/images/api/water/water-rain.webp +0 -0
- package/docs/images/api/water/waterfall.webp +0 -0
- package/docs/images/concepts/assets/gltf-model.webp +0 -0
- package/docs/images/concepts/color-management/tone-mapped.webp +0 -0
- package/docs/images/concepts/culling/far-from-origin.webp +0 -0
- package/docs/images/concepts/instances/instances.webp +0 -0
- package/docs/images/concepts/instances/per-row-colors.webp +0 -0
- package/docs/images/concepts/large-worlds/large-world.webp +0 -0
- package/docs/images/concepts/lighting/area-lights.webp +0 -0
- package/docs/images/concepts/lighting/atmosphere.webp +0 -0
- package/docs/images/concepts/lighting/environment.webp +0 -0
- package/docs/images/concepts/lighting/light-shafts.webp +0 -0
- package/docs/images/concepts/lighting/reflection-probes.webp +0 -0
- package/docs/images/concepts/lod/forest.webp +0 -0
- package/docs/images/concepts/materials/weighted-transparency.webp +0 -0
- package/docs/images/concepts/post-processing/auto-exposure.webp +0 -0
- package/docs/images/concepts/post-processing/bounce-light.webp +0 -0
- package/docs/images/concepts/post-processing/depth-of-field.webp +0 -0
- package/docs/images/concepts/post-processing/post-effects-alley.webp +0 -0
- package/docs/images/concepts/post-processing/sharpen.webp +0 -0
- package/docs/images/concepts/post-processing/ssr-wet-street.webp +0 -0
- package/docs/images/concepts/render-layers/layers-cottages.webp +0 -0
- package/docs/images/concepts/shadows/hero-shadow.webp +0 -0
- package/docs/images/cookbook/index/picking.webp +0 -0
- package/docs/images/cookbook/index/time-of-day.webp +0 -0
- package/docs/images/errors/E1431/area-lights-no-tables.webp +0 -0
- package/docs/images/guides/custom-passes/reflection-water.webp +0 -0
- package/docs/images/guides/deterministic-simulation/replay-demo.webp +0 -0
- package/docs/images/guides/multiple-views/split-screen.webp +0 -0
- package/docs/images/guides/performance/overdraw-view.webp +0 -0
- package/docs/images/guides/testing/hold-mode-frame.webp +0 -0
- package/docs/images/index/showcase-island.webp +0 -0
- package/docs/images/porting/threejs-shaders/dissolve.webp +0 -0
- package/docs/images/shaders/builtins/builtins.webp +0 -0
- package/docs/images/shaders/surface-functions/custom-surface.webp +0 -0
- package/docs/images/shaders/surface-functions/vertex-offset.webp +0 -0
- package/docs/images/shots.json +2231 -0
- package/docs/index.md +14 -23
- package/docs/moves.json +1 -0
- package/docs/nav.json +300 -0
- package/docs/pages.md +230 -212
- package/docs/porting/react-three-fiber.md +2 -6
- package/docs/porting/threejs-loop-and-threads.md +1 -5
- package/docs/porting/threejs-mapping.md +1248 -234
- package/docs/porting/threejs-materials.md +10 -5
- package/docs/porting/threejs-overview.md +26 -6
- package/docs/porting/threejs-postprocessing.md +2 -6
- package/docs/porting/threejs-shaders.md +16 -14
- package/docs/porting/threejs-unsupported.md +6 -6
- package/docs/porting/verification.md +0 -4
- package/docs/shaders/builtins.md +15 -4
- package/docs/shaders/library.md +9 -6
- package/docs/shaders/surface-functions.md +51 -16
- package/docs/shaders/wgsl-rules.md +12 -5
- package/lib/debug/debug.d.ts +2 -2
- package/lib/debug/draw.d.ts +2 -2
- package/lib/debug/draw.js +8 -4
- package/lib/debug/overlay-look.d.ts +6 -0
- package/lib/debug/overlay-look.js +29 -7
- package/lib/debug/overlay.js +15 -11
- package/lib/debug/stats-options.d.ts +13 -0
- package/lib/debug/stats-panel.d.ts +21 -6
- package/lib/debug/stats-panel.js +80 -13
- package/lib/errors/codes.d.ts +17 -3
- package/lib/errors/codes.js +116 -105
- package/lib/errors/engine-error.js +1 -1
- package/lib/errors/fixes.d.ts +1 -0
- package/lib/errors/fixes.js +19 -18
- package/lib/generated/shader-permutations.d.ts +6 -0
- package/lib/generated/shader-permutations.js +6 -0
- package/lib/gpu/variants.d.ts +8 -2
- package/lib/gpu/variants.js +39 -7
- package/lib/gpu/webgl2/programs.js +1 -1
- package/lib/gpu/webgpu/pipelines.js +13 -13
- package/lib/index.d.ts +1 -1
- package/lib/page/capabilities.d.ts +1 -1
- package/lib/page/engine.d.ts +29 -7
- package/lib/page/engine.js +79 -7
- package/lib/page/label-loop.js +9 -4
- package/lib/page/stats-switch.js +2 -0
- package/lib/page/switches.d.ts +6 -4
- package/lib/page/switches.js +20 -4
- package/lib/scene/baked-light.d.ts +2 -2
- package/lib/scene/fake-call-values.js +2 -2
- package/lib/scene/frame-cameras.d.ts +16 -4
- package/lib/scene/frame-cameras.js +28 -10
- package/lib/scene/gltf.d.ts +1 -1
- package/lib/scene/level-rule.d.ts +6 -5
- package/lib/scene/level-rule.js +2 -2
- package/lib/scene/particles.d.ts +7 -3
- package/lib/scene/particles.js +3 -1
- package/lib/scene/post.d.ts +3 -2
- package/lib/scene/resources.d.ts +15 -9
- package/lib/scene/scene.d.ts +18 -2
- package/lib/scene/scene.js +47 -5
- package/lib/scene/time-of-day.d.ts +10 -5
- package/lib/scene/time-of-day.js +11 -7
- package/lib/shader-artifact.json +1 -1
- package/lib/shared/labels.d.ts +5 -2
- package/lib/shared/labels.js +5 -2
- package/lib/shared/permutation-words.d.ts +8 -0
- package/lib/shared/permutation-words.js +14 -0
- package/lib/shared/recording.d.ts +13 -5
- package/lib/shared/recording.js +31 -10
- package/lib/shared/sketch-data.d.ts +9 -0
- package/lib/shared/sketch-data.js +57 -0
- package/lib/shared/tier.d.ts +9 -0
- package/lib/shared/tier.js +4 -1
- package/lib/shared/version.d.ts +1 -1
- package/lib/shared/version.js +1 -1
- package/lib/sketch/define-sketch.d.ts +16 -7
- package/lib/sketch/define-sketch.js +2 -1
- package/lib/sketch/runner.d.ts +4 -0
- package/lib/sketch/runner.js +5 -0
- package/lib/sketch/ui.js +4 -2
- package/lib/stats.d.ts +1 -0
- package/lib/workers/protocol.d.ts +10 -0
- package/lib/workers/render-worker.js +4 -1
- package/lib/workers/sketch-worker.js +4 -1
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ const thread = globalThis;
|
|
|
26
26
|
* Every code, joined, so an error keeps its code before the file of fixes arrives. A test keeps it
|
|
27
27
|
* equal to the keys of the table.
|
|
28
28
|
*/
|
|
29
|
-
const CODES = '
|
|
29
|
+
const CODES = 'E1101E1102E1103E1104E1105E1106E1107E1108E1109E1110E1111E1112E1203E1204E1205E1206E1207E1208E1209E1213E1214E1215E1216E1217E1218E1219E1220E1221E1222E1223E1224E1225E1301E1302E1303E1304E1305E1306E1307E1308E1401E1402E1403E1404E1405E1406E1407E1408E1409E1410E1411E1412E1413E1414E1415E1416E1417E1418E1419E1420E1421E1422E1423E1424E1425E1426E1430E1431E1432E1433E1434E1435E1436E1437E1501E1502E1503E1504E1505E1506';
|
|
30
30
|
const waiting = [];
|
|
31
31
|
/** This copy's wait for the thread's load of the fixes, which settles its own waiting errors. */
|
|
32
32
|
let loading;
|
package/lib/errors/fixes.d.ts
CHANGED
package/lib/errors/fixes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Each error code's fix: the text that ends every EngineError message, and the only part of the
|
|
2
|
-
// error table that runtime code needs.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// error table that runtime code needs. A thread loads the table when it first reports an error, so
|
|
3
|
+
// the text does not weigh on a page's start. The rest of each code's docs text is in codes.ts,
|
|
4
|
+
// which only the docs generator and the tests import. Codes group by area: 11xx objects
|
|
5
5
|
// and handles, 12xx values, 13xx browsers and GPUs, 14xx setup and loading, 15xx rendering.
|
|
6
6
|
export const ERROR_FIXES = {
|
|
7
7
|
E1101: 'Stop using an object after you call destroy() on it. Look for places that still keep a reference, such as arrays of enemies or selection state.',
|
|
@@ -12,28 +12,28 @@ export const ERROR_FIXES = {
|
|
|
12
12
|
E1106: 'Fix the call that created the object. When the frame applied that call, the engine logged why it failed, such as E1101 for a parent that was already destroyed.',
|
|
13
13
|
E1107: 'This is an engine bug. Report it with the code that created the object.',
|
|
14
14
|
E1108: 'Pass a value inside the range that the message gives. For an instance batch, keep counts and indices within the capacity you created it with, or create a larger batch.',
|
|
15
|
-
E1109: '
|
|
15
|
+
E1109: 'Measure how near the scene comes to its limit with `engine.measure()`. Compare its `memory.wasmBytes` with `engine.mode.memoryMaximumMiB`, and add `?direct=on` to read the path that needs the most. Use less: share meshes, draw fewer rows, size each batch for its rows, and destroy batches you no longer draw. A scene that still needs more can ask for a larger maximum with the `memory` option of `createEngine()`.',
|
|
16
16
|
E1110: 'Change a static object with setPosition(), setRotation(), setScale() or another setter: each one marks the object for the engine to update. Code that writes values straight into engine memory needs a dynamic object, which the engine updates in every frame. For a row of a static batch, call markDirty(start, count) on the batch after you write its arrays, or create the batch with dynamic: true. If your code writes no engine memory, this is an engine bug: report it with the message.',
|
|
17
17
|
E1111: 'Destroy the objects and instance batches that use the mesh or model first, with destroy() on each. Then destroy the mesh or model, in the same frame or later. Destroying the group that scene.instantiate() returned takes the whole copy of a model. To keep an object and drop its mesh, give it another mesh with setMesh() first.',
|
|
18
18
|
E1112: 'Give a still 2D texture, such as one that assets.loadTexture, textures.fromImageBitmap or textures.fromData makes. A texture that changes every frame needs a cookie of its own, copied in each frame.',
|
|
19
|
-
E1203: 'Check the value computed before this call
|
|
19
|
+
E1203: 'Check the value computed before this call: NaN often comes from dividing zero by zero, or from normalizing a zero-length vector. Most calls check their numbers only in development builds, and a release build leaves the check out. The bad value then reaches the scene, and the frame draws wrong, or not at all, with no error. Scene queries such as raycasts check in every build.',
|
|
20
20
|
E1204: "Pass a hex string such as '#4a8cff', a number such as 0x4a8cff, or three linear components from 0 to 1, such as [0.07, 0.26, 1].",
|
|
21
21
|
E1205: "Use a KeyboardEvent.code name such as 'KeyW' or 'ArrowLeft', or a mouse button from 'Mouse0' to 'Mouse4'. Gamepad names start with 'Gamepad', such as 'GamepadA' or 'GamepadLeftStickUp'. Define an action with input.actions.define() before you use it, and give it a name that no key or button has. Objects take the pointer events 'click', 'pointerdown', 'pointerup', 'pointermove', 'pointerenter' and 'pointerleave'.",
|
|
22
|
-
E1206: 'Give positions and normals three numbers per vertex, uvs and uvs1 two, colors three or four, and tangents four. Give three indices per triangle, each below the vertex count
|
|
22
|
+
E1206: 'Give positions and normals three numbers per vertex, uvs and uvs1 two, colors three or four, and tangents four. Give three indices per triangle, each below the vertex count, or no indices and a vertex count that is a multiple of three. Pass normals or `computeNormals: true`, and pass uvs with `computeTangents: true`. Replace NaN and Infinity values.',
|
|
23
23
|
E1207: 'Pass a whole number whose bits name the layers: 1 << n is layer n. The operator | joins layers, so (1 << 0) | (1 << 3) is layers 0 and 3. Layers run from 0 to 31.',
|
|
24
24
|
E1208: "Give options from the texture's docs page, such as wrap: 'repeat', filter: 'nearest' or anisotropy: 8. Give fromDatafour numbers per texel: a Uint8Array for rgba8unorm, and a Uint16Array of half floats or a Float32Array for rgba16float. Resize images larger than textures.maxSize, and decode a closed image again. Encode a KTX2 file flipped instead of passing flipY: true, and load it again instead of updating its texture.",
|
|
25
25
|
E1209: "Give the material fewer textures. WebGL2 gives each shader stage at least 16 texture units, as many as the device reports, and the engine's lit shader reads most of them, so a custom material's own textures must fit in what is left. Use the standard material's own maps where they draw the effect.",
|
|
26
26
|
E1213: "Pass only the settings that the call has, each with a value that it takes. The call's docs page lists them.",
|
|
27
27
|
E1214: "Give fixedRate the fixed steps per second, a number above 0 such as 60 or 120. Give maxFixedSteps a whole number of 1 or more, such as 8. Give downloads an array of the files that the setup loads, each a URL or an address string such as 'models/ship.glb'.",
|
|
28
|
-
E1215: 'Add the null3D Vite plugin to vite.config.ts
|
|
29
|
-
E1216: 'Use the names of the fields of struct Uniforms in the WGSL
|
|
30
|
-
E1217: "Give alphaMode 'opaque', 'mask', 'hash' or 'blend', and blending 'normal', 'additive', 'multiply' or 'weighted'. three.js's transparent: true is alphaMode: 'blend', and its alphaTest is alphaMode: 'mask' with alphaCutoff.
|
|
31
|
-
E1218: "Use the names in animator.clips
|
|
28
|
+
E1215: 'Add the null3D Vite plugin to `vite.config.ts`. Write the WGSL in a template literal right after a `/* wgsl */` comment, or import it from a `.wgsl` file. Give each call the WGSL that its kind declares: the table on this page lists each declaration.',
|
|
29
|
+
E1216: 'Use the names of the fields of `struct Uniforms` in the WGSL, and the names of its texture declarations. Give each value the type that its declaration takes. Rename a field that has the name of a standard value, such as `color`. Give `post.setEffectUniform()` an effect that `post.addEffect()` returned.',
|
|
30
|
+
E1217: "Give alphaMode 'opaque', 'mask', 'hash' or 'blend', and blending 'normal', 'additive', 'multiply' or 'weighted'. three.js's transparent: true is alphaMode: 'blend', and its alphaTest is alphaMode: 'mask' with alphaCutoff. For a conflict between two options, follow the message, or read the rule for each kind of material on the E1217 docs page.",
|
|
31
|
+
E1218: "Use the names in `animator.clips`, and the joint names of the model's skeleton. Call `animator()` only on an object that a glTF file with animations created, and name clip events anything but `loop` and `finished`. Give `setMorphWeight` a target number below its geometry's `morphTargets`, or a name in its `morphTargetNames`. Trim or split a clip that holds keys hours apart, and keep layers, weights and fades inside the range that the message gives.",
|
|
32
32
|
E1219: "Give each label an id of its own, such as 'hp-12', and pass the same id to engine.labels.bind on the page. Give transform one of 'screen', 'world' or 'billboard', and a rotation only to a billboard label. Untrack labels that you no longer show with ui.untrackLabel. To track more labels at once, raise createEngine's maxLabels option, or maxLabels3d for labels that are planes of the scene.",
|
|
33
33
|
E1220: "Give render.addPass the options of its kind, such as { kind: 'scene', camera, writes: 'minimap', size: [256, 256] }. Give a compute pass a workgroup size that the shader declares and that a device runs, and a fallback for WebGL2. Give each pass a name and a texture name of its own. Remove passes that no longer draw before you add more.",
|
|
34
34
|
E1221: 'List the levels from the most detailed down, each with a larger error, a farther distance or a smaller coverage than the one before, at most 15 of them. Make each level from the same kind of arrays as the base mesh, with the same attributes, such as the same texture coordinates and tangents. Give a mesh that poses or moves its levels with setLevels, not buildLevels.',
|
|
35
35
|
E1222: "Make the grid's texture with LightProbeGridData.toTexture(), which a 3D texture alone holds, or with textures.fromVolumeData(). An image texture, or one made with textures.fromData() and a depth, is a texture array, which the probe grid cannot bind.",
|
|
36
|
-
E1223:
|
|
36
|
+
E1223: 'Give each feature and output a name of its own. Give a frame point and a kind that go together, and keep the order inside its band. Name resources, lighting slots and views from the lists, and give every output a neutral default. One feature provides each lighting slot, and a setting takes the values that its range allows.',
|
|
37
37
|
E1224: 'Give scene.overrideMaterial a material that draws meshes, from materials.standard(), materials.unlit(), materials.shader() or materials.decal(), or null to draw each mesh with its own material.',
|
|
38
38
|
E1225: "Give each add-on a namespace of its own: one name at declareAddonNamespace(), claimed once where the add-on's module loads, with the package that owns it. Let its shader library default to that name, keep its error codes inside 2000 to 9999, and give its quality keys names that the engine's table lacks. Give each feature, output and lighting slot a name that no other add-on registers. Two add-ons that share a name cannot load together.",
|
|
39
39
|
E1301: 'Remove a ?gpu= switch or createEngine gpu option that forces a path this browser lacks. Update the browser, or turn on hardware acceleration in its settings.',
|
|
@@ -42,23 +42,24 @@ export const ERROR_FIXES = {
|
|
|
42
42
|
E1304: 'Lower the quality preset, use smaller or compressed textures, and share meshes and textures between objects. Destroy objects and textures that the scene no longer shows.',
|
|
43
43
|
E1305: "Read the message: it quotes the GPU path. A buffer or texture past the device's limits names the limit: make the scene smaller there. Otherwise this is an engine bug: report it with the message and the browser.",
|
|
44
44
|
E1306: 'Update Safari to version 18 or later. On iPhone and iPad, update iOS or iPadOS to 18 or later, which updates the engine of every browser there.',
|
|
45
|
-
E1307: "
|
|
45
|
+
E1307: "Read the message: it names the pipeline and quotes the driver. If it names a custom material, shorten that material's WGSL, with fewer texture reads, loops and calls. On a device with little memory, use a lower quality preset, smaller textures and fewer objects. Update the browser and the device's system software, and report an engine template with the device.",
|
|
46
|
+
E1308: "Add 'webgl2' to the Vite plugin's shaders.gpuPaths option and build the page again, for a deployment whose devices may lack WebGPU. A build that ships one GPU path must always offer it.",
|
|
46
47
|
E1401: 'End the sketch module with export default defineSketch(...), and pass that module to createEngine.',
|
|
47
48
|
E1402: 'Reinstall the engine package so all of its parts come from one version. If you build the engine from source, run bun run build again.',
|
|
48
49
|
E1403: 'Create objects in the setup function you pass to defineSketch, or later, never when the sketch module loads.',
|
|
49
50
|
E1404: 'This is an engine bug. Report it with the message and the browser, then destroy the engine and start it again.',
|
|
50
|
-
E1405: "Read the message: it names the worker that did not start, and why. The sketch worker also reports an error that your sketch's setup function threw
|
|
51
|
+
E1405: "Read the message: it names the worker that did not start, and why. The sketch worker also reports an error that your sketch's setup function threw: fix the setup function. Otherwise, check that the page is served with the isolation headers and that the engine files load. Allow the workers in the `worker-src` of a Content-Security-Policy, and report the error if it repeats.",
|
|
51
52
|
E1406: "Check that the host serves every file that the build wrote, at the paths that the build gave them. The engine's .wasm files, the KTX2 transcoder's files, the glTF loader's files, the meshopt decoder and the level planner's simplifier are among them. If the page loads at other times, the network dropped: reload the page.",
|
|
52
53
|
E1407: 'Give the sketch time to hold at in seconds, such as ?hold=1.5 or hold: 1.5. A bare ?hold holds at the time of the hold option, or at 0 without one.',
|
|
53
54
|
E1408: 'Fix the error that the message quotes. When the message gives a sketch time, the sketch failed at that time, and the console shows the error with its stack.',
|
|
54
55
|
E1409: 'Give memory.maximumMiB a whole number of MiB from 256 to 4096, such as 2048, or leave the option out for the default of 1024.',
|
|
55
56
|
E1410: "Pass the sketch as new URL('./sketch.ts', import.meta.url), so that the bundler ships the module and the engine finds it. When the download worked, the module's own code threw the error that the message quotes while the module loaded: fix that error.",
|
|
56
57
|
E1411: "Check the file's address: a relative address resolves against the page's address, and new URL('./file.png', import.meta.url) resolves against the sketch module's. Check that the server sends the file, and handle the error where the file is optional.",
|
|
57
|
-
E1412: 'Give loadTexture and loadImageBitmap a PNG, JPEG or WebP file, or an AVIF file in
|
|
58
|
+
E1412: 'Give `loadTexture` and `loadImageBitmap` a PNG, JPEG or WebP file, or an AVIF file in a browser that decodes AVIF. Give `loadTexture` KTX2 files of 2D ETC1S or UASTC data, as basisu writes them. Give `loadJson` valid JSON, and check that the server sends the file itself, not an error page. Save KTX2 textures no larger than `textures.maxSize` on each side.',
|
|
58
59
|
E1413: "Serve the file from the same origin as the page, or have its server send Access-Control-Allow-Origin with the page's origin or *. On a page with Cross-Origin-Embedder-Policy: require-corp, the file needs that header too.",
|
|
59
60
|
E1414: 'Call engine.capture() while the engine runs, before destroy(). When the message names a GPU failure, wait for the engine to recover from it and call capture() again. When it says that the worker did not answer, the thread that draws is stuck, often inside a GPU call that never returned: reload the page, or start another engine on another canvas.',
|
|
60
61
|
E1415: "Stop the other engine with destroy() and wait for its promise before you start this one. To run both at once, leave out sketchThread: 'main' on one of them, so that its sketch runs in a worker.",
|
|
61
|
-
E1416: 'Check that the file is a glTF 2.0 model
|
|
62
|
+
E1416: 'Check that the file is a glTF 2.0 model: a .glb file, or a .gltf file with its buffers and images beside it. For a broken file, open it in the Khronos glTF Validator and export it again. For a skeleton that is too large, export each character to its own file. For a file over a size limit, split it or simplify its meshes.',
|
|
62
63
|
E1417: 'Export the model again without the extension that the message names, or import the add-on that the message names and register its handler on assets. Call createInstances with a model that has meshes and no instancing of its own, or with one of its meshes and a material.',
|
|
63
64
|
E1418: "Add 'wasm-unsafe-eval' to the script-src of the page's Content-Security-Policy, for example script-src 'self' 'wasm-unsafe-eval'. It allows WebAssembly and no JavaScript eval. The hosting page of the docs gives the whole policy that the engine needs.",
|
|
64
65
|
E1419: "Wait for the other engine's destroy() promise before you start a new engine on its canvas. In React, call destroy() in the effect's cleanup. When the message says that no engine can draw on the canvas again, put a new canvas element in its place.",
|
|
@@ -73,11 +74,11 @@ export const ERROR_FIXES = {
|
|
|
73
74
|
E1431: "Serve the engine's area-light-tables.bin file at the address that the message names. A build with the null3D Vite plugin copies it beside the engine's code: deploy it with the rest of the build. When the engine's files come from another origin, that server must send Access-Control-Allow-Origin, and the page's connect-src must allow the origin.",
|
|
74
75
|
E1432: "Run bunx @null3d/cli upgrade in the project's folder, then bun install, so that every null3D package takes one version. An add-on that the project builds itself names the engine version that the project develops against.",
|
|
75
76
|
E1433: "Install the release of the add-on that matches this engine's plugin interface, or run the project on an engine whose plugin interface the add-on declares. The engine's own add-ons need no range: run bunx @null3d/cli upgrade, then bun install, so that each one takes the engine's version.",
|
|
76
|
-
E1434: "Read the fault that the message names in the baked light file. Write version 1 of the format, which docs/guides/baked-light-data.md describes: a JSON object with the marker null3d.baked-light, the version, the kind, and the base64 payloads that its kind needs. Make each payload's length match the counts or the size that the same file gives. Read the file to its end, since a file cut short has no complete JSON.",
|
|
77
|
+
E1434: "Read the fault that the message names in the baked light file. Write version 1 of the format, which https://github.com/null3d-engine/null3d/blob/generated/docs/guides/baked-light-data.md describes: a JSON object with the marker null3d.baked-light, the version, the kind, and the base64 payloads that its kind needs. Make each payload's length match the counts or the size that the same file gives. Read the file to its end, since a file cut short has no complete JSON.",
|
|
77
78
|
E1435: "Record the session again with the engine that recorded it, or update the engine that reads the file. When the message names a sketch, open the page with that sketch: a replay runs the file's frames on the scene that recorded them. When it names a key or a fixed step rate, the recording came from a sketch that this engine cannot run as it ran. A replay starts at the file's first frame, so a file must come from a session that started at the page's first frame.",
|
|
78
79
|
E1436: 'Ask for the pick again: the engine started a new GPU device, which answers a new pick. A pick that waits when the device is lost is rejected rather than repeated, because the frame that recorded it drew on the lost device.',
|
|
79
|
-
E1437: "Run the command again
|
|
80
|
-
E1501: 'Share meshes and
|
|
80
|
+
E1437: "Run the command again: a download that broke off, or that something changed on the way, fails the check. If the check fails again, a proxy or a mirror between this computer and Google's storage changes the file, so download without it. A refused archive is a warning, and stops the command only when `NULL3D_CHROME=testing` asks for Chrome for Testing alone. A platform with no Chrome for Testing build draws with the installed Google Chrome, or with Playwright's Chromium when `CI=1` is set.",
|
|
81
|
+
E1501: 'Share meshes, materials and textures between objects instead of creating them per object. Draw many copies of one mesh with an instance batch, and size each batch for the rows it uses. For a large crowd of skinned characters on WebGPU, use models with fewer vertices or fewer copies. The crowd draws again once it fits.',
|
|
81
82
|
E1502: "Name in reads only the textures that your other passes write, as their writes option spells them. Add the pass that writes a texture before a pass that reads it, and remove a pass that reads a texture before the pass that writes it. If the message names only the engine's own passes, report it with the message, the browser and the quality preset.",
|
|
82
83
|
E1503: "Give each pass's texture a name that no other pass writes. The engine's own passes write sceneColor, sceneDepth, outlineMask and the other names that render.dumpGraph() shows, so pick another name.",
|
|
83
84
|
E1504: 'Break the loop: a pass cannot read its own texture. To show a mirror in a mirror, add a pass for the inner mirror first, and let the outer pass read its texture.',
|
|
@@ -4,3 +4,9 @@
|
|
|
4
4
|
* engine names the word and the list that must carry it.
|
|
5
5
|
*/
|
|
6
6
|
export declare const LISTED_PERMUTATIONS: readonly number[] | null;
|
|
7
|
+
/**
|
|
8
|
+
* The GPU paths whose shaders this build ships, or null when it ships both. A build
|
|
9
|
+
* that ships one path drops the other path's shader files, and the engine names this
|
|
10
|
+
* build's choice when a device would need a path that it lacks.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SHIPPED_GPU_PATHS: readonly ('webgpu' | 'webgl2')[] | null;
|
|
@@ -7,3 +7,9 @@
|
|
|
7
7
|
* engine names the word and the list that must carry it.
|
|
8
8
|
*/
|
|
9
9
|
export const LISTED_PERMUTATIONS = null;
|
|
10
|
+
/**
|
|
11
|
+
* The GPU paths whose shaders this build ships, or null when it ships both. A build
|
|
12
|
+
* that ships one path drops the other path's shader files, and the engine names this
|
|
13
|
+
* build's choice when a device would need a path that it lacks.
|
|
14
|
+
*/
|
|
15
|
+
export const SHIPPED_GPU_PATHS = null;
|
package/lib/gpu/variants.d.ts
CHANGED
|
@@ -10,7 +10,13 @@ export declare function variantFor<Pipeline extends string>(shader: ShaderVarian
|
|
|
10
10
|
/**
|
|
11
11
|
* The message for a pipeline whose variant no loaded module holds. A variant that loads on first
|
|
12
12
|
* use is absent until its module arrives, so only a caller that has waited for every module calls
|
|
13
|
-
* this. A set narrowed to a
|
|
14
|
-
* that its manifest cannot make.
|
|
13
|
+
* this. A set narrowed to a project's list names the word to add, as the list writes it, without
|
|
14
|
+
* the bits that a device fixes. A full set names the word that its manifest cannot make.
|
|
15
15
|
*/
|
|
16
16
|
export declare function missingVariant(permutation: number, listed?: boolean): string;
|
|
17
|
+
/**
|
|
18
|
+
* The message for an engine pass whose shader, which the device's modules hold from the start, no
|
|
19
|
+
* module holds with the word `permutation`. A set narrowed to a project's list names the word
|
|
20
|
+
* that the list lacks, as `missingVariant` does.
|
|
21
|
+
*/
|
|
22
|
+
export declare function missingShader(name: string, permutation: number, listed?: boolean): string;
|
package/lib/gpu/variants.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// backend builds a render pipeline from the variant that the pipeline's permutation word names.
|
|
4
4
|
import { PERMUTATION_DRAW_INDEX, PERMUTATION_HALF, PERMUTATION_TONE_MAP } from '../generated/gpu.js';
|
|
5
5
|
import { LISTED_PERMUTATIONS } from '../generated/shader-permutations.js';
|
|
6
|
+
import { DEV } from '../shared/dev.js';
|
|
6
7
|
/** The variant built with exactly the bits of `permutation`, with output for `target`. */
|
|
7
8
|
function exactly(shader, permutation, target) {
|
|
8
9
|
for (const name in shader) {
|
|
@@ -36,6 +37,20 @@ export function stopRecordingPermutations() {
|
|
|
36
37
|
recorded = undefined;
|
|
37
38
|
return words;
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* In a development build, the words that this thread has reported, and where it reports each new
|
|
42
|
+
* one. The dev server compares them with the project's shader list, so a word that a production
|
|
43
|
+
* build with the list lacks shows while the page runs, not first in the built page.
|
|
44
|
+
*/
|
|
45
|
+
let reporting;
|
|
46
|
+
/**
|
|
47
|
+
* @internal In a development build, hands `report` each permutation word that a pipeline finds
|
|
48
|
+
* from now on, once per word, as a recording lists it. A production build reports nothing.
|
|
49
|
+
*/
|
|
50
|
+
export function reportPermutations(report) {
|
|
51
|
+
if (DEV)
|
|
52
|
+
reporting = { words: new Set(), report };
|
|
53
|
+
}
|
|
39
54
|
/**
|
|
40
55
|
* The variant of a shader for a pipeline's permutation word, with output for `target`, or
|
|
41
56
|
* undefined when the shader has none. The word never holds the half precision bit, which the
|
|
@@ -49,19 +64,36 @@ export function variantFor(shader, permutation, target) {
|
|
|
49
64
|
const found = exactly(shader, half, target) ?? exactly(shader, permutation, target);
|
|
50
65
|
// A recording lists the words that the scene draws with, so a narrowed build builds them. The
|
|
51
66
|
// bits a device fixes are left out, so one list holds the words of every device module.
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
// A development build reports the same words to the dev server.
|
|
68
|
+
if (found !== undefined) {
|
|
69
|
+
const word = (permutation & ~DEVICE_BITS) >>> 0;
|
|
70
|
+
recorded?.add(word);
|
|
71
|
+
if (DEV && reporting !== undefined && !reporting.words.has(word)) {
|
|
72
|
+
reporting.words.add(word);
|
|
73
|
+
reporting.report(word);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
54
76
|
return found;
|
|
55
77
|
}
|
|
56
78
|
/**
|
|
57
79
|
* The message for a pipeline whose variant no loaded module holds. A variant that loads on first
|
|
58
80
|
* use is absent until its module arrives, so only a caller that has waited for every module calls
|
|
59
|
-
* this. A set narrowed to a
|
|
60
|
-
* that its manifest cannot make.
|
|
81
|
+
* this. A set narrowed to a project's list names the word to add, as the list writes it, without
|
|
82
|
+
* the bits that a device fixes. A full set names the word that its manifest cannot make.
|
|
61
83
|
*/
|
|
62
84
|
export function missingVariant(permutation, listed = LISTED_PERMUTATIONS !== null) {
|
|
63
|
-
|
|
85
|
+
if (!listed)
|
|
86
|
+
return `the shader set has no variant for the permutation word 0x${(permutation >>> 0).toString(16)}.`;
|
|
87
|
+
const word = `0x${((permutation & ~DEVICE_BITS) >>> 0).toString(16).padStart(8, '0')}`;
|
|
88
|
+
return `the shader set holds only the permutation words of the project's shader list, and this pipeline asks for ${word}, which the list lacks. Record the pages again with bunx @null3d/cli shaders record so that the word reaches the list, or add ${word} to the list by hand, and build again.`;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The message for an engine pass whose shader, which the device's modules hold from the start, no
|
|
92
|
+
* module holds with the word `permutation`. A set narrowed to a project's list names the word
|
|
93
|
+
* that the list lacks, as `missingVariant` does.
|
|
94
|
+
*/
|
|
95
|
+
export function missingShader(name, permutation, listed = LISTED_PERMUTATIONS !== null) {
|
|
64
96
|
return listed
|
|
65
|
-
? `the
|
|
66
|
-
: `the shader
|
|
97
|
+
? `the ${name} shader is missing: ${missingVariant(permutation, true)}`
|
|
98
|
+
: `the device's shader modules have no ${name} shader`;
|
|
67
99
|
}
|
|
@@ -289,7 +289,7 @@ export function createProgram(gl, template, permutation) {
|
|
|
289
289
|
const shading = variantFor(template.shader, build, 'glsl')?.glsl?.[template.pipeline];
|
|
290
290
|
const source = shading && build !== permutation ? { ...shading, fragment: PREPASS_FRAGMENT } : shading;
|
|
291
291
|
if (!source)
|
|
292
|
-
throw new Error(`a render pipeline template: ${missingVariant(
|
|
292
|
+
throw new Error(`a render pipeline template: ${missingVariant(build)}`);
|
|
293
293
|
const { program, shaders } = link(gl, source, '');
|
|
294
294
|
return {
|
|
295
295
|
program,
|
|
@@ -8,7 +8,7 @@ import { DEBUG_LINES_SHADER, DEBUG_VIEW_SHADER, MOTION_VIEW_SHADER, } from '../.
|
|
|
8
8
|
import { LINE_VERTICES } from '../line-vertices.js';
|
|
9
9
|
import { PARTICLE_RECORDS } from '../particle-records.js';
|
|
10
10
|
import { pipelineName } from '../pipeline-name.js';
|
|
11
|
-
import { missingVariant, variantFor } from '../variants.js';
|
|
11
|
+
import { missingShader, missingVariant, variantFor } from '../variants.js';
|
|
12
12
|
import { plainScale, variantLocations, vertexAttribute, vertexStride, } from '../vertex-format.js';
|
|
13
13
|
/**
|
|
14
14
|
* True in development builds, which add the debug views' templates. This file reads the constant
|
|
@@ -1693,7 +1693,7 @@ export class Pipelines {
|
|
|
1693
1693
|
const build = ownPrepass && !cutoutPrepass ? (permutation & ~PERMUTATION_PREPASS) >>> 0 : permutation;
|
|
1694
1694
|
const shader = variantFor(t.shader, build, 'wgsl')?.wgsl;
|
|
1695
1695
|
if (!shader)
|
|
1696
|
-
throw new Error(`render template ${template}: ${missingVariant(
|
|
1696
|
+
throw new Error(`render template ${template}: ${missingVariant(build)}`);
|
|
1697
1697
|
const module = this.module(t.label, shader);
|
|
1698
1698
|
const entryPoints = shader.pipelines[t.pipeline];
|
|
1699
1699
|
const skins = (permutation & PERMUTATION_SKIN) !== 0;
|
|
@@ -1837,7 +1837,7 @@ export class Pipelines {
|
|
|
1837
1837
|
mipDescriptor(format, entry) {
|
|
1838
1838
|
const shader = this.mipmap;
|
|
1839
1839
|
if (!shader)
|
|
1840
|
-
throw new Error(
|
|
1840
|
+
throw new Error(missingShader('mip level', 0));
|
|
1841
1841
|
const module = this.module('mipmaps', shader);
|
|
1842
1842
|
const entryPoints = shader.pipelines[entry];
|
|
1843
1843
|
return {
|
|
@@ -1895,7 +1895,7 @@ export class Pipelines {
|
|
|
1895
1895
|
const color = (permutation & PERMUTATION_VERTEX_COLOR) !== 0 ? ' color' : '';
|
|
1896
1896
|
const shader = variantFor(this.skin, permutation, 'wgsl')?.wgsl;
|
|
1897
1897
|
if (!shader)
|
|
1898
|
-
throw new Error(
|
|
1898
|
+
throw new Error(missingShader('skinning', permutation));
|
|
1899
1899
|
const constants = this.floatSkinnedDirections ? { [NARROW_DIRECTIONS_ID]: 0 } : undefined;
|
|
1900
1900
|
return {
|
|
1901
1901
|
label: `skin${tangent}${color}`,
|
|
@@ -1906,7 +1906,7 @@ export class Pipelines {
|
|
|
1906
1906
|
if (template === TEMPLATE_CULL && permutation & PERMUTATION_MOTION) {
|
|
1907
1907
|
const shader = variantFor(this.cullMotion, permutation, 'wgsl')?.wgsl;
|
|
1908
1908
|
if (!shader)
|
|
1909
|
-
throw new Error(
|
|
1909
|
+
throw new Error(missingShader('motion culling', permutation));
|
|
1910
1910
|
return {
|
|
1911
1911
|
label: 'cull motion',
|
|
1912
1912
|
layout: this.cullLayout,
|
|
@@ -1915,7 +1915,7 @@ export class Pipelines {
|
|
|
1915
1915
|
}
|
|
1916
1916
|
if (template === TEMPLATE_CULL) {
|
|
1917
1917
|
if (!this.cull)
|
|
1918
|
-
throw new Error(
|
|
1918
|
+
throw new Error(missingShader('culling', 0));
|
|
1919
1919
|
return {
|
|
1920
1920
|
label: 'cull',
|
|
1921
1921
|
layout: this.cullLayout,
|
|
@@ -1926,7 +1926,7 @@ export class Pipelines {
|
|
|
1926
1926
|
if (phase) {
|
|
1927
1927
|
const shader = variantFor(this.occlusion, 0, 'wgsl')?.wgsl;
|
|
1928
1928
|
if (!shader)
|
|
1929
|
-
throw new Error(
|
|
1929
|
+
throw new Error(missingShader('occlusion culling', 0));
|
|
1930
1930
|
return {
|
|
1931
1931
|
label: `occlusion ${phase}`,
|
|
1932
1932
|
layout: this.cullLayout,
|
|
@@ -1936,7 +1936,7 @@ export class Pipelines {
|
|
|
1936
1936
|
if (template === TEMPLATE_CLUSTER) {
|
|
1937
1937
|
const shader = this.cluster ? variantFor(this.cluster, 0, 'wgsl')?.wgsl : undefined;
|
|
1938
1938
|
if (!shader)
|
|
1939
|
-
throw new Error(
|
|
1939
|
+
throw new Error(missingShader('cluster', 0));
|
|
1940
1940
|
return {
|
|
1941
1941
|
label: 'cluster cull',
|
|
1942
1942
|
layout: this.clusterLayout,
|
|
@@ -1946,7 +1946,7 @@ export class Pipelines {
|
|
|
1946
1946
|
if (template === TEMPLATE_DEPTH_PYRAMID) {
|
|
1947
1947
|
const shader = variantFor(this.pyramid, 0, 'wgsl')?.wgsl;
|
|
1948
1948
|
if (!shader)
|
|
1949
|
-
throw new Error(
|
|
1949
|
+
throw new Error(missingShader('depth pyramid', 0));
|
|
1950
1950
|
return {
|
|
1951
1951
|
label: 'depth pyramid',
|
|
1952
1952
|
layout: this.pyramidLayout,
|
|
@@ -1956,7 +1956,7 @@ export class Pipelines {
|
|
|
1956
1956
|
if (template === TEMPLATE_FEATURE_ROWS) {
|
|
1957
1957
|
const shader = variantFor(this.featureRows, 0, 'wgsl')?.wgsl;
|
|
1958
1958
|
if (!shader)
|
|
1959
|
-
throw new Error(
|
|
1959
|
+
throw new Error(missingShader('feature rows', 0));
|
|
1960
1960
|
this.featureRowsLayout ??= this.device.createPipelineLayout({
|
|
1961
1961
|
bindGroupLayouts: [this.layout(LAYOUT_FEATURE_ROWS)],
|
|
1962
1962
|
});
|
|
@@ -1970,7 +1970,7 @@ export class Pipelines {
|
|
|
1970
1970
|
if (exposureEntry) {
|
|
1971
1971
|
const shader = variantFor(this.exposureHistogram, 0, 'wgsl')?.wgsl;
|
|
1972
1972
|
if (!shader)
|
|
1973
|
-
throw new Error(
|
|
1973
|
+
throw new Error(missingShader('exposure histogram', 0));
|
|
1974
1974
|
this.exposureLayout ??= this.device.createPipelineLayout({
|
|
1975
1975
|
bindGroupLayouts: [this.layout(LAYOUT_EXPOSURE)],
|
|
1976
1976
|
});
|
|
@@ -1988,7 +1988,7 @@ export class Pipelines {
|
|
|
1988
1988
|
const clear = template === TEMPLATE_LIGHT_DEPTH_CLEAR || template === TEMPLATE_LIGHT_DEPTH_CLEAR_MS;
|
|
1989
1989
|
const shader = multisampled ? this.lightDepthMs : this.lightDepth;
|
|
1990
1990
|
if (!shader)
|
|
1991
|
-
throw new Error(
|
|
1991
|
+
throw new Error(missingShader('light depth', 0));
|
|
1992
1992
|
return {
|
|
1993
1993
|
label: clear ? 'light depth clear' : 'light depth',
|
|
1994
1994
|
layout: multisampled ? this.lightDepthMsLayout : this.lightDepthLayout,
|
|
@@ -2003,7 +2003,7 @@ export class Pipelines {
|
|
|
2003
2003
|
throw new Error(`unknown compute template ${template}`);
|
|
2004
2004
|
const shader = this.lightClusters;
|
|
2005
2005
|
if (!shader)
|
|
2006
|
-
throw new Error(
|
|
2006
|
+
throw new Error(missingShader('light clustering', 0));
|
|
2007
2007
|
return {
|
|
2008
2008
|
label: entryPoint,
|
|
2009
2009
|
layout: this.lightLayout,
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { Debug, DebugGridOptions, DebugLightOptions, DebugView, DebugViewName, } from './debug/debug.js';
|
|
2
2
|
export type { FrameStats, FrameStatsStep, FrameStatsThread } from './debug/stats.js';
|
|
3
|
-
export type { StatsOverlayOptions } from './debug/stats-options.js';
|
|
3
|
+
export type { StatsCorner, StatsOverlayOptions } from './debug/stats-options.js';
|
|
4
4
|
export type { EngineDebugView } from './debug/view-names.js';
|
|
5
5
|
export { EngineError } from './errors/engine-error.js';
|
|
6
6
|
export type { ErrorCode } from './errors/fixes.js';
|
|
@@ -31,7 +31,7 @@ export interface WebGPUReport {
|
|
|
31
31
|
* True when the start-up probe measured the device drawing a bucket faster with direct draws
|
|
32
32
|
* than with the engine's indirect draws, so the engine draws directly. The probe runs on a
|
|
33
33
|
* worker's device, and only on an Apple GPU in WebKit, whose validation of each indirect draw
|
|
34
|
-
* the direct path removes
|
|
34
|
+
* the direct path removes. False on WebGL2.
|
|
35
35
|
*/
|
|
36
36
|
directDraws: boolean;
|
|
37
37
|
/** Why the probe chose that draw path, or why it did not measure. */
|
package/lib/page/engine.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { type QualityPreset } from '../quality/presets.js';
|
|
|
7
7
|
import type { GpuErrorKind } from '../render/loss.js';
|
|
8
8
|
import type { Tier } from '../render/renderer.js';
|
|
9
9
|
import type { ReplayResult } from '../shared/recording.js';
|
|
10
|
+
import { type GpuPath } from '../shared/tier.js';
|
|
10
11
|
import type { QualityUpdate } from '../sketch/quality.js';
|
|
11
12
|
import type { LabelSlotSender } from '../sketch/ui.js';
|
|
12
13
|
import type { RendererRequest, WorkerReply } from '../workers/protocol.js';
|
|
@@ -33,6 +34,15 @@ export interface EngineOptions {
|
|
|
33
34
|
canvas: HTMLCanvasElement;
|
|
34
35
|
/** The sketch module, which runs in the sketch worker; `new URL('./sketch.ts', import.meta.url)`. */
|
|
35
36
|
sketch: URL | string;
|
|
37
|
+
/**
|
|
38
|
+
* Start data for the sketch, which its setup reads as `ctx.data`: the state that the page knows
|
|
39
|
+
* before the scene starts, such as the section that the address names, a saved color mode or a
|
|
40
|
+
* level number. It reaches the setup before the first frame, also in hold mode, where no message
|
|
41
|
+
* can. It takes plain JSON data: objects, arrays, strings, finite numbers, booleans and null, up
|
|
42
|
+
* to 64 KiB as JSON. Another value fails with E1213. A recording keeps it, and a replay gives
|
|
43
|
+
* the sketch the recorded data.
|
|
44
|
+
*/
|
|
45
|
+
sketchData?: unknown;
|
|
36
46
|
/**
|
|
37
47
|
* The quality preset: `auto`, the default, lets the engine choose one for the device, and
|
|
38
48
|
* `low`, `medium`, `high` or `ultra` names one. The GPU path caps it: WebGL2 and WebGPU's
|
|
@@ -200,8 +210,8 @@ export interface EngineOptions {
|
|
|
200
210
|
transparent?: boolean;
|
|
201
211
|
/**
|
|
202
212
|
* False draws the scene into 8-bit color, where each material's shader applies the output
|
|
203
|
-
* transform, instead of HDR color, which the final pass tone maps. Both paths
|
|
204
|
-
* material's `toneMapped: false`, and the 8-bit path also
|
|
213
|
+
* transform, instead of HDR color, which the final pass tone maps. Both paths honor a
|
|
214
|
+
* material's `toneMapped: false`, and the 8-bit path also honors it on a blended surface. The
|
|
205
215
|
* default lets the engine pick the path from the device, which draws HDR color wherever it
|
|
206
216
|
* can. The `?hdr=off` switch takes the 8-bit path too.
|
|
207
217
|
*/
|
|
@@ -640,12 +650,12 @@ export interface Engine {
|
|
|
640
650
|
*/
|
|
641
651
|
inspect?(call: string, args?: unknown): Promise<unknown>;
|
|
642
652
|
/**
|
|
643
|
-
* Shows an overlay of figures over
|
|
653
|
+
* Shows an overlay of figures over a right-hand corner of the canvas, or hides it with
|
|
644
654
|
* `false`: the GPU path, the frame rates, CPU time per frame of each thread, GPU time, draw
|
|
645
655
|
* calls, triangles and objects drawn, memory, and the page thread's long tasks and input delay.
|
|
646
656
|
* Its header is a button with the frame rate, which shows and hides the other figures. Options
|
|
647
|
-
* pick whether the overlay starts collapsed to its header
|
|
648
|
-
* the options it names. The page draws the overlay and updates it a few times a second, and its
|
|
657
|
+
* pick whether the overlay starts collapsed to its header, and its corner: the top right by
|
|
658
|
+
* default, or the bottom right. A call on a shown overlay changes the options it names. The page draws the overlay and updates it a few times a second, and its
|
|
649
659
|
* code downloads at the first call. While the other figures show, the engine times one frame in
|
|
650
660
|
* eleven on the GPU and reads back the counts of the objects that the GPU culls, which costs a
|
|
651
661
|
* little GPU time. The sketch's `debug.stats` shows and hides the same overlay, and the last
|
|
@@ -752,8 +762,20 @@ interface TierChoice {
|
|
|
752
762
|
tier: Tier;
|
|
753
763
|
forceCompat: boolean;
|
|
754
764
|
}
|
|
755
|
-
/**
|
|
756
|
-
export declare function
|
|
765
|
+
/** True when this build holds the shaders of `path`. */
|
|
766
|
+
export declare function shipsPath(path: GpuPath): boolean;
|
|
767
|
+
/**
|
|
768
|
+
* Picks the GPU tier from feature tests, never from browser or GPU names. A path whose shaders this
|
|
769
|
+
* build does not ship counts as unavailable, whether or not the browser offers it.
|
|
770
|
+
*/
|
|
771
|
+
export declare function chooseTier(report: CapabilityReport, wanted: GpuSwitch, inWorker: boolean, ships?: (path: GpuPath) => boolean): TierChoice | null;
|
|
772
|
+
/**
|
|
773
|
+
* The error for a start that found no usable GPU tier. When the build holds the shaders of one path
|
|
774
|
+
* and this start would draw with the other, it names the build's choice (E1308), because no browser
|
|
775
|
+
* or setting can fix that page. Otherwise the browser offers no path the engine can draw with, or
|
|
776
|
+
* none that the page asked for (E1301).
|
|
777
|
+
*/
|
|
778
|
+
export declare function noTierError(report: CapabilityReport, requested: GpuSwitch, inWorker: boolean, ships?: (path: GpuPath) => boolean): EngineError;
|
|
757
779
|
/**
|
|
758
780
|
* The error of a worker that failed to start. An engine error keeps its code and message; any
|
|
759
781
|
* other failure becomes E1405.
|