@null3d/engine 0.0.0-stage → 0.0.0
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/LICENSE-APACHE +176 -0
- package/LICENSE-MIT +21 -0
- package/THIRD-PARTY-NOTICES.txt +638 -0
- package/dist/wasm/single/null3d.js +3959 -0
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +3975 -0
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +536 -0
- package/docs/api/assets.md +384 -0
- package/docs/api/cameras.md +159 -0
- package/docs/api/controls.md +317 -0
- package/docs/api/debug.md +445 -0
- package/docs/api/engine.md +248 -0
- package/docs/api/feature-draws.md +172 -0
- package/docs/api/feature-effects.md +137 -0
- package/docs/api/feature-instances.md +154 -0
- package/docs/api/features.md +324 -0
- package/docs/api/geometry.md +326 -0
- package/docs/api/grass.md +114 -0
- package/docs/api/impostors.md +163 -0
- package/docs/api/input.md +245 -0
- package/docs/api/lights.md +290 -0
- package/docs/api/lines.md +180 -0
- package/docs/api/materials.md +876 -0
- package/docs/api/math.md +130 -0
- package/docs/api/objects.md +155 -0
- package/docs/api/page.md +97 -0
- package/docs/api/particles.md +217 -0
- package/docs/api/points.md +152 -0
- package/docs/api/post.md +495 -0
- package/docs/api/quality.md +195 -0
- package/docs/api/raycast.md +288 -0
- package/docs/api/reference/animation.md +158 -0
- package/docs/api/reference/assets.md +335 -0
- package/docs/api/reference/cameras.md +135 -0
- package/docs/api/reference/controls.md +411 -0
- package/docs/api/reference/debug.md +571 -0
- package/docs/api/reference/engine.md +635 -0
- package/docs/api/reference/feature-draws.md +94 -0
- package/docs/api/reference/feature-effects.md +32 -0
- package/docs/api/reference/feature-instances.md +63 -0
- package/docs/api/reference/features.md +361 -0
- package/docs/api/reference/geometry.md +777 -0
- package/docs/api/reference/grass.md +131 -0
- package/docs/api/reference/impostors.md +277 -0
- package/docs/api/reference/input.md +121 -0
- package/docs/api/reference/lights.md +257 -0
- package/docs/api/reference/lines.md +84 -0
- package/docs/api/reference/materials.md +375 -0
- package/docs/api/reference/math.md +229 -0
- package/docs/api/reference/objects.md +103 -0
- package/docs/api/reference/particles.md +336 -0
- package/docs/api/reference/points.md +57 -0
- package/docs/api/reference/post.md +244 -0
- package/docs/api/reference/quality.md +209 -0
- package/docs/api/reference/raycast.md +94 -0
- package/docs/api/reference/render.md +238 -0
- package/docs/api/reference/scene.md +540 -0
- package/docs/api/reference/sketch.md +121 -0
- package/docs/api/reference/splats.md +214 -0
- package/docs/api/reference/sprites.md +71 -0
- package/docs/api/reference/tasks.md +92 -0
- package/docs/api/reference/terrain.md +160 -0
- package/docs/api/reference/textures.md +153 -0
- package/docs/api/reference/three-compat.md +60 -0
- package/docs/api/reference/time.md +25 -0
- package/docs/api/reference/ui.md +52 -0
- package/docs/api/reference/vertex-draws.md +55 -0
- package/docs/api/reference/water.md +359 -0
- package/docs/api/reference/wind.md +106 -0
- package/docs/api/render.md +497 -0
- package/docs/api/scene.md +595 -0
- package/docs/api/sketch.md +170 -0
- package/docs/api/splats.md +257 -0
- package/docs/api/sprites.md +185 -0
- package/docs/api/tasks.md +106 -0
- package/docs/api/terrain.md +130 -0
- package/docs/api/textures.md +272 -0
- package/docs/api/three-compat.md +102 -0
- package/docs/api/time.md +134 -0
- package/docs/api/ui.md +146 -0
- package/docs/api/vertex-draws.md +171 -0
- package/docs/api/water.md +303 -0
- package/docs/api/wind.md +375 -0
- package/docs/cli/null3d.md +528 -0
- package/docs/concepts/architecture.md +174 -0
- package/docs/concepts/assets.md +145 -0
- package/docs/concepts/backends.md +195 -0
- package/docs/concepts/color-management.md +145 -0
- package/docs/concepts/culling.md +227 -0
- package/docs/concepts/handles.md +93 -0
- package/docs/concepts/instances.md +285 -0
- package/docs/concepts/large-worlds.md +126 -0
- package/docs/concepts/lighting.md +592 -0
- package/docs/concepts/lod.md +254 -0
- package/docs/concepts/materials.md +128 -0
- package/docs/concepts/particle-buffer.md +201 -0
- package/docs/concepts/post-processing.md +442 -0
- package/docs/concepts/quality-preset-tables.md +91 -0
- package/docs/concepts/quality-presets.md +312 -0
- package/docs/concepts/render-graph.md +217 -0
- package/docs/concepts/render-layers.md +125 -0
- package/docs/concepts/shadows.md +466 -0
- package/docs/concepts/static-dynamic.md +113 -0
- package/docs/cookbook/index.md +664 -0
- package/docs/data/threejs-mapping.json +2118 -0
- package/docs/errors/E1101.md +23 -0
- package/docs/errors/E1102.md +23 -0
- package/docs/errors/E1103.md +23 -0
- package/docs/errors/E1104.md +23 -0
- package/docs/errors/E1105.md +23 -0
- package/docs/errors/E1106.md +23 -0
- package/docs/errors/E1107.md +23 -0
- package/docs/errors/E1108.md +23 -0
- package/docs/errors/E1109.md +23 -0
- package/docs/errors/E1110.md +23 -0
- package/docs/errors/E1111.md +23 -0
- package/docs/errors/E1112.md +23 -0
- package/docs/errors/E1203.md +23 -0
- package/docs/errors/E1204.md +23 -0
- package/docs/errors/E1205.md +23 -0
- package/docs/errors/E1206.md +23 -0
- package/docs/errors/E1207.md +23 -0
- package/docs/errors/E1208.md +23 -0
- package/docs/errors/E1209.md +23 -0
- package/docs/errors/E1213.md +23 -0
- package/docs/errors/E1214.md +23 -0
- package/docs/errors/E1215.md +23 -0
- package/docs/errors/E1216.md +23 -0
- package/docs/errors/E1217.md +23 -0
- package/docs/errors/E1218.md +23 -0
- package/docs/errors/E1219.md +23 -0
- package/docs/errors/E1220.md +23 -0
- package/docs/errors/E1221.md +23 -0
- package/docs/errors/E1222.md +23 -0
- package/docs/errors/E1223.md +23 -0
- package/docs/errors/E1224.md +23 -0
- package/docs/errors/E1225.md +23 -0
- package/docs/errors/E1301.md +23 -0
- package/docs/errors/E1302.md +23 -0
- package/docs/errors/E1303.md +23 -0
- package/docs/errors/E1304.md +23 -0
- package/docs/errors/E1305.md +23 -0
- package/docs/errors/E1306.md +23 -0
- package/docs/errors/E1401.md +23 -0
- package/docs/errors/E1402.md +23 -0
- package/docs/errors/E1403.md +23 -0
- package/docs/errors/E1404.md +23 -0
- package/docs/errors/E1405.md +23 -0
- package/docs/errors/E1406.md +23 -0
- package/docs/errors/E1407.md +23 -0
- package/docs/errors/E1408.md +23 -0
- package/docs/errors/E1409.md +23 -0
- package/docs/errors/E1410.md +23 -0
- package/docs/errors/E1411.md +23 -0
- package/docs/errors/E1412.md +23 -0
- package/docs/errors/E1413.md +23 -0
- package/docs/errors/E1414.md +23 -0
- package/docs/errors/E1415.md +23 -0
- package/docs/errors/E1416.md +23 -0
- package/docs/errors/E1417.md +23 -0
- package/docs/errors/E1418.md +23 -0
- package/docs/errors/E1419.md +23 -0
- package/docs/errors/E1420.md +23 -0
- package/docs/errors/E1421.md +23 -0
- package/docs/errors/E1422.md +23 -0
- package/docs/errors/E1423.md +23 -0
- package/docs/errors/E1424.md +23 -0
- package/docs/errors/E1425.md +23 -0
- package/docs/errors/E1426.md +23 -0
- package/docs/errors/E1430.md +23 -0
- package/docs/errors/E1431.md +23 -0
- package/docs/errors/E1432.md +23 -0
- package/docs/errors/E1433.md +23 -0
- package/docs/errors/E1434.md +23 -0
- package/docs/errors/E1435.md +23 -0
- package/docs/errors/E1436.md +23 -0
- package/docs/errors/E1437.md +23 -0
- package/docs/errors/E1501.md +23 -0
- package/docs/errors/E1502.md +23 -0
- package/docs/errors/E1503.md +23 -0
- package/docs/errors/E1504.md +23 -0
- package/docs/errors/E1505.md +23 -0
- package/docs/errors/E1506.md +23 -0
- package/docs/errors/index.md +92 -0
- package/docs/getting-started/cdn.md +219 -0
- package/docs/getting-started/first-scene.md +129 -0
- package/docs/getting-started/hosting.md +359 -0
- package/docs/getting-started/install.md +111 -0
- package/docs/getting-started/network-use.md +88 -0
- package/docs/getting-started/project-structure.md +69 -0
- package/docs/getting-started/third-party-notices.md +92 -0
- package/docs/guides/accessibility.md +96 -0
- package/docs/guides/add-ons.md +159 -0
- package/docs/guides/agents.md +66 -0
- package/docs/guides/assets-pipeline.md +504 -0
- package/docs/guides/audio.md +163 -0
- package/docs/guides/baked-light-data.md +176 -0
- package/docs/guides/car-paint.md +121 -0
- package/docs/guides/content-pages.md +234 -0
- package/docs/guides/custom-passes.md +585 -0
- package/docs/guides/custom-shaders.md +290 -0
- package/docs/guides/debugging.md +162 -0
- package/docs/guides/deploying.md +15 -0
- package/docs/guides/deterministic-simulation.md +226 -0
- package/docs/guides/first-use-shaders.md +57 -0
- package/docs/guides/lens-kit.md +134 -0
- package/docs/guides/loading-screens.md +218 -0
- package/docs/guides/multiple-views.md +83 -0
- package/docs/guides/performance.md +402 -0
- package/docs/guides/phones.md +127 -0
- package/docs/guides/physics.md +202 -0
- package/docs/guides/screens.md +123 -0
- package/docs/guides/testing.md +227 -0
- package/docs/guides/ui-overlays.md +182 -0
- package/docs/guides/video-textures.md +110 -0
- package/docs/index.md +45 -0
- package/docs/pages.md +239 -0
- package/docs/porting/react-three-fiber.md +15 -0
- package/docs/porting/threejs-loop-and-threads.md +15 -0
- package/docs/porting/threejs-mapping.md +295 -0
- package/docs/porting/threejs-materials.md +15 -0
- package/docs/porting/threejs-overview.md +15 -0
- package/docs/porting/threejs-postprocessing.md +256 -0
- package/docs/porting/threejs-shaders.md +15 -0
- package/docs/porting/threejs-unsupported.md +15 -0
- package/docs/porting/verification.md +15 -0
- package/docs/shaders/builtins.md +129 -0
- package/docs/shaders/library.md +1350 -0
- package/docs/shaders/surface-functions.md +625 -0
- package/docs/shaders/wgsl-rules.md +126 -0
- package/levels/pieces.d.ts +178 -0
- package/levels/pieces.js +759 -0
- package/levels/planner.d.ts +126 -0
- package/levels/planner.js +682 -0
- package/lib/debug/debug.d.ts +178 -0
- package/lib/debug/debug.js +4 -0
- package/lib/debug/draw.d.ts +137 -0
- package/lib/debug/draw.js +672 -0
- package/lib/debug/frame-target.d.ts +11 -0
- package/lib/debug/frame-target.js +31 -0
- package/lib/debug/overlay-look.d.ts +162 -0
- package/lib/debug/overlay-look.js +1365 -0
- package/lib/debug/overlay.d.ts +68 -0
- package/lib/debug/overlay.js +195 -0
- package/lib/debug/page-meters.d.ts +139 -0
- package/lib/debug/page-meters.js +267 -0
- package/lib/debug/sketch-debug.d.ts +41 -0
- package/lib/debug/sketch-debug.js +86 -0
- package/lib/debug/stats-options.d.ts +15 -0
- package/lib/debug/stats-options.js +3 -0
- package/lib/debug/stats-panel.d.ts +94 -0
- package/lib/debug/stats-panel.js +123 -0
- package/lib/debug/stats-text.d.ts +169 -0
- package/lib/debug/stats-text.js +126 -0
- package/lib/debug/stats.d.ts +196 -0
- package/lib/debug/stats.js +252 -0
- package/lib/debug/view-names.d.ts +15 -0
- package/lib/debug/view-names.js +22 -0
- package/lib/errors/checks.d.ts +24 -0
- package/lib/errors/checks.js +38 -0
- package/lib/errors/codes.d.ts +15 -0
- package/lib/errors/codes.js +483 -0
- package/lib/errors/core-failure.d.ts +19 -0
- package/lib/errors/core-failure.js +127 -0
- package/lib/errors/engine-error-core.d.ts +21 -0
- package/lib/errors/engine-error-core.js +39 -0
- package/lib/errors/engine-error.d.ts +38 -0
- package/lib/errors/engine-error.js +117 -0
- package/lib/errors/fixes.d.ts +88 -0
- package/lib/errors/fixes.js +85 -0
- package/lib/errors/message.d.ts +4 -0
- package/lib/errors/message.js +10 -0
- package/lib/generated/core.d.ts +657 -0
- package/lib/generated/core.js +659 -0
- package/lib/generated/gpu.d.ts +412 -0
- package/lib/generated/gpu.js +414 -0
- package/lib/generated/shader-features.d.ts +8 -0
- package/lib/generated/shader-permutations.d.ts +6 -0
- package/lib/generated/shader-permutations.js +9 -0
- package/lib/generated/shaders-environment-glsl.d.ts +11 -0
- package/lib/generated/shaders-environment-wgsl.d.ts +11 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-coverage.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-bump.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-lod-fade-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-lod-fade-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-row-values-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-row-values-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-row-values-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-row-values-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-coverage.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-row-values-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-row-values-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-skinning-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-skinning-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lines.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-row-values-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-row-values-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-row-values-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-row-values-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-skinning-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-skinning-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-moment.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-area-lights-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-coverage.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-coverage.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-row-values-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-row-values-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-row-values-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-row-values-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-bump-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-coverage.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coat-sheen-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-coverage.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-cutout.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-decals-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-decals.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-displacement.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-hash-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-hash.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-moment-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-moment.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-morph-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-morph.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-motion.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-picking.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-probe-grid-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-probe-grid.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-row-values.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-skinning.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-sprites.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-subsurface-half.d.ts +3 -0
- package/lib/generated/shaders-glsl-combos-subsurface.d.ts +3 -0
- package/lib/generated/shaders-probe-glsl.d.ts +11 -0
- package/lib/generated/shaders-probe-wgsl.d.ts +11 -0
- package/lib/generated/shaders-sky-volume-env-glsl.d.ts +11 -0
- package/lib/generated/shaders-sky-volume-env-wgsl.d.ts +11 -0
- package/lib/generated/shaders-sky-volume-panorama-glsl.d.ts +11 -0
- package/lib/generated/shaders-sky-volume-panorama-wgsl.d.ts +11 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-bump-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-bump.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-coat-sheen-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-coat-sheen.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-coverage.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-displacement.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-hash-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-hash.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-instance-index-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-instance-index.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-lines.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-moment-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-moment.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-row-values.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-skinning.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-translucency-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-translucency.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-transmission-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-transmission.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-weighted-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-area-lights-and-weighted.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-bump-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-bump.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-coat-sheen-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-coat-sheen.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-coverage-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-coverage.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-cutout.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-decals-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-decals.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-displacement-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-displacement.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-hash-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-hash.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-instance-index-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-instance-index.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-lod-fade-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-lod-fade.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-moment-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-moment.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-motion.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-picking.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-probe-grid-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-probe-grid.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-row-values-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-row-values.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-skinning-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-skinning.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-sprites.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-subsurface-half.d.ts +3 -0
- package/lib/generated/shaders-wgsl-combos-subsurface.d.ts +3 -0
- package/lib/generated/shaders.d.ts +1146 -0
- package/lib/gpu/canvas-release.d.ts +20 -0
- package/lib/gpu/canvas-release.js +67 -0
- package/lib/gpu/completion.d.ts +35 -0
- package/lib/gpu/completion.js +256 -0
- package/lib/gpu/device-shaders.d.ts +69 -0
- package/lib/gpu/device-shaders.js +177 -0
- package/lib/gpu/effect-join.d.ts +83 -0
- package/lib/gpu/effect-join.js +134 -0
- package/lib/gpu/effect-joiner.d.ts +14 -0
- package/lib/gpu/effect-joiner.js +165 -0
- package/lib/gpu/environment-steps.d.ts +135 -0
- package/lib/gpu/environment-steps.js +210 -0
- package/lib/gpu/environment-words.d.ts +14 -0
- package/lib/gpu/environment-words.js +19 -0
- package/lib/gpu/environment.d.ts +4 -0
- package/lib/gpu/environment.js +8 -0
- package/lib/gpu/float-bits.d.ts +2 -0
- package/lib/gpu/float-bits.js +9 -0
- package/lib/gpu/line-vertices.d.ts +1 -0
- package/lib/gpu/line-vertices.js +14 -0
- package/lib/gpu/memory.d.ts +19 -0
- package/lib/gpu/memory.js +50 -0
- package/lib/gpu/particle-records.d.ts +1 -0
- package/lib/gpu/particle-records.js +15 -0
- package/lib/gpu/probe-steps.d.ts +22 -0
- package/lib/gpu/probe-steps.js +43 -0
- package/lib/gpu/readback.d.ts +32 -0
- package/lib/gpu/readback.js +163 -0
- package/lib/gpu/variants.d.ts +16 -0
- package/lib/gpu/variants.js +67 -0
- package/lib/gpu/vertex-format.d.ts +46 -0
- package/lib/gpu/vertex-format.js +111 -0
- package/lib/gpu/webgl2/backend.d.ts +653 -0
- package/lib/gpu/webgl2/backend.js +2746 -0
- package/lib/gpu/webgl2/call-timing.d.ts +34 -0
- package/lib/gpu/webgl2/call-timing.js +143 -0
- package/lib/gpu/webgl2/context.d.ts +31 -0
- package/lib/gpu/webgl2/context.js +111 -0
- package/lib/gpu/webgl2/depth.d.ts +25 -0
- package/lib/gpu/webgl2/depth.js +30 -0
- package/lib/gpu/webgl2/environment.d.ts +65 -0
- package/lib/gpu/webgl2/environment.js +572 -0
- package/lib/gpu/webgl2/gpu-timer.d.ts +25 -0
- package/lib/gpu/webgl2/gpu-timer.js +93 -0
- package/lib/gpu/webgl2/probes.d.ts +38 -0
- package/lib/gpu/webgl2/probes.js +117 -0
- package/lib/gpu/webgl2/programs.d.ts +220 -0
- package/lib/gpu/webgl2/programs.js +484 -0
- package/lib/gpu/webgpu/backend.d.ts +373 -0
- package/lib/gpu/webgpu/backend.js +1565 -0
- package/lib/gpu/webgpu/buffer-reads.d.ts +42 -0
- package/lib/gpu/webgpu/buffer-reads.js +95 -0
- package/lib/gpu/webgpu/culled-counts.d.ts +79 -0
- package/lib/gpu/webgpu/culled-counts.js +259 -0
- package/lib/gpu/webgpu/draw-path-probe.d.ts +37 -0
- package/lib/gpu/webgpu/draw-path-probe.js +187 -0
- package/lib/gpu/webgpu/environment.d.ts +36 -0
- package/lib/gpu/webgpu/environment.js +735 -0
- package/lib/gpu/webgpu/first-pass.d.ts +13 -0
- package/lib/gpu/webgpu/first-pass.js +61 -0
- package/lib/gpu/webgpu/gpu-timer.d.ts +67 -0
- package/lib/gpu/webgpu/gpu-timer.js +328 -0
- package/lib/gpu/webgpu/indirect-arguments.d.ts +42 -0
- package/lib/gpu/webgpu/indirect-arguments.js +156 -0
- package/lib/gpu/webgpu/pipelines.d.ts +251 -0
- package/lib/gpu/webgpu/pipelines.js +1999 -0
- package/lib/gpu/webgpu/probes.d.ts +27 -0
- package/lib/gpu/webgpu/probes.js +190 -0
- package/lib/gpu/webgpu/reusable.d.ts +74 -0
- package/lib/gpu/webgpu/reusable.js +212 -0
- package/lib/gpu/webgpu/staging.d.ts +79 -0
- package/lib/gpu/webgpu/staging.js +238 -0
- package/lib/gpu/webgpu/upload-routes.d.ts +55 -0
- package/lib/gpu/webgpu/upload-routes.js +128 -0
- package/lib/index.d.ts +119 -0
- package/lib/index.js +53 -0
- package/lib/math/color.d.ts +18 -0
- package/lib/math/color.js +71 -0
- package/lib/math/create-math.d.ts +101 -0
- package/lib/math/create-math.js +207 -0
- package/lib/math/hex.d.ts +8 -0
- package/lib/math/hex.js +38 -0
- package/lib/math/index.d.ts +2 -0
- package/lib/math/index.js +11 -0
- package/lib/math/mat4.d.ts +28 -0
- package/lib/math/mat4.js +212 -0
- package/lib/math/math.d.ts +16 -0
- package/lib/math/math.js +42 -0
- package/lib/math/namespaces/math.d.ts +7 -0
- package/lib/math/namespaces/math.js +14 -0
- package/lib/math/namespaces/quat.d.ts +20 -0
- package/lib/math/namespaces/quat.js +30 -0
- package/lib/math/namespaces/vec3.d.ts +4 -0
- package/lib/math/namespaces/vec3.js +8 -0
- package/lib/math/quat.d.ts +40 -0
- package/lib/math/quat.js +228 -0
- package/lib/math/random.d.ts +17 -0
- package/lib/math/random.js +58 -0
- package/lib/math/types.d.ts +43 -0
- package/lib/math/types.js +4 -0
- package/lib/math/vec3.d.ts +46 -0
- package/lib/math/vec3.js +190 -0
- package/lib/page/abortable.d.ts +2 -0
- package/lib/page/abortable.js +19 -0
- package/lib/page/browser-check.d.ts +8 -0
- package/lib/page/browser-check.js +23 -0
- package/lib/page/canvas-watch.d.ts +34 -0
- package/lib/page/canvas-watch.js +141 -0
- package/lib/page/capabilities.d.ts +201 -0
- package/lib/page/capabilities.js +395 -0
- package/lib/page/check-store.d.ts +42 -0
- package/lib/page/check-store.js +146 -0
- package/lib/page/display.d.ts +2 -0
- package/lib/page/display.js +25 -0
- package/lib/page/early-core.d.ts +1 -0
- package/lib/page/early-core.js +23 -0
- package/lib/page/engine.d.ts +865 -0
- package/lib/page/engine.js +2136 -0
- package/lib/page/frame-stats.d.ts +369 -0
- package/lib/page/frame-stats.js +374 -0
- package/lib/page/gamepads.d.ts +37 -0
- package/lib/page/gamepads.js +123 -0
- package/lib/page/held-input.d.ts +19 -0
- package/lib/page/held-input.js +54 -0
- package/lib/page/hold.d.ts +186 -0
- package/lib/page/hold.js +49 -0
- package/lib/page/input-ring.d.ts +13 -0
- package/lib/page/input-ring.js +25 -0
- package/lib/page/input.d.ts +6 -0
- package/lib/page/input.js +159 -0
- package/lib/page/isolation-check.d.ts +14 -0
- package/lib/page/isolation-check.js +21 -0
- package/lib/page/label-loop.d.ts +76 -0
- package/lib/page/label-loop.js +410 -0
- package/lib/page/labels.d.ts +56 -0
- package/lib/page/labels.js +102 -0
- package/lib/page/limits.d.ts +321 -0
- package/lib/page/limits.js +323 -0
- package/lib/page/loader.d.ts +78 -0
- package/lib/page/loader.js +149 -0
- package/lib/page/main-thread.d.ts +10 -0
- package/lib/page/main-thread.js +41 -0
- package/lib/page/memory-pool.d.ts +26 -0
- package/lib/page/memory-pool.js +69 -0
- package/lib/page/ownership.d.ts +65 -0
- package/lib/page/ownership.js +166 -0
- package/lib/page/permutation-recording.d.ts +26 -0
- package/lib/page/permutation-recording.js +32 -0
- package/lib/page/pointer-lock.d.ts +14 -0
- package/lib/page/pointer-lock.js +60 -0
- package/lib/page/preferences.d.ts +2 -0
- package/lib/page/preferences.js +11 -0
- package/lib/page/record-button.d.ts +5 -0
- package/lib/page/record-button.js +60 -0
- package/lib/page/start-marker.d.ts +44 -0
- package/lib/page/start-marker.js +116 -0
- package/lib/page/stats-switch.d.ts +16 -0
- package/lib/page/stats-switch.js +38 -0
- package/lib/page/stop-jobs.d.ts +37 -0
- package/lib/page/stop-jobs.js +87 -0
- package/lib/page/switches.d.ts +317 -0
- package/lib/page/switches.js +142 -0
- package/lib/page/videos.d.ts +70 -0
- package/lib/page/videos.js +244 -0
- package/lib/quality/budget.d.ts +14 -0
- package/lib/quality/budget.js +25 -0
- package/lib/quality/check.d.ts +98 -0
- package/lib/quality/check.js +70 -0
- package/lib/quality/chooser.d.ts +92 -0
- package/lib/quality/chooser.js +100 -0
- package/lib/quality/device-hints.d.ts +8 -0
- package/lib/quality/device-hints.js +18 -0
- package/lib/quality/governor.d.ts +479 -0
- package/lib/quality/governor.js +1063 -0
- package/lib/quality/preset-docs.d.ts +387 -0
- package/lib/quality/preset-docs.js +176 -0
- package/lib/quality/presets.d.ts +744 -0
- package/lib/quality/presets.js +586 -0
- package/lib/render/direct-loop.d.ts +4 -0
- package/lib/render/direct-loop.js +52 -0
- package/lib/render/draw.d.ts +65 -0
- package/lib/render/draw.js +101 -0
- package/lib/render/load-draw.d.ts +10 -0
- package/lib/render/load-draw.js +16 -0
- package/lib/render/loop.d.ts +241 -0
- package/lib/render/loop.js +566 -0
- package/lib/render/loss.d.ts +35 -0
- package/lib/render/loss.js +99 -0
- package/lib/render/pacer.d.ts +24 -0
- package/lib/render/pacer.js +51 -0
- package/lib/render/recovery.d.ts +62 -0
- package/lib/render/recovery.js +120 -0
- package/lib/render/refresh.d.ts +38 -0
- package/lib/render/refresh.js +111 -0
- package/lib/render/renderer.d.ts +116 -0
- package/lib/render/renderer.js +156 -0
- package/lib/render/scene-renderer.d.ts +117 -0
- package/lib/render/scene-renderer.js +192 -0
- package/lib/render/shader-salt.d.ts +5 -0
- package/lib/render/shader-salt.js +31 -0
- package/lib/render/webgl2-renderers.d.ts +11 -0
- package/lib/render/webgl2-renderers.js +224 -0
- package/lib/render/webgpu-renderers.d.ts +10 -0
- package/lib/render/webgpu-renderers.js +253 -0
- package/lib/scene/addon-debug-views.d.ts +30 -0
- package/lib/scene/addon-debug-views.js +63 -0
- package/lib/scene/animation.d.ts +551 -0
- package/lib/scene/animation.js +1428 -0
- package/lib/scene/area-light-tables.d.ts +32 -0
- package/lib/scene/area-light-tables.js +89 -0
- package/lib/scene/assets.d.ts +400 -0
- package/lib/scene/assets.js +869 -0
- package/lib/scene/background.d.ts +242 -0
- package/lib/scene/background.js +467 -0
- package/lib/scene/baked-light.d.ts +60 -0
- package/lib/scene/baked-light.js +300 -0
- package/lib/scene/builtin-environments.d.ts +36 -0
- package/lib/scene/builtin-environments.js +43 -0
- package/lib/scene/chunk-rows.d.ts +81 -0
- package/lib/scene/chunk-rows.js +146 -0
- package/lib/scene/color.d.ts +22 -0
- package/lib/scene/color.js +45 -0
- package/lib/scene/derived-cache.d.ts +139 -0
- package/lib/scene/derived-cache.js +547 -0
- package/lib/scene/effects.d.ts +193 -0
- package/lib/scene/effects.js +476 -0
- package/lib/scene/environment-file.d.ts +22 -0
- package/lib/scene/environment-file.js +81 -0
- package/lib/scene/environment.d.ts +57 -0
- package/lib/scene/environment.js +131 -0
- package/lib/scene/fake-call-values.d.ts +8 -0
- package/lib/scene/fake-call-values.js +51 -0
- package/lib/scene/feature-draws.d.ts +169 -0
- package/lib/scene/feature-draws.js +269 -0
- package/lib/scene/feature-effects.d.ts +42 -0
- package/lib/scene/feature-effects.js +155 -0
- package/lib/scene/feature-host.d.ts +129 -0
- package/lib/scene/feature-host.js +299 -0
- package/lib/scene/feature-instances.d.ts +130 -0
- package/lib/scene/feature-instances.js +326 -0
- package/lib/scene/features.d.ts +412 -0
- package/lib/scene/features.js +550 -0
- package/lib/scene/file-limits.d.ts +70 -0
- package/lib/scene/file-limits.js +224 -0
- package/lib/scene/fog.d.ts +94 -0
- package/lib/scene/fog.js +142 -0
- package/lib/scene/frame-cameras.d.ts +156 -0
- package/lib/scene/frame-cameras.js +434 -0
- package/lib/scene/gltf-animation.d.ts +129 -0
- package/lib/scene/gltf-animation.js +887 -0
- package/lib/scene/gltf-draco.d.ts +9 -0
- package/lib/scene/gltf-draco.js +224 -0
- package/lib/scene/gltf-extensions.d.ts +31 -0
- package/lib/scene/gltf-extensions.js +92 -0
- package/lib/scene/gltf-json.d.ts +49 -0
- package/lib/scene/gltf-json.js +94 -0
- package/lib/scene/gltf-math.d.ts +16 -0
- package/lib/scene/gltf-math.js +129 -0
- package/lib/scene/gltf-meshopt.d.ts +3 -0
- package/lib/scene/gltf-meshopt.js +48 -0
- package/lib/scene/gltf-parse.d.ts +600 -0
- package/lib/scene/gltf-parse.js +1854 -0
- package/lib/scene/gltf.d.ts +159 -0
- package/lib/scene/gltf.js +1560 -0
- package/lib/scene/grade-table.d.ts +9 -0
- package/lib/scene/grade-table.js +23 -0
- package/lib/scene/grade-task.d.ts +12 -0
- package/lib/scene/grade-task.js +11 -0
- package/lib/scene/grading.d.ts +110 -0
- package/lib/scene/grading.js +142 -0
- package/lib/scene/half-float.d.ts +4 -0
- package/lib/scene/half-float.js +42 -0
- package/lib/scene/ktx2-cache.d.ts +32 -0
- package/lib/scene/ktx2-cache.js +62 -0
- package/lib/scene/ktx2-file.d.ts +57 -0
- package/lib/scene/ktx2-file.js +207 -0
- package/lib/scene/ktx2-transcode.d.ts +15 -0
- package/lib/scene/ktx2-transcode.js +94 -0
- package/lib/scene/ktx2.d.ts +34 -0
- package/lib/scene/ktx2.js +178 -0
- package/lib/scene/lens.d.ts +61 -0
- package/lib/scene/lens.js +101 -0
- package/lib/scene/level-meshopt.d.ts +20 -0
- package/lib/scene/level-meshopt.js +122 -0
- package/lib/scene/level-pieces.d.ts +24 -0
- package/lib/scene/level-pieces.js +138 -0
- package/lib/scene/level-words.d.ts +19 -0
- package/lib/scene/level-words.js +34 -0
- package/lib/scene/levels-task.d.ts +51 -0
- package/lib/scene/levels-task.js +132 -0
- package/lib/scene/light-images.d.ts +36 -0
- package/lib/scene/light-images.js +88 -0
- package/lib/scene/light-probes.d.ts +240 -0
- package/lib/scene/light-probes.js +644 -0
- package/lib/scene/lines.d.ts +192 -0
- package/lib/scene/lines.js +257 -0
- package/lib/scene/lut-files.d.ts +41 -0
- package/lib/scene/lut-files.js +399 -0
- package/lib/scene/lut.d.ts +56 -0
- package/lib/scene/lut.js +48 -0
- package/lib/scene/memory.d.ts +72 -0
- package/lib/scene/memory.js +159 -0
- package/lib/scene/mesh-arrays.d.ts +110 -0
- package/lib/scene/mesh-arrays.js +701 -0
- package/lib/scene/mesh-levels.d.ts +10 -0
- package/lib/scene/mesh-levels.js +52 -0
- package/lib/scene/namespaces.d.ts +125 -0
- package/lib/scene/namespaces.js +313 -0
- package/lib/scene/panorama-files.d.ts +71 -0
- package/lib/scene/panorama-files.js +1103 -0
- package/lib/scene/panorama.d.ts +23 -0
- package/lib/scene/panorama.js +108 -0
- package/lib/scene/particles.d.ts +452 -0
- package/lib/scene/particles.js +814 -0
- package/lib/scene/pass-reads.d.ts +70 -0
- package/lib/scene/pass-reads.js +220 -0
- package/lib/scene/picks.d.ts +69 -0
- package/lib/scene/picks.js +208 -0
- package/lib/scene/pointer-events.d.ts +205 -0
- package/lib/scene/pointer-events.js +500 -0
- package/lib/scene/post.d.ts +572 -0
- package/lib/scene/post.js +925 -0
- package/lib/scene/prefab.d.ts +110 -0
- package/lib/scene/prefab.js +167 -0
- package/lib/scene/probes.d.ts +71 -0
- package/lib/scene/probes.js +169 -0
- package/lib/scene/property-animation.d.ts +160 -0
- package/lib/scene/property-animation.js +276 -0
- package/lib/scene/queries.d.ts +182 -0
- package/lib/scene/queries.js +393 -0
- package/lib/scene/render.d.ts +487 -0
- package/lib/scene/render.js +829 -0
- package/lib/scene/resources.d.ts +1627 -0
- package/lib/scene/resources.js +2745 -0
- package/lib/scene/rotation.d.ts +6 -0
- package/lib/scene/rotation.js +12 -0
- package/lib/scene/scene.d.ts +1827 -0
- package/lib/scene/scene.js +4582 -0
- package/lib/scene/shader-preloads.d.ts +40 -0
- package/lib/scene/shader-preloads.js +78 -0
- package/lib/scene/shader-templates.d.ts +60 -0
- package/lib/scene/shader-templates.js +156 -0
- package/lib/scene/sprites.d.ts +265 -0
- package/lib/scene/sprites.js +293 -0
- package/lib/scene/stale-calls-scenario.d.ts +20 -0
- package/lib/scene/stale-calls-scenario.js +175 -0
- package/lib/scene/textures.d.ts +324 -0
- package/lib/scene/textures.js +954 -0
- package/lib/scene/time-of-day.d.ts +146 -0
- package/lib/scene/time-of-day.js +645 -0
- package/lib/scene/unmarked-writes.d.ts +118 -0
- package/lib/scene/unmarked-writes.js +283 -0
- package/lib/scene/unread-extensions-scenario.d.ts +6 -0
- package/lib/scene/unread-extensions-scenario.js +26 -0
- package/lib/scene/vertex-draws.d.ts +81 -0
- package/lib/scene/vertex-draws.js +83 -0
- package/lib/scene/wgsl-uniforms.d.ts +167 -0
- package/lib/scene/wgsl-uniforms.js +12 -0
- package/lib/shared/await-later.d.ts +5 -0
- package/lib/shared/await-later.js +10 -0
- package/lib/shared/control.d.ts +94 -0
- package/lib/shared/control.js +150 -0
- package/lib/shared/core-sources.d.ts +2 -0
- package/lib/shared/core-sources.js +7 -0
- package/lib/shared/core.d.ts +1249 -0
- package/lib/shared/core.js +380 -0
- package/lib/shared/counter.d.ts +52 -0
- package/lib/shared/counter.js +55 -0
- package/lib/shared/dev.d.ts +8 -0
- package/lib/shared/dev.js +13 -0
- package/lib/shared/feature-stats.d.ts +16 -0
- package/lib/shared/feature-stats.js +27 -0
- package/lib/shared/frame-image.d.ts +13 -0
- package/lib/shared/frame-image.js +32 -0
- package/lib/shared/gpu-clock.d.ts +14 -0
- package/lib/shared/gpu-clock.js +38 -0
- package/lib/shared/gpu-counter.d.ts +12 -0
- package/lib/shared/gpu-counter.js +15 -0
- package/lib/shared/gpu-scope.d.ts +14 -0
- package/lib/shared/gpu-scope.js +104 -0
- package/lib/shared/helper-workers.d.ts +4 -0
- package/lib/shared/helper-workers.js +23 -0
- package/lib/shared/images.d.ts +255 -0
- package/lib/shared/images.js +450 -0
- package/lib/shared/key-codes.d.ts +2 -0
- package/lib/shared/key-codes.js +69 -0
- package/lib/shared/labels.d.ts +94 -0
- package/lib/shared/labels.js +172 -0
- package/lib/shared/memory-area.d.ts +6 -0
- package/lib/shared/memory-area.js +21 -0
- package/lib/shared/memory-figure.d.ts +14 -0
- package/lib/shared/memory-figure.js +18 -0
- package/lib/shared/memory-views.d.ts +48 -0
- package/lib/shared/memory-views.js +90 -0
- package/lib/shared/metrics.d.ts +315 -0
- package/lib/shared/metrics.js +738 -0
- package/lib/shared/page-measurement.d.ts +9 -0
- package/lib/shared/page-measurement.js +37 -0
- package/lib/shared/phase.d.ts +17 -0
- package/lib/shared/phase.js +20 -0
- package/lib/shared/policy.d.ts +20 -0
- package/lib/shared/policy.js +46 -0
- package/lib/shared/recording.d.ts +100 -0
- package/lib/shared/recording.js +378 -0
- package/lib/shared/role.d.ts +10 -0
- package/lib/shared/role.js +13 -0
- package/lib/shared/run-task.d.ts +39 -0
- package/lib/shared/run-task.js +63 -0
- package/lib/shared/slot.d.ts +218 -0
- package/lib/shared/slot.js +221 -0
- package/lib/shared/software.d.ts +24 -0
- package/lib/shared/software.js +22 -0
- package/lib/shared/stats.d.ts +62 -0
- package/lib/shared/stats.js +86 -0
- package/lib/shared/task-failure.d.ts +24 -0
- package/lib/shared/task-failure.js +36 -0
- package/lib/shared/task-host.d.ts +42 -0
- package/lib/shared/task-host.js +60 -0
- package/lib/shared/task-load-error.d.ts +10 -0
- package/lib/shared/task-load-error.js +13 -0
- package/lib/shared/task-modules.d.ts +2 -0
- package/lib/shared/task-modules.js +8 -0
- package/lib/shared/task-pending.d.ts +12 -0
- package/lib/shared/task-pending.js +41 -0
- package/lib/shared/tasks.d.ts +54 -0
- package/lib/shared/tasks.js +379 -0
- package/lib/shared/tier.d.ts +7 -0
- package/lib/shared/tier.js +3 -0
- package/lib/shared/version.d.ts +56 -0
- package/lib/shared/version.js +85 -0
- package/lib/shared/videos.d.ts +15 -0
- package/lib/shared/videos.js +11 -0
- package/lib/shared/wake.d.ts +38 -0
- package/lib/shared/wake.js +76 -0
- package/lib/shared/wasm-limits.d.ts +13 -0
- package/lib/shared/wasm-limits.js +75 -0
- package/lib/shared/wasm.d.ts +26 -0
- package/lib/shared/wasm.js +128 -0
- package/lib/shared/webkit.d.ts +33 -0
- package/lib/shared/webkit.js +59 -0
- package/lib/shared/wgsl-updates.d.ts +9 -0
- package/lib/shared/wgsl-updates.js +8 -0
- package/lib/shared/worker-start.d.ts +49 -0
- package/lib/shared/worker-start.js +159 -0
- package/lib/sketch/clock.d.ts +61 -0
- package/lib/sketch/clock.js +98 -0
- package/lib/sketch/define-sketch.d.ts +234 -0
- package/lib/sketch/define-sketch.js +103 -0
- package/lib/sketch/input-off-scenario.d.ts +7 -0
- package/lib/sketch/input-off-scenario.js +24 -0
- package/lib/sketch/input-off.d.ts +16 -0
- package/lib/sketch/input-off.js +38 -0
- package/lib/sketch/input.d.ts +243 -0
- package/lib/sketch/input.js +554 -0
- package/lib/sketch/preset-check.d.ts +28 -0
- package/lib/sketch/preset-check.js +95 -0
- package/lib/sketch/quality.d.ts +334 -0
- package/lib/sketch/quality.js +314 -0
- package/lib/sketch/random.d.ts +13 -0
- package/lib/sketch/random.js +25 -0
- package/lib/sketch/runner.d.ts +507 -0
- package/lib/sketch/runner.js +1826 -0
- package/lib/sketch/ui.d.ts +97 -0
- package/lib/sketch/ui.js +391 -0
- package/lib/stats.d.ts +4 -0
- package/lib/stats.js +8 -0
- package/lib/workers/drawing-host.d.ts +24 -0
- package/lib/workers/drawing-host.js +48 -0
- package/lib/workers/gltf-worker.d.ts +35 -0
- package/lib/workers/gltf-worker.js +210 -0
- package/lib/workers/job-worker.d.ts +1 -0
- package/lib/workers/job-worker.js +102 -0
- package/lib/workers/panorama-worker.d.ts +15 -0
- package/lib/workers/panorama-worker.js +21 -0
- package/lib/workers/probe-worker.d.ts +29 -0
- package/lib/workers/probe-worker.js +49 -0
- package/lib/workers/protocol.d.ts +329 -0
- package/lib/workers/protocol.js +53 -0
- package/lib/workers/render-worker.d.ts +1 -0
- package/lib/workers/render-worker.js +82 -0
- package/lib/workers/sketch-worker.d.ts +1 -0
- package/lib/workers/sketch-worker.js +206 -0
- package/lib/workers/task-worker.d.ts +1 -0
- package/lib/workers/task-worker.js +5 -0
- package/lib/workers/tasks.d.ts +65 -0
- package/lib/workers/tasks.js +85 -0
- package/package.json +106 -5
- package/vendor/basis/LICENSE +201 -0
- package/vendor/basis/LICENSE-zstd +30 -0
- package/vendor/basis/NOTICE +15 -0
- package/vendor/basis/basis_transcoder.d.mts +36 -0
- package/vendor/basis/basis_transcoder.mjs +2 -0
- package/vendor/basis/basis_transcoder.wasm +0 -0
- package/vendor/draco/LICENSE +252 -0
- package/vendor/draco/draco_decoder_gltf.wasm +0 -0
- package/vendor/draco/draco_wasm_wrapper_gltf.d.ts +71 -0
- package/vendor/draco/draco_wasm_wrapper_gltf.js +116 -0
- package/vendor/ltc/LICENSE +31 -0
- package/vendor/ltc/area-light-tables.bin +0 -0
- package/vendor/meshopt/LICENSE.md +21 -0
- package/vendor/meshopt/meshopt_clusterizer.wasm +0 -0
- package/vendor/meshopt/meshopt_decoder.wasm +0 -0
- package/vendor/meshopt/meshopt_encoder.wasm +0 -0
- package/vendor/meshopt/meshopt_simplifier.wasm +0 -0
- package/README.md +0 -3
|
@@ -0,0 +1,2136 @@
|
|
|
1
|
+
// createEngine: the page side of the engine. It probes the device, picks the build, the GPU tier
|
|
2
|
+
// and the quality preset, starts the workers, and hands the canvas to the thread that draws. The
|
|
3
|
+
// page loads the renderer only when it draws itself, and the sketch runner and the scene API only
|
|
4
|
+
// when it runs the sketch itself: in the single-threaded build, and with sketchThread: 'main'.
|
|
5
|
+
import { DEV } from '../errors/checks.js';
|
|
6
|
+
import { EngineError, errorFixesReady, errorOfMessage } from '../errors/engine-error.js';
|
|
7
|
+
import { messageOf } from '../errors/message.js';
|
|
8
|
+
import { FORMAT_CANVAS, PERMUTATION_HALF } from '../generated/gpu.js';
|
|
9
|
+
import { SHADER_FEATURES } from '../generated/shader-features.js';
|
|
10
|
+
import { recordPermutations, stopRecordingPermutations } from '../gpu/variants.js';
|
|
11
|
+
import { maxTargetFps } from '../quality/check.js';
|
|
12
|
+
import { choosePreset, crashTier, deviceKind, gpuOcclusionChoice, memoryPreset, textureMemoryCap, withinTier, } from '../quality/chooser.js';
|
|
13
|
+
import { readDeviceHints } from '../quality/device-hints.js';
|
|
14
|
+
import { capTextureMemory, checkedSettings, checkSettings, presetOption, presetValue, targetFpsOption, } from '../quality/presets.js';
|
|
15
|
+
import { loadDrawModule, preloadDeviceFiles } from '../render/load-draw.js';
|
|
16
|
+
import { awaitLater } from '../shared/await-later.js';
|
|
17
|
+
import { controlViews, createControlBuffer, Slot } from '../shared/control.js';
|
|
18
|
+
import { loadGlue, startCore } from '../shared/core.js';
|
|
19
|
+
import { URL_SWITCHES } from '../shared/dev.js';
|
|
20
|
+
import { FEATURE_STATS_MESSAGE, mergeFeatureStats } from '../shared/feature-stats.js';
|
|
21
|
+
import { encodeFrame } from '../shared/frame-image.js';
|
|
22
|
+
import { drawingSenders, ImageTable } from '../shared/images.js';
|
|
23
|
+
import { KEY_CODES } from '../shared/key-codes.js';
|
|
24
|
+
import { memoryBytes } from '../shared/memory-views.js';
|
|
25
|
+
import { createMetricsBuffer, MetricsReader, threadRoles } from '../shared/metrics.js';
|
|
26
|
+
import { addMeasurementRelease } from '../shared/page-measurement.js';
|
|
27
|
+
import { clearJobTasks, jobAsker, setJobTasks } from '../shared/task-host.js';
|
|
28
|
+
import { onAddonChecked } from '../shared/version.js';
|
|
29
|
+
import { VIDEO_FOLLOW } from '../shared/videos.js';
|
|
30
|
+
import { notifySlot, setWakeByMessage } from '../shared/wake.js';
|
|
31
|
+
import { WGSL_UPDATE_EVENT } from '../shared/wgsl-updates.js';
|
|
32
|
+
import { spawnWorker, startedWorkerScript, watchWorkerError } from '../shared/worker-start.js';
|
|
33
|
+
import { loadSketch } from '../sketch/define-sketch.js';
|
|
34
|
+
import { abortable } from './abortable.js';
|
|
35
|
+
import { checkBrowser } from './browser-check.js';
|
|
36
|
+
import { watchCanvas } from './canvas-watch.js';
|
|
37
|
+
import { forgetWorkerProbe, probeCapabilities, } from './capabilities.js';
|
|
38
|
+
import { CheckStore, checkConditions } from './check-store.js';
|
|
39
|
+
import { watchDisplay } from './display.js';
|
|
40
|
+
import { holdFailure, holdSeconds, publishHold, holdScript as readHoldScript, } from './hold.js';
|
|
41
|
+
import { captureInput } from './input.js';
|
|
42
|
+
import { lostIsolationWarning, pageIsolation } from './isolation-check.js';
|
|
43
|
+
import { labelCapacity, labelCapacity3d, PageLabels } from './labels.js';
|
|
44
|
+
import { coreDevice, drawPath, keepTextureCopiesOption, maxCanvasSize, maxInstances, } from './limits.js';
|
|
45
|
+
import { expectedObjectCount, loadCore, memoryMaximumMiB } from './loader.js';
|
|
46
|
+
import { MainThreadWatch } from './main-thread.js';
|
|
47
|
+
import { keepMemory, releaseMemories } from './memory-pool.js';
|
|
48
|
+
import { canvasHold, Holder, parkWorker, takeParkedWorker, takeWhenFree, } from './ownership.js';
|
|
49
|
+
import { PermutationRecording } from './permutation-recording.js';
|
|
50
|
+
import { requestPointerLock } from './pointer-lock.js';
|
|
51
|
+
import { watchPreferences } from './preferences.js';
|
|
52
|
+
import { NO_HISTORY, StartMarker } from './start-marker.js';
|
|
53
|
+
import { StatsSwitch } from './stats-switch.js';
|
|
54
|
+
import { STOP_TIMEOUT_MS, stopJobWorkers, waitForJobWorkersToLeave, yieldJobWorkers, } from './stop-jobs.js';
|
|
55
|
+
import { jobWorkerCount, parseSwitches, } from './switches.js';
|
|
56
|
+
/** Why a worker cannot draw, in words, for the warning in development builds. */
|
|
57
|
+
function fallbackText(report) {
|
|
58
|
+
return 'failure' in report.worker
|
|
59
|
+
? report.worker.error
|
|
60
|
+
: 'this browser cannot draw with the chosen GPU path in a worker';
|
|
61
|
+
}
|
|
62
|
+
/** True once an engine on the page has warned that the page draws instead of a worker. */
|
|
63
|
+
let warnedFallback = false;
|
|
64
|
+
/** True once an engine on the page has warned that a service worker's page lost its isolation. */
|
|
65
|
+
let warnedIsolation = false;
|
|
66
|
+
/** The global where the `?bench` switch publishes the running engine. */
|
|
67
|
+
const BENCH_GLOBAL = '__null3dEngine';
|
|
68
|
+
/** The GPU the engine asks for on a device with two: the faster one. */
|
|
69
|
+
const DEFAULT_POWER_PREFERENCE = 'high-performance';
|
|
70
|
+
/** How often the page reads the frame records while it measures. */
|
|
71
|
+
const DRAIN_INTERVAL_MS = 250;
|
|
72
|
+
/**
|
|
73
|
+
* The failures after which the engine draws no new frames, as `onFailure`'s docs say: a GPU that
|
|
74
|
+
* did not come back, a failed engine thread, and builds that a pipeline needed and did not get.
|
|
75
|
+
* `onStop`'s handlers hear each of them.
|
|
76
|
+
*/
|
|
77
|
+
const FAILURES_THAT_END_DRAWING = new Set(['E1302', 'E1404', 'E1424']);
|
|
78
|
+
/** How many sketch messages the page keeps while no handler listens. */
|
|
79
|
+
const MAX_EARLY_MESSAGES = 256;
|
|
80
|
+
/**
|
|
81
|
+
* The longest that a request may wait for a worker's answer, in milliseconds. The slowest answer is
|
|
82
|
+
* a capture: the thread that draws waits for a frame's pipelines for up to `BUILD_WAIT_LIMIT_MS`
|
|
83
|
+
* before it draws, reads the frame back and encodes it. On a software renderer that work costs
|
|
84
|
+
* minutes, and the forest demo's held frame takes more than a minute on CI's SwiftShader, so this
|
|
85
|
+
* figure sits well above the slowest frame that was measured and below the image tests' own limit.
|
|
86
|
+
* The heaviest picture sets their own limit of ten minutes, and a showcase scene that grows its
|
|
87
|
+
* plants at first use spends more of that on one frame, so this figure takes the same ten minutes:
|
|
88
|
+
* a thread that stops taking messages then fails the request with a named error instead of leaving
|
|
89
|
+
* the page to wait with no end.
|
|
90
|
+
*/
|
|
91
|
+
export const WORKER_REPLY_LIMIT_MS = 600_000;
|
|
92
|
+
/** Picks the GPU tier from feature tests, never from browser or GPU names. */
|
|
93
|
+
export function chooseTier(report, wanted, inWorker) {
|
|
94
|
+
const worker = 'failure' in report.worker ? undefined : report.worker;
|
|
95
|
+
const webgpu = report.webgpu.compatibilityAdapter && (!inWorker || worker?.offscreenWebGPU === true);
|
|
96
|
+
const webgl2 = inWorker ? worker?.offscreenWebGL2 === true : report.webgl2.available;
|
|
97
|
+
if (wanted === 'webgl2')
|
|
98
|
+
return webgl2 ? { tier: 'webgl2', forceCompat: false } : null;
|
|
99
|
+
if (wanted === 'compat')
|
|
100
|
+
return webgpu ? { tier: 'webgpu-compat', forceCompat: true } : null;
|
|
101
|
+
if (wanted === 'webgpu')
|
|
102
|
+
return webgpu && report.webgpu.coreFeaturesAndLimits
|
|
103
|
+
? { tier: 'webgpu', forceCompat: false }
|
|
104
|
+
: null;
|
|
105
|
+
if (webgpu)
|
|
106
|
+
return {
|
|
107
|
+
tier: report.webgpu.coreFeaturesAndLimits ? 'webgpu' : 'webgpu-compat',
|
|
108
|
+
forceCompat: false,
|
|
109
|
+
};
|
|
110
|
+
return webgl2 ? { tier: 'webgl2', forceCompat: false } : null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* True while this page is hidden. A hidden page draws no frames, so a capture's answer comes once
|
|
114
|
+
* the page shows again, however long that takes, and the answer's limit counts only the time the
|
|
115
|
+
* page shows.
|
|
116
|
+
*/
|
|
117
|
+
function pageHidden() {
|
|
118
|
+
return typeof document !== 'undefined' && document.visibilityState === 'hidden';
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The error of a worker that failed to start. An engine error keeps its code and message; any
|
|
122
|
+
* other failure becomes E1405.
|
|
123
|
+
*/
|
|
124
|
+
export function startError(role, message) {
|
|
125
|
+
return (errorOfMessage(message) ??
|
|
126
|
+
new EngineError('E1405', `the ${role} worker did not start: ${message}.`));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The error of an engine thread, or of the drawing on the page, that failed after the start,
|
|
130
|
+
* where `what` names it. An engine error keeps its code and message, such as E1424 for a custom
|
|
131
|
+
* material's builds that did not download; any other failure becomes E1404.
|
|
132
|
+
*/
|
|
133
|
+
export function failureError(what, message) {
|
|
134
|
+
return errorOfMessage(message) ?? new EngineError('E1404', `${what} failed: ${message}.`);
|
|
135
|
+
}
|
|
136
|
+
/** The engine that runs its sketch on this page, where the page's copy of the core serves it. */
|
|
137
|
+
let pageSketch;
|
|
138
|
+
/**
|
|
139
|
+
* Starts loading the sketch runner and the scene API, which the page needs only when it runs the
|
|
140
|
+
* sketch itself. The bundler puts them in a file of their own.
|
|
141
|
+
*/
|
|
142
|
+
function loadRunnerModule() {
|
|
143
|
+
return awaitLater(import('../sketch/runner.js'));
|
|
144
|
+
}
|
|
145
|
+
/** Loads the frame figures that a measurement reads, in a file of their own. */
|
|
146
|
+
function loadFrameStats() {
|
|
147
|
+
return import('./frame-stats.js');
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The error of a GPU that ran out of memory (E1304) or rejected a command (E1305), on `thread`, such
|
|
151
|
+
* as "the render worker".
|
|
152
|
+
*/
|
|
153
|
+
export function gpuFailure(thread, outOfMemory, message) {
|
|
154
|
+
return outOfMemory
|
|
155
|
+
? new EngineError('E1304', `${thread}'s GPU ran out of memory: ${message}.`)
|
|
156
|
+
: new EngineError('E1305', `${thread}'s GPU rejected a command: ${message}.`);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* A worker whose replies are routed: events to the page's handlers, answers to the oldest request.
|
|
160
|
+
* A failure that a started worker reports, or that ends it, reaches the page as E1404, or with its
|
|
161
|
+
* own code when it is an engine error.
|
|
162
|
+
*/
|
|
163
|
+
export class EngineWorker {
|
|
164
|
+
role;
|
|
165
|
+
script;
|
|
166
|
+
restart;
|
|
167
|
+
waiting = [];
|
|
168
|
+
readyPromise;
|
|
169
|
+
stoppedPromise;
|
|
170
|
+
worker;
|
|
171
|
+
/**
|
|
172
|
+
* The recording that gathers the words of each thread that draws, when the page records them.
|
|
173
|
+
* Set before the page waits for any worker's ready reply.
|
|
174
|
+
*/
|
|
175
|
+
recording;
|
|
176
|
+
started = false;
|
|
177
|
+
/** True once the worker reported that its script, and the files it imports, loaded. */
|
|
178
|
+
scriptLoaded = false;
|
|
179
|
+
/** True once the page replaced a worker whose script did not load. */
|
|
180
|
+
retried = false;
|
|
181
|
+
/**
|
|
182
|
+
* The messages that the page sent before the worker reported that its script loaded. A worker
|
|
183
|
+
* that has not run its script cannot take them, so they wait here: a copy that replaces a
|
|
184
|
+
* worker whose script did not load then gets all of them, and no message moves a canvas or a
|
|
185
|
+
* port to a worker that never ran.
|
|
186
|
+
*/
|
|
187
|
+
held = [];
|
|
188
|
+
/** True once the worker answered a stop, and false while it has not or once it failed. */
|
|
189
|
+
stoppedCleanly = false;
|
|
190
|
+
/** Settles the wait for the worker's answer to a stop of its drawing. */
|
|
191
|
+
answerStop;
|
|
192
|
+
/** Removes the current worker's error listener, for a copy or for a worker that the page keeps. */
|
|
193
|
+
unwatch;
|
|
194
|
+
constructor(worker, role,
|
|
195
|
+
/**
|
|
196
|
+
* The script that the worker runs, which a failure to start names in its error. Absent for a
|
|
197
|
+
* worker that started for an engine before, whose script did not load this time.
|
|
198
|
+
*/
|
|
199
|
+
script, events,
|
|
200
|
+
/**
|
|
201
|
+
* Starts another copy of the worker, for the one retry of a script that did not load. Absent
|
|
202
|
+
* for a worker that ran before, such as one that kept its canvas from an engine before.
|
|
203
|
+
*/
|
|
204
|
+
restart) {
|
|
205
|
+
this.role = role;
|
|
206
|
+
this.script = script;
|
|
207
|
+
this.restart = restart;
|
|
208
|
+
this.worker = worker;
|
|
209
|
+
this.readyPromise = new Promise((resolve, reject) => {
|
|
210
|
+
this.waiting.push({ resolve, reject });
|
|
211
|
+
});
|
|
212
|
+
void this.readyPromise.then(() => {
|
|
213
|
+
this.started = true;
|
|
214
|
+
}, () => { });
|
|
215
|
+
let markStopped = () => { };
|
|
216
|
+
this.stoppedPromise = new Promise((resolve) => {
|
|
217
|
+
markStopped = resolve;
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* A failure that ends the worker's loop: it fails the request that waits, such as the start's,
|
|
221
|
+
* and once the worker has started, it reaches the page's failure handler.
|
|
222
|
+
*/
|
|
223
|
+
const failed = (message) => {
|
|
224
|
+
this.stoppedCleanly = false;
|
|
225
|
+
this.waiting.shift()?.reject(startError(role, message));
|
|
226
|
+
if (this.started)
|
|
227
|
+
events.failure(failureError(`the ${role} worker`, message));
|
|
228
|
+
};
|
|
229
|
+
const listen = (worker) => {
|
|
230
|
+
worker.onmessage = (event) => {
|
|
231
|
+
const reply = event.data;
|
|
232
|
+
switch (reply.type) {
|
|
233
|
+
case 'recorded':
|
|
234
|
+
// A recording publishes the drawing thread's words, which it gives once the held
|
|
235
|
+
// frame has built the scene's pipelines.
|
|
236
|
+
this.recording?.answered(reply.role, reply.permutations);
|
|
237
|
+
return;
|
|
238
|
+
case 'sketch-message':
|
|
239
|
+
events.sketchMessage(reply.name, reply.data);
|
|
240
|
+
return;
|
|
241
|
+
case 'sketch-error':
|
|
242
|
+
events.sketchError(new Error(reply.message));
|
|
243
|
+
return;
|
|
244
|
+
case 'quality':
|
|
245
|
+
events.quality(reply.update);
|
|
246
|
+
return;
|
|
247
|
+
case 'stats':
|
|
248
|
+
events.stats(reply.show);
|
|
249
|
+
return;
|
|
250
|
+
case 'label':
|
|
251
|
+
events.labelSlot(reply.id, reply.table, reply.slot, reply.generation);
|
|
252
|
+
return;
|
|
253
|
+
case 'jobs-wanted':
|
|
254
|
+
events.jobsWanted(reply.count);
|
|
255
|
+
return;
|
|
256
|
+
case 'hold-script':
|
|
257
|
+
events.holdScript?.(reply.result);
|
|
258
|
+
return;
|
|
259
|
+
case 'replay-done':
|
|
260
|
+
events.replay?.(reply.result);
|
|
261
|
+
return;
|
|
262
|
+
case 'recording':
|
|
263
|
+
events.recording?.(reply.bytes);
|
|
264
|
+
return;
|
|
265
|
+
case 'lost':
|
|
266
|
+
forgetWorkerProbe();
|
|
267
|
+
events.failure(new EngineError('E1302', `the ${reply.role} worker lost its GPU: ${reply.reason}.`));
|
|
268
|
+
return;
|
|
269
|
+
case 'gpu-error':
|
|
270
|
+
events.failure(gpuFailure(`the ${reply.role} worker`, reply.outOfMemory, reply.message), false);
|
|
271
|
+
return;
|
|
272
|
+
case 'fault':
|
|
273
|
+
// A job worker that failed has left the job system, so a stop need not wait for it.
|
|
274
|
+
if (reply.role === 'job')
|
|
275
|
+
markStopped();
|
|
276
|
+
failed(reply.message);
|
|
277
|
+
return;
|
|
278
|
+
case 'progress':
|
|
279
|
+
// The first step says that the worker's script and the files that it imports
|
|
280
|
+
// ran, so the worker can now take the messages held for it.
|
|
281
|
+
if (reply.step === 'loaded')
|
|
282
|
+
this.scriptRan();
|
|
283
|
+
return;
|
|
284
|
+
case 'stopped':
|
|
285
|
+
this.stoppedCleanly = true;
|
|
286
|
+
markStopped();
|
|
287
|
+
this.answerStop?.();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (reply.type === 'error') {
|
|
291
|
+
markStopped();
|
|
292
|
+
// A worker that started and then failed has no request waiting for the error.
|
|
293
|
+
if (this.started && this.waiting.length === 0) {
|
|
294
|
+
failed(reply.message);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const pending = this.waiting.shift();
|
|
299
|
+
if (!pending)
|
|
300
|
+
return;
|
|
301
|
+
if (reply.type === 'error')
|
|
302
|
+
pending.reject(startError(reply.role, reply.message));
|
|
303
|
+
else
|
|
304
|
+
pending.resolve(reply);
|
|
305
|
+
};
|
|
306
|
+
this.unwatch?.();
|
|
307
|
+
this.unwatch = watchWorkerError(worker, (message) => {
|
|
308
|
+
// A worker whose script, or a file that the script imports, did not load fails before
|
|
309
|
+
// it reports its first step. That fault comes and goes, so the worker gets one more
|
|
310
|
+
// copy before the page reports it, whatever the browser's message says. A failure
|
|
311
|
+
// that the engine already named, such as a policy that blocks the script, would fail
|
|
312
|
+
// the copy the same way, so it is reported at once.
|
|
313
|
+
if (!this.scriptLoaded && this.restart && !this.retried && !errorOfMessage(message)) {
|
|
314
|
+
this.retried = true;
|
|
315
|
+
worker.terminate();
|
|
316
|
+
try {
|
|
317
|
+
const copy = this.restart();
|
|
318
|
+
this.worker = copy;
|
|
319
|
+
listen(copy);
|
|
320
|
+
events.workerRestart?.(this.role, this.script === undefined ? '' : String(this.script));
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
// The browser refused the copy too, so the page reports the first failure.
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
markStopped();
|
|
328
|
+
// A worker that ran its script fails with its own message; one that never ran names
|
|
329
|
+
// its script, which a wrong path or a host that does not serve it makes wrong.
|
|
330
|
+
failed(this.scriptLoaded ? message || 'its script failed' : this.startFailure(message));
|
|
331
|
+
this.answerStop?.();
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
listen(worker);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* What the page reports for a worker that did not start. The message names the worker's script,
|
|
338
|
+
* so a page that loads the engine's files from a wrong path, or a host that does not serve them,
|
|
339
|
+
* shows which file failed.
|
|
340
|
+
*/
|
|
341
|
+
startFailure(message) {
|
|
342
|
+
const script = this.script === undefined ? '' : String(this.script);
|
|
343
|
+
if (message)
|
|
344
|
+
return script ? `${message} (the ${this.role} worker's script is ${script})` : message;
|
|
345
|
+
const at = script
|
|
346
|
+
? `its script at ${script}, or a file that it imports, did not load`
|
|
347
|
+
: 'its script, or a file that it imports, did not load';
|
|
348
|
+
return this.retried ? `${at}, and a second copy failed too` : at;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Drops the handlers that reach this engine, so a worker that the page keeps, such as a drawing
|
|
352
|
+
* worker parked with its canvas, holds none of the engine or its shared memory alive.
|
|
353
|
+
*/
|
|
354
|
+
detach() {
|
|
355
|
+
this.unwatch?.();
|
|
356
|
+
this.unwatch = undefined;
|
|
357
|
+
this.worker.onmessage = null;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Hands the held messages to the worker, once its script has run. A worker that the page kept
|
|
361
|
+
* from an engine before reports no step, so its messages go to it at once.
|
|
362
|
+
*/
|
|
363
|
+
scriptRan() {
|
|
364
|
+
if (this.scriptLoaded)
|
|
365
|
+
return;
|
|
366
|
+
this.scriptLoaded = true;
|
|
367
|
+
for (const { message, transfer } of this.held.splice(0))
|
|
368
|
+
this.post(message, transfer);
|
|
369
|
+
}
|
|
370
|
+
/** Sends a message to the worker that the page holds now. */
|
|
371
|
+
post(message, transfer) {
|
|
372
|
+
if (transfer)
|
|
373
|
+
this.worker.postMessage(message, transfer);
|
|
374
|
+
else
|
|
375
|
+
this.worker.postMessage(message);
|
|
376
|
+
}
|
|
377
|
+
/** The worker that the page holds now, which a copy replaces if its script did not load. */
|
|
378
|
+
get handle() {
|
|
379
|
+
return this.worker;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Sends a message to the worker. A worker whose script has not run yet holds it, so that a copy
|
|
383
|
+
* that replaces a worker whose script did not load receives every message in order, and no
|
|
384
|
+
* message moves a canvas or a port to a worker that never ran.
|
|
385
|
+
*/
|
|
386
|
+
send(message, transfer) {
|
|
387
|
+
if (this.restart && !this.scriptLoaded)
|
|
388
|
+
this.held.push({ message, transfer });
|
|
389
|
+
else
|
|
390
|
+
this.post(message, transfer);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Asks the worker to stop: to run the sketch's onDestroy, and to free its GPU objects and device
|
|
394
|
+
* where it draws. Settles once it answers or fails.
|
|
395
|
+
*/
|
|
396
|
+
stopDrawing() {
|
|
397
|
+
this.stoppedCleanly = false;
|
|
398
|
+
const answered = new Promise((resolve) => {
|
|
399
|
+
this.answerStop = resolve;
|
|
400
|
+
});
|
|
401
|
+
this.send({ type: 'stop-drawing' });
|
|
402
|
+
return answered;
|
|
403
|
+
}
|
|
404
|
+
/** True when the worker answered the page's stop, so it is in a state to start again. */
|
|
405
|
+
get cleanStop() {
|
|
406
|
+
return this.stoppedCleanly;
|
|
407
|
+
}
|
|
408
|
+
ready() {
|
|
409
|
+
return this.readyPromise;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Settles once a job worker has left the job system, once the worker that draws has destroyed
|
|
413
|
+
* its GPU objects, or once the worker has failed.
|
|
414
|
+
*/
|
|
415
|
+
stopped() {
|
|
416
|
+
return this.stoppedPromise;
|
|
417
|
+
}
|
|
418
|
+
/** Stops the worker, and fails each request that still waits for its answer. */
|
|
419
|
+
terminate() {
|
|
420
|
+
this.worker.terminate();
|
|
421
|
+
for (const pending of this.waiting.splice(0))
|
|
422
|
+
pending.reject(new Error('the engine stopped'));
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Sends a request and waits for the worker's answer, which ends with a failure once the answer
|
|
426
|
+
* has taken longer than the wait's limit. The request keeps its place in the queue, so an answer
|
|
427
|
+
* that arrives late is used up in order and reaches no other request.
|
|
428
|
+
*/
|
|
429
|
+
request(message) {
|
|
430
|
+
return new Promise((resolve, reject) => {
|
|
431
|
+
let timer;
|
|
432
|
+
const pending = {
|
|
433
|
+
resolve: (reply) => {
|
|
434
|
+
clearTimeout(timer);
|
|
435
|
+
resolve(reply);
|
|
436
|
+
},
|
|
437
|
+
reject: (error) => {
|
|
438
|
+
clearTimeout(timer);
|
|
439
|
+
reject(error);
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
// A hidden page draws no frames, so its answer waits for the page to show again: the
|
|
443
|
+
// limit then starts over instead of failing the request.
|
|
444
|
+
const arm = () => {
|
|
445
|
+
timer = setTimeout(() => {
|
|
446
|
+
if (pageHidden())
|
|
447
|
+
arm();
|
|
448
|
+
else
|
|
449
|
+
pending.reject(new Error(`the ${this.role} worker did not answer the ${message.type} within ${WORKER_REPLY_LIMIT_MS / 1000} s`));
|
|
450
|
+
}, WORKER_REPLY_LIMIT_MS);
|
|
451
|
+
};
|
|
452
|
+
this.waiting.push(pending);
|
|
453
|
+
arm();
|
|
454
|
+
this.send(message);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Stops the workers once each worker in `waitFor` reports that it stopped, or after a timeout. A job
|
|
460
|
+
* worker without work blocks its thread in a wait. When Safari stops a thread inside such a wait,
|
|
461
|
+
* it keeps the thread's shared memory until the tab closes, even across reloads. The worker that
|
|
462
|
+
* draws destroys its GPU objects first, because a browser frees what a stopped worker held only
|
|
463
|
+
* when it collects the worker's objects, and Safari does that late.
|
|
464
|
+
*/
|
|
465
|
+
async function stopWorkers(workers, waitFor, keep) {
|
|
466
|
+
let timer;
|
|
467
|
+
await Promise.race([
|
|
468
|
+
Promise.all(waitFor),
|
|
469
|
+
new Promise((resolve) => {
|
|
470
|
+
timer = setTimeout(resolve, STOP_TIMEOUT_MS);
|
|
471
|
+
}),
|
|
472
|
+
]);
|
|
473
|
+
clearTimeout(timer);
|
|
474
|
+
for (const w of workers)
|
|
475
|
+
if (w !== keep)
|
|
476
|
+
w.terminate();
|
|
477
|
+
}
|
|
478
|
+
/** The two-step probe's line: the answers, the compile state, and the browser. */
|
|
479
|
+
function twoStepText(answers, compiling, parallel) {
|
|
480
|
+
const [wanted, declared, built, runs, scale] = answers;
|
|
481
|
+
return `two-step probe: ${navigator.userAgent} | wanted ${wanted} declared ${declared} built ${built} runs ${runs} scale ${scale} | compiling ${compiling} parallel ${parallel ? 1 : 0}`;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Shows the probe's line, and keeps it for the page to publish among its own figures. Every number
|
|
485
|
+
* comes from the control block: the thread that runs the sketch writes the pass's answers after
|
|
486
|
+
* each frame, and the thread that draws writes the compile state of the WebGL2 path, which is the
|
|
487
|
+
* programs that may still compile and whether its context has the extension.
|
|
488
|
+
*/
|
|
489
|
+
function sayTwoStep(slots) {
|
|
490
|
+
const answers = [
|
|
491
|
+
Slot.TwoStepWanted,
|
|
492
|
+
Slot.TwoStepDeclared,
|
|
493
|
+
Slot.TwoStepBuilt,
|
|
494
|
+
Slot.TwoStepRuns,
|
|
495
|
+
Slot.TwoStepScale,
|
|
496
|
+
].map((slot) => Atomics.load(slots, slot));
|
|
497
|
+
const compiling = Atomics.load(slots, Slot.WebglCompiling);
|
|
498
|
+
const parallel = Atomics.load(slots, Slot.WebglParallel) !== 0;
|
|
499
|
+
const line = twoStepText(answers, compiling, parallel);
|
|
500
|
+
globalThis.__null3dTwoStep = line;
|
|
501
|
+
console.warn(line);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Prints the two-step pass's answers for `?two-step=report`: the browser's user agent, whether a
|
|
505
|
+
* frame wanted the pass, declared it, had its second step built and drew it, the render scale in
|
|
506
|
+
* thousandths, and the WebGL2 path's compile state. A development tool that says which answer a
|
|
507
|
+
* browser loses.
|
|
508
|
+
*
|
|
509
|
+
* `held` reads the answers once, after the held frame that they are about. A live page turns its
|
|
510
|
+
* effect on a moment into the scene, so the first presented frame asks for nothing: the probe then
|
|
511
|
+
* watches the frames, keeps the largest answer of each, waits a second after the pass is first
|
|
512
|
+
* wanted, and prints what it saw. A page whose pass never wants prints the zeros it kept, after ten
|
|
513
|
+
* seconds.
|
|
514
|
+
*/
|
|
515
|
+
function logTwoStep(slots, held) {
|
|
516
|
+
if (held) {
|
|
517
|
+
sayTwoStep(slots);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
const end = performance.now() + 10_000;
|
|
521
|
+
const best = [0, 0, 0, 0, 0];
|
|
522
|
+
let wantedAt = 0;
|
|
523
|
+
const check = () => {
|
|
524
|
+
const answers = [
|
|
525
|
+
Slot.TwoStepWanted,
|
|
526
|
+
Slot.TwoStepDeclared,
|
|
527
|
+
Slot.TwoStepBuilt,
|
|
528
|
+
Slot.TwoStepRuns,
|
|
529
|
+
Slot.TwoStepScale,
|
|
530
|
+
].map((slot) => Atomics.load(slots, slot));
|
|
531
|
+
for (let i = 0; i < 5; i++)
|
|
532
|
+
best[i] = Math.max(best[i] ?? 0, answers[i]);
|
|
533
|
+
const now = performance.now();
|
|
534
|
+
if (answers[0]) {
|
|
535
|
+
if (wantedAt === 0)
|
|
536
|
+
wantedAt = now;
|
|
537
|
+
// A second of frames after the pass is wanted covers a pipeline that builds in the
|
|
538
|
+
// background, which the frame that wanted it may have missed.
|
|
539
|
+
if (now - wantedAt < 1000) {
|
|
540
|
+
requestAnimationFrame(check);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
else if (now < end) {
|
|
545
|
+
requestAnimationFrame(check);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
sayTwoStep(slots);
|
|
549
|
+
};
|
|
550
|
+
requestAnimationFrame(check);
|
|
551
|
+
}
|
|
552
|
+
/** Every worker of a set, in the order the page stops them. */
|
|
553
|
+
function allWorkers(workers) {
|
|
554
|
+
if (!workers)
|
|
555
|
+
return [];
|
|
556
|
+
return [workers.sketch, workers.render, ...workers.jobs].filter((w) => w !== undefined);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Starts job worker `index`. It joins the job system once it is ready: until then the sketch thread
|
|
560
|
+
* and the job workers already running take every chunk, so no frame waits for it. `started` hears
|
|
561
|
+
* once it is ready, so the thread that runs the sketch learns which workers run. A job worker that
|
|
562
|
+
* fails to start is reported as a failure of the running engine, and returns undefined when the
|
|
563
|
+
* browser refuses it at once.
|
|
564
|
+
*/
|
|
565
|
+
function startJobWorker(index, slots, events, started) {
|
|
566
|
+
const failed = (error) => {
|
|
567
|
+
if (Atomics.load(slots, Slot.Running) !== 0)
|
|
568
|
+
events.failure(error instanceof EngineError ? error : startError(`job ${index}`, messageOf(error)), false);
|
|
569
|
+
};
|
|
570
|
+
const start = () => new Worker(new URL('../workers/job-worker.js', import.meta.url), {
|
|
571
|
+
type: 'module',
|
|
572
|
+
name: `null3d-job-${index}`,
|
|
573
|
+
});
|
|
574
|
+
try {
|
|
575
|
+
const first = startEngineWorker(start);
|
|
576
|
+
const job = new EngineWorker(first.worker, `job ${index}`, first.script, events, () => startEngineWorker(start).worker);
|
|
577
|
+
job.ready().then(() => started(index), (error) => failed(error));
|
|
578
|
+
return job;
|
|
579
|
+
}
|
|
580
|
+
catch (thrown) {
|
|
581
|
+
failed(thrown);
|
|
582
|
+
return undefined;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Starts an engine worker from a start function, with the engine's own error codes for a failure
|
|
587
|
+
* of a worker's bootstrap from another origin.
|
|
588
|
+
*/
|
|
589
|
+
function startEngineWorker(start) {
|
|
590
|
+
const worker = spawnWorker(start, (code, message) => new EngineError(code, message));
|
|
591
|
+
return { worker, script: startedWorkerScript() };
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Starts the engine's workers: the sketch worker unless the page runs the sketch, and the render
|
|
595
|
+
* worker when it draws. The page starts them before the core has compiled, so their scripts and the
|
|
596
|
+
* core's loader download while the core does. Each worker waits for its start message, which
|
|
597
|
+
* carries the core. The job workers start later, as the thread that runs the sketch asks for them.
|
|
598
|
+
* `reused` is the drawing worker that kept the canvas when an engine before stopped, which serves
|
|
599
|
+
* in its role again.
|
|
600
|
+
*/
|
|
601
|
+
function startWorkers(sketchWorker, renderWorker, events, reused) {
|
|
602
|
+
/** Each worker as it starts, so that a refusal can stop the ones before it. */
|
|
603
|
+
const made = [];
|
|
604
|
+
/**
|
|
605
|
+
* Starts a worker, and keeps a function that starts another copy of it. A script, or a file
|
|
606
|
+
* that the script imports, can fail to load now and then; the engine tries one more copy
|
|
607
|
+
* before it reports the worker as failed.
|
|
608
|
+
*/
|
|
609
|
+
const kept = (start) => {
|
|
610
|
+
const first = startEngineWorker(start);
|
|
611
|
+
made.push(first.worker);
|
|
612
|
+
return {
|
|
613
|
+
worker: first.worker,
|
|
614
|
+
script: first.script,
|
|
615
|
+
restart: () => {
|
|
616
|
+
const copy = startEngineWorker(start);
|
|
617
|
+
made.push(copy.worker);
|
|
618
|
+
return copy.worker;
|
|
619
|
+
},
|
|
620
|
+
};
|
|
621
|
+
};
|
|
622
|
+
/** A worker that ran for an engine before keeps its script: there is nothing to load again. */
|
|
623
|
+
const keptBefore = (role) => reused?.role === role
|
|
624
|
+
? { worker: reused.worker, script: undefined, restart: undefined }
|
|
625
|
+
: undefined;
|
|
626
|
+
try {
|
|
627
|
+
const sketchStart = sketchWorker
|
|
628
|
+
? (keptBefore('sketch') ??
|
|
629
|
+
kept(() => new Worker(new URL('../workers/sketch-worker.js', import.meta.url), {
|
|
630
|
+
type: 'module',
|
|
631
|
+
name: 'null3d-sketch',
|
|
632
|
+
})))
|
|
633
|
+
: undefined;
|
|
634
|
+
const renderStart = renderWorker
|
|
635
|
+
? (keptBefore('render') ??
|
|
636
|
+
kept(() => new Worker(new URL('../workers/render-worker.js', import.meta.url), {
|
|
637
|
+
type: 'module',
|
|
638
|
+
name: 'null3d-render',
|
|
639
|
+
})))
|
|
640
|
+
: undefined;
|
|
641
|
+
const sketch = sketchStart
|
|
642
|
+
? new EngineWorker(sketchStart.worker, 'sketch', sketchStart.script, events, sketchStart.restart)
|
|
643
|
+
: undefined;
|
|
644
|
+
const render = renderStart
|
|
645
|
+
? new EngineWorker(renderStart.worker, 'render', renderStart.script, events, renderStart.restart)
|
|
646
|
+
: undefined;
|
|
647
|
+
return { sketch, render, jobs: [] };
|
|
648
|
+
}
|
|
649
|
+
catch (thrown) {
|
|
650
|
+
// A browser that refuses a worker at once, such as for a script address it cannot read.
|
|
651
|
+
for (const worker of made)
|
|
652
|
+
worker.terminate();
|
|
653
|
+
const reason = thrown instanceof Error ? thrown.message : String(thrown);
|
|
654
|
+
throw new EngineError('E1405', `the browser refused to start an engine worker: ${reason}.`);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
/** The path of an address, which names a sketch across the machines that serve it. */
|
|
658
|
+
function pathOf(address) {
|
|
659
|
+
try {
|
|
660
|
+
return new URL(address, globalThis.location?.href).pathname;
|
|
661
|
+
}
|
|
662
|
+
catch {
|
|
663
|
+
return address;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* The recording that `address` names, downloaded and read before the engine starts, so a file that
|
|
668
|
+
* is not a recording fails the start with a message rather than a page that runs nothing. The
|
|
669
|
+
* recording must be of the sketch that this page runs, or its frames mean nothing.
|
|
670
|
+
*/
|
|
671
|
+
async function readReplay(address, sketchUrl) {
|
|
672
|
+
let url;
|
|
673
|
+
try {
|
|
674
|
+
url = new URL(address, globalThis.location?.href);
|
|
675
|
+
}
|
|
676
|
+
catch {
|
|
677
|
+
throw new EngineError('E1435', `?replay=${address} is not an address. Give the address of a recording file, such as ?replay=/bug.n3dr.`);
|
|
678
|
+
}
|
|
679
|
+
let response;
|
|
680
|
+
try {
|
|
681
|
+
response = await fetch(url);
|
|
682
|
+
}
|
|
683
|
+
catch (error) {
|
|
684
|
+
throw new EngineError('E1435', `createEngine() could not download the recording ${url.href}: ${messageOf(error)}. Check the address, and that the file's server sends it to this page's origin.`);
|
|
685
|
+
}
|
|
686
|
+
if (!response.ok)
|
|
687
|
+
throw new EngineError('E1435', `the server answered ${response.status} for the recording ${url.href}. Check that the file is there, and that its server sends it to this page's origin.`);
|
|
688
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
689
|
+
const { decodeRecording } = await import('../shared/recording.js');
|
|
690
|
+
let program;
|
|
691
|
+
try {
|
|
692
|
+
program = decodeRecording(bytes);
|
|
693
|
+
}
|
|
694
|
+
catch (error) {
|
|
695
|
+
throw new EngineError('E1435', `createEngine() could not read the recording ${url.href}: ${messageOf(error)}`);
|
|
696
|
+
}
|
|
697
|
+
// The recording's own origin is the machine that made it, which a replay never shares. The
|
|
698
|
+
// sketch's path is what names the scene.
|
|
699
|
+
if (pathOf(program.sketch) !== pathOf(sketchUrl))
|
|
700
|
+
throw new EngineError('E1435', `the recording was made with the sketch ${program.sketch}, and this page runs ${sketchUrl}. Open the page with the sketch that recorded the session.`);
|
|
701
|
+
return program;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Downloads a file into the browser's cache, for a worker that imports it later. A host that lets
|
|
705
|
+
* the browser keep build files, as the null3D Vite plugin asks, then saves the worker a round trip.
|
|
706
|
+
* A failed download only loses that head start: the worker's own import reports the failure.
|
|
707
|
+
*/
|
|
708
|
+
function prefetch(url) {
|
|
709
|
+
fetch(url)
|
|
710
|
+
.then((response) => response.arrayBuffer())
|
|
711
|
+
.catch(() => { });
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Starts the engine on the page. It tests the device, picks the build and the GPU path, starts the
|
|
715
|
+
* workers, and runs the sketch module. In hold mode it also steps the sketch to the held time, then
|
|
716
|
+
* draws that frame and reads it back. It publishes the frame, or the error that stopped it, as
|
|
717
|
+
* `window.__null3dHold` for test tools. With the `?bench` switch, it publishes the running engine
|
|
718
|
+
* as `window.__null3dEngine`, where a benchmark tool calls `measure`.
|
|
719
|
+
*
|
|
720
|
+
* @category api/engine
|
|
721
|
+
*/
|
|
722
|
+
export async function createEngine(options) {
|
|
723
|
+
const switches = parseSwitches(URL_SWITCHES ? (globalThis.location?.search ?? '') : '');
|
|
724
|
+
const holding = options.hold !== undefined || switches.hold !== undefined || switches.replay !== undefined;
|
|
725
|
+
const place = placement(options, switches);
|
|
726
|
+
if (DEV && !warnedIsolation) {
|
|
727
|
+
const warning = lostIsolationWarning(pageIsolation());
|
|
728
|
+
if (warning) {
|
|
729
|
+
warnedIsolation = true;
|
|
730
|
+
console.warn(warning);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
const canvas = canvasHold(options.canvas);
|
|
734
|
+
// This engine's hold on the canvas, and on the page's copy of the core when its sketch runs on
|
|
735
|
+
// the page. Each serves one engine at a time.
|
|
736
|
+
const holder = new Holder();
|
|
737
|
+
const release = () => {
|
|
738
|
+
if (pageSketch === holder)
|
|
739
|
+
pageSketch = undefined;
|
|
740
|
+
if (canvas.holder === holder)
|
|
741
|
+
canvas.holder = undefined;
|
|
742
|
+
holder.endStop();
|
|
743
|
+
};
|
|
744
|
+
try {
|
|
745
|
+
checkPreload(options.preload);
|
|
746
|
+
const hold = holdSeconds(options.hold, switches.hold);
|
|
747
|
+
// A test tool may set a timed script before the page loads. Only hold mode performs it, so a
|
|
748
|
+
// live engine ignores one left on the page.
|
|
749
|
+
const holdScript = hold === undefined ? undefined : readHoldScript();
|
|
750
|
+
if (holding)
|
|
751
|
+
publishHold(undefined);
|
|
752
|
+
if (place.sketchThread === 'main')
|
|
753
|
+
await takeWhenFree(() => pageSketch, () => {
|
|
754
|
+
pageSketch = holder;
|
|
755
|
+
}, () => new EngineError('E1415', 'createEngine() found another engine that runs its sketch on this page, which has not stopped.'));
|
|
756
|
+
await takeWhenFree(() => canvas.holder, () => {
|
|
757
|
+
canvas.holder = holder;
|
|
758
|
+
}, () => new EngineError('E1419', 'createEngine() got a canvas that another engine draws on, which has not stopped.'));
|
|
759
|
+
if (canvas.dead)
|
|
760
|
+
throw new EngineError('E1419', `createEngine() got a canvas that no engine can draw on again: ${canvas.dead}.`);
|
|
761
|
+
return await startEngine(options, switches, { hold, holdScript, replay: switches.replay, record: switches.record }, place, canvas, holder, release);
|
|
762
|
+
}
|
|
763
|
+
catch (error) {
|
|
764
|
+
release();
|
|
765
|
+
// A coded error's fix arrives in a file of its own, and a failed start reports it whole.
|
|
766
|
+
await errorFixesReady();
|
|
767
|
+
if (holding)
|
|
768
|
+
publishHold(holdFailure(error));
|
|
769
|
+
throw error;
|
|
770
|
+
}
|
|
771
|
+
finally {
|
|
772
|
+
holder.startSettled();
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
/** Throws E1421 for a name in `preload` that names no feature whose shaders load on first use. */
|
|
776
|
+
function checkPreload(preload) {
|
|
777
|
+
const known = SHADER_FEATURES;
|
|
778
|
+
for (const feature of preload ?? [])
|
|
779
|
+
if (!known.includes(feature))
|
|
780
|
+
throw new EngineError('E1421', `createEngine() got '${feature}' in preload. The features are ${known.join(', ')}.`);
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Picks the build and the sketch's thread from facts the page has at once, so the core downloads
|
|
784
|
+
* and compiles while the probe tests the GPU paths. The threaded build needs shared memory, and the
|
|
785
|
+
* single-threaded build runs the sketch on the page's thread.
|
|
786
|
+
*/
|
|
787
|
+
function placement(options, switches) {
|
|
788
|
+
const threaded = globalThis.crossOriginIsolated === true &&
|
|
789
|
+
typeof SharedArrayBuffer === 'function' &&
|
|
790
|
+
switches.threads;
|
|
791
|
+
const main = !threaded || (switches.sketchThread ?? options.sketchThread) === 'main';
|
|
792
|
+
return { threaded, sketchThread: main ? 'main' : 'worker' };
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Starts the engine with the page's switches. With a hold time or a replay, it resolves once the
|
|
796
|
+
* last frame is read back, and publishes it.
|
|
797
|
+
*/
|
|
798
|
+
async function startEngine(options, switches, modes, { threaded, sketchThread }, canvasHold, holder, release) {
|
|
799
|
+
const { hold, holdScript } = modes;
|
|
800
|
+
const startedAt = performance.now();
|
|
801
|
+
/** Ends a development build's hearing of add-ons for a runner that does not exist yet. */
|
|
802
|
+
let stopEarlyAddons;
|
|
803
|
+
/** Set once the start reaches the try whose failure stops the engine. */
|
|
804
|
+
let startTried = false;
|
|
805
|
+
const { signal } = options;
|
|
806
|
+
// A page's progress handler that throws is the page's error: the console shows it, and the
|
|
807
|
+
// start goes on.
|
|
808
|
+
const onProgress = (stage, progress) => {
|
|
809
|
+
try {
|
|
810
|
+
options.onProgress?.(stage, progress);
|
|
811
|
+
}
|
|
812
|
+
catch (error) {
|
|
813
|
+
console.error(error);
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
signal?.throwIfAborted();
|
|
817
|
+
const pageUrl = globalThis.location?.href;
|
|
818
|
+
const sketchUrl = new URL(options.sketch, pageUrl).href;
|
|
819
|
+
const replay = modes.replay === undefined ? undefined : await readReplay(modes.replay, sketchUrl);
|
|
820
|
+
// A replay records nothing of its own: it runs a file that already holds the frames and input.
|
|
821
|
+
const record = modes.record && replay === undefined;
|
|
822
|
+
// The quality preset follows the device hints and the crash marker, which the page has at once,
|
|
823
|
+
// so its memory maximum is known before the core loads. Hold mode and the ?preset= switch fix
|
|
824
|
+
// the preset for tests, so they neither read nor write the marker.
|
|
825
|
+
const marker = hold === undefined && replay === undefined && switches.preset === undefined
|
|
826
|
+
? new StartMarker(sketchUrl)
|
|
827
|
+
: undefined;
|
|
828
|
+
const history = marker?.read() ?? NO_HISTORY;
|
|
829
|
+
const optionPreset = presetOption(options.preset);
|
|
830
|
+
// The highest frame rate that the preset check, the governor and the stats overlay aim for.
|
|
831
|
+
const optionTarget = targetFpsOption(options.targetFps);
|
|
832
|
+
const maxTarget = maxTargetFps(switches.targetFps ?? optionTarget, switches.fps);
|
|
833
|
+
const pageSettings = {
|
|
834
|
+
maxPixelRatio: options.maxPixelRatio,
|
|
835
|
+
antialias: options.antialias,
|
|
836
|
+
shadowCascades: options.shadowCascades,
|
|
837
|
+
shadowMapSize: options.shadowMapSize,
|
|
838
|
+
shadowTiles: options.shadowTiles,
|
|
839
|
+
shadowTileSize: options.shadowTileSize,
|
|
840
|
+
heroTileSize: options.heroTileSize,
|
|
841
|
+
pointLightShadows: options.pointLightShadows,
|
|
842
|
+
depthPrepass: switches.prepass ?? options.depthPrepass,
|
|
843
|
+
momentTransparency: switches.moments ?? options.momentTransparency,
|
|
844
|
+
gpuOcclusion: switches.occlusion ?? options.gpuOcclusion,
|
|
845
|
+
morphTargets: options.morphTargets,
|
|
846
|
+
cloudSteps: options.cloudSteps,
|
|
847
|
+
softwareOcclusion: switches.occlusion ?? options.softwareOcclusion,
|
|
848
|
+
textureMemoryMiB: options.textureMemoryMiB,
|
|
849
|
+
};
|
|
850
|
+
checkSettings('createEngine()', pageSettings);
|
|
851
|
+
const presetRequest = {
|
|
852
|
+
wanted: switches.preset ?? optionPreset,
|
|
853
|
+
hints: readDeviceHints(),
|
|
854
|
+
crashedStarts: history.crashed,
|
|
855
|
+
};
|
|
856
|
+
/**
|
|
857
|
+
* The engine keeps a copy of each texture's texels after their upload where the device is a
|
|
858
|
+
* phone or a tablet, which is likeliest to lose its GPU, unless the page's option says
|
|
859
|
+
* otherwise (D-164).
|
|
860
|
+
*/
|
|
861
|
+
const keepTextureCopies = keepTextureCopiesOption(options.keepTextureCopies, deviceKind(presetRequest.hints) !== 'desktop');
|
|
862
|
+
const maximumMiB = memoryMaximumMiB(options.memory?.maximumMiB, switches.memoryMiB, presetValue('memoryMaximumMiB', memoryPreset(presetRequest)));
|
|
863
|
+
// Checked before any download, so an old browser learns at once why the engine cannot run.
|
|
864
|
+
checkBrowser();
|
|
865
|
+
const build = threaded ? 'threaded' : 'single';
|
|
866
|
+
let latency = threaded
|
|
867
|
+
? (switches.latency ?? options.latency ?? 'pipelined')
|
|
868
|
+
: 'single';
|
|
869
|
+
const sketchOnPage = sketchThread === 'main';
|
|
870
|
+
let coreMs = 0;
|
|
871
|
+
const coreLoad = awaitLater(loadCore(build, maximumMiB, () => onProgress('memory-wait'),
|
|
872
|
+
// The core's bytes are a stage of their own, so a page's bar measures them apart from
|
|
873
|
+
// the scene's files and names what it counts.
|
|
874
|
+
(done, total) => onProgress('core-download', { done, total, unit: 'bytes' })).then((loaded) => {
|
|
875
|
+
coreMs = performance.now() - startedAt;
|
|
876
|
+
return loaded;
|
|
877
|
+
}));
|
|
878
|
+
// A page that runs the sketch itself needs the core's loader, the sketch runner and the sketch
|
|
879
|
+
// module right after the core, so they download while the core does: each later start delays the
|
|
880
|
+
// first frame by a round trip on a slow network. The sketch module's top-level code then runs when
|
|
881
|
+
// the module arrives. Hold mode loads the module once the runner has seeded the thread's random
|
|
882
|
+
// numbers, so that code draws the same numbers on every run.
|
|
883
|
+
if (sketchOnPage)
|
|
884
|
+
void awaitLater(loadGlue(build));
|
|
885
|
+
const runnerModule = sketchOnPage ? loadRunnerModule() : undefined;
|
|
886
|
+
// A development build with input off hears each add-on that the sketch's module loads, such as
|
|
887
|
+
// @null3d/controls, from before the load begins, and hands them to the runner once it exists.
|
|
888
|
+
let earlyAddons;
|
|
889
|
+
if (DEV && sketchOnPage && hold === undefined && options.input === false) {
|
|
890
|
+
const heard = [];
|
|
891
|
+
earlyAddons = heard;
|
|
892
|
+
stopEarlyAddons = onAddonChecked((name) => heard.push(name));
|
|
893
|
+
// The start runs on with no wait to the try below, whose failure stops the engine and this
|
|
894
|
+
// hearing with it. A start that throws before that try ends the hearing here.
|
|
895
|
+
queueMicrotask(() => {
|
|
896
|
+
if (!startTried)
|
|
897
|
+
stopEarlyAddons?.();
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
const sketchModule = sketchOnPage && hold === undefined ? awaitLater(loadSketch(sketchUrl)) : undefined;
|
|
901
|
+
const powerPreference = options.powerPreference ?? DEFAULT_POWER_PREFERENCE;
|
|
902
|
+
const messageHandlers = new Set();
|
|
903
|
+
if (options.onSketchMessage)
|
|
904
|
+
messageHandlers.add(options.onSketchMessage);
|
|
905
|
+
// The add-on features' figures, which the stats overlay shows beside the engine's own. Each
|
|
906
|
+
// add-on keeps its list, so two add-ons show side by side and one that stops leaves the other's.
|
|
907
|
+
const featureLists = new Map();
|
|
908
|
+
let features = [];
|
|
909
|
+
// Messages sent before the page listens wait for the first handler. The newest are kept when a
|
|
910
|
+
// sketch sends many.
|
|
911
|
+
let earlyMessages = options.onSketchMessage ? undefined : [];
|
|
912
|
+
const onSketchMessage = (name, data) => {
|
|
913
|
+
if (name === FEATURE_STATS_MESSAGE) {
|
|
914
|
+
features = mergeFeatureStats(featureLists, data);
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
if (name === VIDEO_FOLLOW) {
|
|
918
|
+
const message = data;
|
|
919
|
+
if (typeof message?.name === 'string')
|
|
920
|
+
videos?.follow(message.name, message.follow === true);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
if (earlyMessages) {
|
|
924
|
+
if (earlyMessages.push([name, data]) > MAX_EARLY_MESSAGES)
|
|
925
|
+
earlyMessages.shift();
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
for (const handler of messageHandlers)
|
|
929
|
+
handler(name, data);
|
|
930
|
+
};
|
|
931
|
+
const failureHandlers = new Set();
|
|
932
|
+
const stopHandlers = new Set();
|
|
933
|
+
/** True once the engine draws no new frames, which each stop handler hears once. */
|
|
934
|
+
let drawingEnded = false;
|
|
935
|
+
/** Runs a stop handler. One that throws is the page's error, which the console shows. */
|
|
936
|
+
const runStopHandler = (handler) => {
|
|
937
|
+
try {
|
|
938
|
+
handler();
|
|
939
|
+
}
|
|
940
|
+
catch (error) {
|
|
941
|
+
console.error(error);
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
const endDrawing = () => {
|
|
945
|
+
if (drawingEnded)
|
|
946
|
+
return;
|
|
947
|
+
drawingEnded = true;
|
|
948
|
+
const handlers = [...stopHandlers];
|
|
949
|
+
stopHandlers.clear();
|
|
950
|
+
// The other handlers and the stop go on past one that throws.
|
|
951
|
+
for (const handler of handlers)
|
|
952
|
+
runStopHandler(handler);
|
|
953
|
+
};
|
|
954
|
+
const sketchErrorHandlers = new Set();
|
|
955
|
+
/**
|
|
956
|
+
* The failures that the engine reported while no handler listened, for the first handler that
|
|
957
|
+
* does: a failure that reaches nothing is worse than a slow path.
|
|
958
|
+
*/
|
|
959
|
+
const earlyFailures = [];
|
|
960
|
+
const reported = new Set();
|
|
961
|
+
const onSketchError = (error) => {
|
|
962
|
+
for (const handler of sketchErrorHandlers)
|
|
963
|
+
handler(error);
|
|
964
|
+
};
|
|
965
|
+
if (options.onSketchError)
|
|
966
|
+
sketchErrorHandlers.add(options.onSketchError);
|
|
967
|
+
/** Where a start that checks its preset keeps the check's result for later starts. */
|
|
968
|
+
let checkStore;
|
|
969
|
+
/**
|
|
970
|
+
* Ends the start when the caller cancels it, or when a thread fails before the engine has
|
|
971
|
+
* started. A thread that fails then, such as the one that draws, leaves the start waiting for
|
|
972
|
+
* frames that never come, and the page could never stop the engine that it never got.
|
|
973
|
+
*/
|
|
974
|
+
const start = new AbortController();
|
|
975
|
+
let starting = true;
|
|
976
|
+
const cancelStart = () => start.abort(signal?.reason);
|
|
977
|
+
signal?.addEventListener('abort', cancelStart, { once: true });
|
|
978
|
+
const onFailure = (error, endsStart = true) => {
|
|
979
|
+
if (reported.has(error.message))
|
|
980
|
+
return;
|
|
981
|
+
reported.add(error.message);
|
|
982
|
+
if (starting && endsStart) {
|
|
983
|
+
start.abort(error);
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
// The failure reaches its handlers, or the console, before the stop handlers hear that the
|
|
987
|
+
// frames ended, so a page hears why before it hears that.
|
|
988
|
+
try {
|
|
989
|
+
if (failureHandlers.size === 0) {
|
|
990
|
+
earlyFailures.push(error);
|
|
991
|
+
console.error(error);
|
|
992
|
+
}
|
|
993
|
+
else
|
|
994
|
+
for (const handler of failureHandlers)
|
|
995
|
+
handler(error);
|
|
996
|
+
}
|
|
997
|
+
finally {
|
|
998
|
+
if (FAILURES_THAT_END_DRAWING.has(error.code))
|
|
999
|
+
endDrawing();
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
// The GPU path, the mode and the threads, which the start sets once the probe has run. The
|
|
1003
|
+
// handlers below read them only after that.
|
|
1004
|
+
let tier;
|
|
1005
|
+
let mode;
|
|
1006
|
+
let engineThreads;
|
|
1007
|
+
/** What a timed script's steps gave in the sketch worker, which the held result publishes. */
|
|
1008
|
+
let scriptResult;
|
|
1009
|
+
/** What a replay gave in the sketch worker, which the held result publishes. */
|
|
1010
|
+
let replayResult;
|
|
1011
|
+
/** The calls that wait for the session's recording, which the sketch thread answers together. */
|
|
1012
|
+
const recordingWaiters = [];
|
|
1013
|
+
const events = {
|
|
1014
|
+
sketchMessage: onSketchMessage,
|
|
1015
|
+
sketchError: onSketchError,
|
|
1016
|
+
failure: onFailure,
|
|
1017
|
+
// The page applies the settings that it owns: the pixel ratio cap sizes the canvas. The
|
|
1018
|
+
// engine's mode reports the preset and the preset check, which the page stores for later
|
|
1019
|
+
// starts.
|
|
1020
|
+
quality: (update) => {
|
|
1021
|
+
canvasWatch?.setMaxPixelRatio(update.settings.maxPixelRatio);
|
|
1022
|
+
mode.preset = update.preset;
|
|
1023
|
+
if (!update.check)
|
|
1024
|
+
return;
|
|
1025
|
+
mode.presetCheck = update.check;
|
|
1026
|
+
checkStore?.save(update.check, maxTarget);
|
|
1027
|
+
},
|
|
1028
|
+
stats: (show) => statsSwitch.show(show),
|
|
1029
|
+
labelSlot: (id, table, slot, generation) => pageLabels?.setSlot(id, table, slot, generation),
|
|
1030
|
+
jobsWanted: (count) => growJobs?.(count),
|
|
1031
|
+
holdScript: (result) => {
|
|
1032
|
+
scriptResult = result;
|
|
1033
|
+
},
|
|
1034
|
+
// A recovered worker is not a failure, so the page hears it here and in the console, never
|
|
1035
|
+
// through onFailure.
|
|
1036
|
+
workerRestart: (role, script) => {
|
|
1037
|
+
console.warn(`null3D: the ${role} worker did not load its script at ${script}, so the engine started a second copy.`);
|
|
1038
|
+
options.onWorkerRetry?.(role, script);
|
|
1039
|
+
},
|
|
1040
|
+
replay: (result) => {
|
|
1041
|
+
replayResult = result;
|
|
1042
|
+
},
|
|
1043
|
+
recording: (bytes) => {
|
|
1044
|
+
for (const resolve of recordingWaiters.splice(0))
|
|
1045
|
+
resolve(bytes);
|
|
1046
|
+
},
|
|
1047
|
+
};
|
|
1048
|
+
/** Starts job workers up to a count, once the core is ready to hand them. */
|
|
1049
|
+
let growJobs;
|
|
1050
|
+
/** The page's labels, once the page knows which thread draws. */
|
|
1051
|
+
let pageLabels;
|
|
1052
|
+
/** The page's video calls, which load the video support's code at their first call. */
|
|
1053
|
+
let videos;
|
|
1054
|
+
const jobWorkers = threaded
|
|
1055
|
+
? jobWorkerCount(switches.jobs, navigator.hardwareConcurrency ?? 1)
|
|
1056
|
+
: 0;
|
|
1057
|
+
const control = createControlBuffer(threaded, labelCapacity(options.maxLabels), labelCapacity3d(options.maxLabels3d));
|
|
1058
|
+
const expectedObjects = expectedObjectCount(options.expectedObjects);
|
|
1059
|
+
const metrics = createMetricsBuffer(threaded, jobWorkers);
|
|
1060
|
+
// The frame figures go on the page as the start makes them, so a test tool can time a start
|
|
1061
|
+
// that stalls before it publishes anything, and read the sketch's growth, the first draw's
|
|
1062
|
+
// pipelines and the first frame beside the steps it has noted.
|
|
1063
|
+
globalThis.__null3dMetrics = metrics;
|
|
1064
|
+
const views = controlViews(control);
|
|
1065
|
+
const { slots } = views;
|
|
1066
|
+
if (switches.replayDelay !== undefined)
|
|
1067
|
+
Atomics.store(slots, Slot.ReplayDelayMs, switches.replayDelay);
|
|
1068
|
+
// Hold mode, a replay and the image tests draw each frame as it is: a still view there must not
|
|
1069
|
+
// accumulate or rest, so a captured frame is the frame the sketch drew once.
|
|
1070
|
+
if (!switches.still ||
|
|
1071
|
+
options.still === false ||
|
|
1072
|
+
options.hold !== undefined ||
|
|
1073
|
+
switches.hold !== undefined ||
|
|
1074
|
+
switches.replay !== undefined)
|
|
1075
|
+
Atomics.store(slots, Slot.StillOff, 1);
|
|
1076
|
+
const statsSwitch = new StatsSwitch(() => ({
|
|
1077
|
+
canvas: options.canvas,
|
|
1078
|
+
metrics,
|
|
1079
|
+
threads: engineThreads,
|
|
1080
|
+
sources: {
|
|
1081
|
+
tier,
|
|
1082
|
+
preset: () => mode.preset,
|
|
1083
|
+
renderScaleThousandths: () => Atomics.load(slots, Slot.RenderScale),
|
|
1084
|
+
wasmBytes: () => memoryBytes(wasmMemory) ?? 0,
|
|
1085
|
+
},
|
|
1086
|
+
sharedMemory: threaded,
|
|
1087
|
+
maxTargetFps: maxTarget,
|
|
1088
|
+
gpuFeatures,
|
|
1089
|
+
mode,
|
|
1090
|
+
features: () => features,
|
|
1091
|
+
}));
|
|
1092
|
+
Atomics.store(slots, Slot.Running, 1);
|
|
1093
|
+
/**
|
|
1094
|
+
* The thread that draws, unless the probe finds that a worker cannot draw here. In low-latency
|
|
1095
|
+
* mode the thread that runs the sketch draws too.
|
|
1096
|
+
*/
|
|
1097
|
+
let renderThread = latency === 'single' || switches.renderOnMain
|
|
1098
|
+
? 'main'
|
|
1099
|
+
: latency === 'low'
|
|
1100
|
+
? sketchOnPage
|
|
1101
|
+
? 'main'
|
|
1102
|
+
: 'sketch-worker'
|
|
1103
|
+
: 'render-worker';
|
|
1104
|
+
// A canvas that an engine before drew on keeps the thread that drew: the page, whose context it
|
|
1105
|
+
// has, or the worker that it moved to, which the page can never take it back from.
|
|
1106
|
+
if (canvasHold.pageContext && renderThread !== 'main') {
|
|
1107
|
+
latency = 'pipelined';
|
|
1108
|
+
renderThread = 'main';
|
|
1109
|
+
}
|
|
1110
|
+
const movedTo = canvasHold.movedTo;
|
|
1111
|
+
if (movedTo === 'render' && renderThread === 'sketch-worker') {
|
|
1112
|
+
latency = 'pipelined';
|
|
1113
|
+
renderThread = 'render-worker';
|
|
1114
|
+
}
|
|
1115
|
+
const drawingRole = renderThread === 'render-worker'
|
|
1116
|
+
? 'render'
|
|
1117
|
+
: renderThread === 'sketch-worker'
|
|
1118
|
+
? 'sketch'
|
|
1119
|
+
: undefined;
|
|
1120
|
+
if (movedTo && movedTo !== drawingRole)
|
|
1121
|
+
throw new EngineError('E1419', `createEngine() got a canvas whose ${movedTo} worker drew for an engine before, and this engine draws ${renderThread === 'main' ? 'on the page' : 'in its sketch worker'}. Start it with the same options as that engine, or on a new canvas element`);
|
|
1122
|
+
// A page that draws loads the renderer while the core downloads too. When the probe finds that a
|
|
1123
|
+
// worker cannot draw here, the page loads it as soon as the probe ends.
|
|
1124
|
+
let drawModule = renderThread === 'main' ? loadDrawModule() : undefined;
|
|
1125
|
+
/** The worker that keeps the canvas from an engine before, which draws for this one. */
|
|
1126
|
+
const keptWorker = movedTo ? takeParkedWorker(options.canvas, canvasHold) : undefined;
|
|
1127
|
+
// With worker threads the page starts the workers now. A sketch worker gets the sketch module
|
|
1128
|
+
// into the browser's cache, and still runs the module only after it has started the core.
|
|
1129
|
+
const threads = threaded
|
|
1130
|
+
? startWorkers(!sketchOnPage, renderThread === 'render-worker', events, keptWorker && movedTo && { worker: keptWorker, role: movedTo })
|
|
1131
|
+
: undefined;
|
|
1132
|
+
if (threads?.sketch) {
|
|
1133
|
+
prefetch(sketchUrl);
|
|
1134
|
+
// In low-latency mode the sketch worker draws, so it loads the renderer now too.
|
|
1135
|
+
if (renderThread === 'sketch-worker')
|
|
1136
|
+
threads.sketch.send({ type: 'load-renderer' });
|
|
1137
|
+
}
|
|
1138
|
+
// What the start sets up, which a stop takes down again, from any point of the start.
|
|
1139
|
+
let coreMemory;
|
|
1140
|
+
/** The engine's WebAssembly memory as the page sees it, once the core has loaded. */
|
|
1141
|
+
let wasmMemory;
|
|
1142
|
+
/** The GPU features or WebGL2 extensions that the engine found, once it has probed the device. */
|
|
1143
|
+
let gpuFeatures = [];
|
|
1144
|
+
let memoryKey;
|
|
1145
|
+
/** True while the page's own core starts in the shared memory. */
|
|
1146
|
+
let pageCoreStarting = false;
|
|
1147
|
+
let canvasWatch;
|
|
1148
|
+
/** The page's input capture, which exists only while the engine takes input from the page. */
|
|
1149
|
+
let input;
|
|
1150
|
+
/** True once `engine.requestPointerLock` took the lock, which the engine then gives back as it stops. */
|
|
1151
|
+
let tookLock = false;
|
|
1152
|
+
let stopPreferences;
|
|
1153
|
+
let stopDisplay;
|
|
1154
|
+
let rendererHost;
|
|
1155
|
+
/** The job workers that got the core, which a stop waits for. */
|
|
1156
|
+
let jobsWithCore = [];
|
|
1157
|
+
// While the browser measures the page's memory, this engine's idle job workers run their
|
|
1158
|
+
// threads' tasks, so the measurement never waits on a blocked thread.
|
|
1159
|
+
const removeMeasurementRelease = addMeasurementRelease(() => coreMemory ? yieldJobWorkers(coreMemory, slots) : () => { });
|
|
1160
|
+
/** The sketch worker and the render worker once they got the core, which a stop asks to stop. */
|
|
1161
|
+
const withCore = new Set();
|
|
1162
|
+
/** The worker that holds the canvas, or will once the start moves it there. */
|
|
1163
|
+
let canvasWorker = movedTo === 'render' ? threads?.render : movedTo ? threads?.sketch : undefined;
|
|
1164
|
+
let localDrawing;
|
|
1165
|
+
let localRunner;
|
|
1166
|
+
/** Sends the sketch a message, here where the page runs it, or through its worker. */
|
|
1167
|
+
const sendToSketch = (name, data, transfer = []) => {
|
|
1168
|
+
if (localRunner)
|
|
1169
|
+
localRunner.receive(name, data);
|
|
1170
|
+
else
|
|
1171
|
+
threads?.sketch?.send({ type: 'post', name, data }, transfer);
|
|
1172
|
+
};
|
|
1173
|
+
// The sketch asks for a video's frames from its setup, before the page registers the video, so
|
|
1174
|
+
// the calls wait for the code and then run in the order that the page and the sketch made them.
|
|
1175
|
+
let videoSupport;
|
|
1176
|
+
let videoSupportLoading;
|
|
1177
|
+
let videoSupportStopped = false;
|
|
1178
|
+
const videoCalls = [];
|
|
1179
|
+
const loadVideoSupport = () => {
|
|
1180
|
+
if (videoSupport || videoSupportStopped)
|
|
1181
|
+
return;
|
|
1182
|
+
videoSupportLoading ??= import('./videos.js').then(({ PageVideos }) => {
|
|
1183
|
+
if (videoSupportStopped)
|
|
1184
|
+
return;
|
|
1185
|
+
videoSupport = new PageVideos(sendToSketch);
|
|
1186
|
+
for (const call of videoCalls.splice(0))
|
|
1187
|
+
call();
|
|
1188
|
+
});
|
|
1189
|
+
};
|
|
1190
|
+
videos = {
|
|
1191
|
+
register(video, options) {
|
|
1192
|
+
let stop;
|
|
1193
|
+
let stopped = false;
|
|
1194
|
+
const call = () => {
|
|
1195
|
+
if (!stopped)
|
|
1196
|
+
stop = videoSupport?.register(video, options);
|
|
1197
|
+
};
|
|
1198
|
+
if (videoSupport)
|
|
1199
|
+
call();
|
|
1200
|
+
else
|
|
1201
|
+
videoCalls.push(call);
|
|
1202
|
+
loadVideoSupport();
|
|
1203
|
+
return () => {
|
|
1204
|
+
stopped = true;
|
|
1205
|
+
stop?.();
|
|
1206
|
+
};
|
|
1207
|
+
},
|
|
1208
|
+
follow(name, follow) {
|
|
1209
|
+
const call = () => {
|
|
1210
|
+
videoSupport?.follow(name, follow);
|
|
1211
|
+
};
|
|
1212
|
+
if (videoSupport)
|
|
1213
|
+
call();
|
|
1214
|
+
else
|
|
1215
|
+
videoCalls.push(call);
|
|
1216
|
+
loadVideoSupport();
|
|
1217
|
+
},
|
|
1218
|
+
dispose() {
|
|
1219
|
+
videoSupportStopped = true;
|
|
1220
|
+
videoCalls.length = 0;
|
|
1221
|
+
videoSupport?.dispose();
|
|
1222
|
+
},
|
|
1223
|
+
};
|
|
1224
|
+
/**
|
|
1225
|
+
* The page's core, when the page runs the sketch. The page keeps the single-threaded build's core
|
|
1226
|
+
* for the next engine it starts. The threaded build's core lives in the engine's own shared
|
|
1227
|
+
* memory, so each engine starts a core of its own.
|
|
1228
|
+
*/
|
|
1229
|
+
let localCore;
|
|
1230
|
+
/** The job workers' task ports that the page's on-demand loader uses, when the page runs the sketch. */
|
|
1231
|
+
let jobTaskHost;
|
|
1232
|
+
/**
|
|
1233
|
+
* The channels between the engine's threads, which the page keeps until the stop. Firefox drops
|
|
1234
|
+
* the unread messages of a port that moved to a worker once the page collects the port it moved,
|
|
1235
|
+
* if they hold image bitmaps or WebAssembly modules: the receiver then gets a messageerror event.
|
|
1236
|
+
*/
|
|
1237
|
+
const channels = [];
|
|
1238
|
+
const channel = () => {
|
|
1239
|
+
const made = new MessageChannel();
|
|
1240
|
+
channels.push(made);
|
|
1241
|
+
return made;
|
|
1242
|
+
};
|
|
1243
|
+
let stopping;
|
|
1244
|
+
/** The marker of a start that may crash the tab, which the start sets once it knows the tier. */
|
|
1245
|
+
let markerSet = false;
|
|
1246
|
+
/**
|
|
1247
|
+
* Ends the job workers' loops at once. A page that leaves without stopping the engine, such as a
|
|
1248
|
+
* page in a frame that goes away, does it too, because the browser then stops the workers
|
|
1249
|
+
* wherever they are.
|
|
1250
|
+
*/
|
|
1251
|
+
const stopJobs = () => {
|
|
1252
|
+
if (coreMemory)
|
|
1253
|
+
stopJobWorkers(coreMemory, slots);
|
|
1254
|
+
};
|
|
1255
|
+
const stopJobsAsPageLeaves = () => {
|
|
1256
|
+
stopJobs();
|
|
1257
|
+
waitForJobWorkersToLeave(slots);
|
|
1258
|
+
};
|
|
1259
|
+
/** On the dev server, hands each hot update of WGSL to the thread that runs the sketch. */
|
|
1260
|
+
const updateShaders = (event) => {
|
|
1261
|
+
const updates = event.detail;
|
|
1262
|
+
if (localRunner)
|
|
1263
|
+
localRunner.updateShaders(updates);
|
|
1264
|
+
else
|
|
1265
|
+
threads?.sketch?.send({ type: 'wgsl', updates });
|
|
1266
|
+
};
|
|
1267
|
+
/**
|
|
1268
|
+
* Stops every loop and then the workers, and wakes each thread that waits, so it sees the stop.
|
|
1269
|
+
* It works from any point of the start. Then it drops the page's engine, lets go of the page's
|
|
1270
|
+
* threaded core, and leaves the canvas to the next engine: a worker that holds it stays, without
|
|
1271
|
+
* the core and the GPU device, unless it failed. A second call returns the first call's promise.
|
|
1272
|
+
*/
|
|
1273
|
+
const stop = () => {
|
|
1274
|
+
if (DEV)
|
|
1275
|
+
stopEarlyAddons?.();
|
|
1276
|
+
stopping ??= (async () => {
|
|
1277
|
+
holder.beginStop();
|
|
1278
|
+
Atomics.store(slots, Slot.Running, 0);
|
|
1279
|
+
// A thread that checked the slots just before the stop and is about to wait on one finds
|
|
1280
|
+
// its value changed, so it never sleeps through the stop.
|
|
1281
|
+
Atomics.store(slots, Slot.JobsReady, 1);
|
|
1282
|
+
Atomics.store(slots, Slot.Paused, 2);
|
|
1283
|
+
stopJobs();
|
|
1284
|
+
removeMeasurementRelease();
|
|
1285
|
+
globalThis.removeEventListener?.('pagehide', stopJobsAsPageLeaves);
|
|
1286
|
+
globalThis.removeEventListener?.(WGSL_UPDATE_EVENT, updateShaders);
|
|
1287
|
+
statsSwitch.show(false);
|
|
1288
|
+
for (const slot of [
|
|
1289
|
+
Slot.Running,
|
|
1290
|
+
Slot.FramesTaken,
|
|
1291
|
+
Slot.Paused,
|
|
1292
|
+
Slot.JobsReady,
|
|
1293
|
+
Slot.PipelinesBuilt,
|
|
1294
|
+
])
|
|
1295
|
+
notifySlot(slots, slot, threads?.sketch?.handle);
|
|
1296
|
+
await localDrawing?.stop();
|
|
1297
|
+
localRunner?.dispose();
|
|
1298
|
+
videos?.dispose();
|
|
1299
|
+
input?.listen(false);
|
|
1300
|
+
// A stopped engine reads no input, so it gives back a lock that its input read or that it
|
|
1301
|
+
// took. With input off it took none, and a lock on the canvas is the page's own.
|
|
1302
|
+
if ((input !== undefined || tookLock) &&
|
|
1303
|
+
globalThis.document?.pointerLockElement === options.canvas)
|
|
1304
|
+
document.exitPointerLock();
|
|
1305
|
+
canvasWatch?.listen(false);
|
|
1306
|
+
stopPreferences?.();
|
|
1307
|
+
stopDisplay?.();
|
|
1308
|
+
// A start that fails or stops has not crashed the tab.
|
|
1309
|
+
if (markerSet)
|
|
1310
|
+
marker?.end();
|
|
1311
|
+
const waitFor = jobsWithCore.map((job) => job.stopped());
|
|
1312
|
+
// The sketch worker runs the sketch's onDestroy, and the worker that draws destroys its GPU
|
|
1313
|
+
// objects and its device, before each answers.
|
|
1314
|
+
for (const worker of withCore)
|
|
1315
|
+
if (!jobsWithCore.includes(worker))
|
|
1316
|
+
waitFor.push(worker.stopDrawing());
|
|
1317
|
+
await stopWorkers(allWorkers(threads), waitFor, canvasWorker);
|
|
1318
|
+
// A channel's ports keep the engine's closures alive while they stay open: a port with a
|
|
1319
|
+
// listener is a pending activity, which the page never collects. The engine has stopped, so
|
|
1320
|
+
// close both ends and let go of the channels.
|
|
1321
|
+
for (const { port1, port2 } of channels) {
|
|
1322
|
+
port1.close();
|
|
1323
|
+
port2.close();
|
|
1324
|
+
}
|
|
1325
|
+
channels.length = 0;
|
|
1326
|
+
leaveCanvas();
|
|
1327
|
+
// The render worker may have been inside a frame when the engine stopped, replaying a draw
|
|
1328
|
+
// list that the page's engine holds, so the engine stays until that worker has stopped.
|
|
1329
|
+
localCore?.destroyEngine();
|
|
1330
|
+
// The job workers have left the job system, so the page's threaded core has no more work,
|
|
1331
|
+
// and the browser can free the engine's memory once the page lets go of the core and of the
|
|
1332
|
+
// loader's call into it.
|
|
1333
|
+
clearJobTasks(jobTaskHost);
|
|
1334
|
+
localCore?.releaseInstance?.();
|
|
1335
|
+
release();
|
|
1336
|
+
keepCoreMemory();
|
|
1337
|
+
})();
|
|
1338
|
+
// The stop has begun, its slots written, before the stop handlers hear of it.
|
|
1339
|
+
endDrawing();
|
|
1340
|
+
return stopping;
|
|
1341
|
+
};
|
|
1342
|
+
/**
|
|
1343
|
+
* Keeps the threaded core's memory for the page's next engine once no thread of this engine can
|
|
1344
|
+
* run in it: every thread that got the core answered the stop, and the page's own core is not
|
|
1345
|
+
* still starting. A memory that no thread got yet, from a start that ended first, is kept too.
|
|
1346
|
+
*/
|
|
1347
|
+
const keepCoreMemory = () => {
|
|
1348
|
+
if (!coreMemory) {
|
|
1349
|
+
void coreLoad.then((core) => core.memory && core.memoryKey && keepMemory(core.memory, core.memoryKey), () => undefined);
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
const left = [...jobsWithCore, ...withCore].every((worker) => worker.cleanStop);
|
|
1353
|
+
if (memoryKey && left && !pageCoreStarting)
|
|
1354
|
+
keepMemory(coreMemory, memoryKey);
|
|
1355
|
+
};
|
|
1356
|
+
/**
|
|
1357
|
+
* Leaves the canvas to the next engine. A worker that holds it and answered the stop, or never
|
|
1358
|
+
* got this engine's core, stays with it; one that failed ends, and the canvas with it.
|
|
1359
|
+
*/
|
|
1360
|
+
const leaveCanvas = () => {
|
|
1361
|
+
if (!canvasWorker || !canvasHold.movedTo)
|
|
1362
|
+
return;
|
|
1363
|
+
if (withCore.has(canvasWorker) && !canvasWorker.cleanStop) {
|
|
1364
|
+
canvasWorker.terminate();
|
|
1365
|
+
canvasHold.dead = `its ${canvasHold.movedTo} worker did not stop cleanly`;
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
canvasWorker.send({ type: 'park' });
|
|
1369
|
+
canvasWorker.detach();
|
|
1370
|
+
parkWorker(options.canvas, canvasHold, canvasWorker.handle, canvasHold.movedTo);
|
|
1371
|
+
};
|
|
1372
|
+
startTried = true;
|
|
1373
|
+
try {
|
|
1374
|
+
const report = await abortable(probeCapabilities(powerPreference, presetRequest.hints, switches.multiDraw), signal);
|
|
1375
|
+
const probeMs = performance.now() - startedAt;
|
|
1376
|
+
const requested = switches.gpu !== 'auto' ? switches.gpu : (options.gpu ?? 'auto');
|
|
1377
|
+
// After starts that crashed on WebGPU, WebGL2 comes first, unless the page names a GPU path.
|
|
1378
|
+
const safeGpu = requested === 'auto' ? crashTier(history.crashed, history.lastTier) : undefined;
|
|
1379
|
+
const pickTier = (inWorker) => (safeGpu && chooseTier(report, safeGpu, inWorker)) || chooseTier(report, requested, inWorker);
|
|
1380
|
+
let choice = pickTier(renderThread !== 'main');
|
|
1381
|
+
let renderFallback = null;
|
|
1382
|
+
if (!choice && renderThread !== 'main' && !movedTo) {
|
|
1383
|
+
// Worker rendering is unavailable here, so the page draws while the sketch worker computes
|
|
1384
|
+
// the frames, in pipelined mode. Low latency needs the sketch worker to draw.
|
|
1385
|
+
renderFallback = 'failure' in report.worker ? report.worker.failure : 'no-surface';
|
|
1386
|
+
if (DEV && !warnedFallback) {
|
|
1387
|
+
warnedFallback = true;
|
|
1388
|
+
console.warn(`null3D: the page draws instead of a worker, because ${fallbackText(report)}. The page's thread then shares its time with the drawing until the page reloads. engine.mode.renderFallback and engine.report.worker give the reason.`);
|
|
1389
|
+
}
|
|
1390
|
+
if (DEV && latency === 'low')
|
|
1391
|
+
console.warn('null3D: low latency needs a worker that draws, and this browser cannot draw in a worker. The engine runs in pipelined mode, and the page draws.');
|
|
1392
|
+
latency = 'pipelined';
|
|
1393
|
+
renderThread = 'main';
|
|
1394
|
+
choice = pickTier(false);
|
|
1395
|
+
threads?.render?.terminate();
|
|
1396
|
+
if (threads)
|
|
1397
|
+
threads.render = undefined;
|
|
1398
|
+
drawModule ??= loadDrawModule();
|
|
1399
|
+
}
|
|
1400
|
+
if (!choice)
|
|
1401
|
+
throw new EngineError('E1301', `no usable GPU path for ?gpu=${requested} in this browser.`);
|
|
1402
|
+
tier = choice.tier;
|
|
1403
|
+
const { forceCompat } = choice;
|
|
1404
|
+
// Where the page draws, it moves the label elements right after each frame it draws.
|
|
1405
|
+
const labels = new PageLabels(views, renderThread === 'main');
|
|
1406
|
+
pageLabels = labels;
|
|
1407
|
+
const chosen = choosePreset(presetRequest, tier);
|
|
1408
|
+
// The engine checks a preset that it chose itself, when a lighter one exists. A preset that the
|
|
1409
|
+
// page, a switch or hold mode fixes stays as it is. A start after a crash measures again, and
|
|
1410
|
+
// so does one that ?check=fresh asks to. Otherwise the result of an earlier check of the sketch
|
|
1411
|
+
// on this device and browser gives the preset at once, while it applies.
|
|
1412
|
+
const checks = optionPreset === 'auto' &&
|
|
1413
|
+
switches.preset === undefined &&
|
|
1414
|
+
hold === undefined &&
|
|
1415
|
+
chosen !== 'low';
|
|
1416
|
+
if (checks && history.crashed === 0) {
|
|
1417
|
+
const { width, height } = options.canvas.getBoundingClientRect();
|
|
1418
|
+
const conditions = checkConditions(report, tier, chosen, switches.fps, maxTarget);
|
|
1419
|
+
checkStore = new CheckStore(sketchUrl, conditions, width * height);
|
|
1420
|
+
}
|
|
1421
|
+
const storedCheck = switches.freshCheck ? undefined : checkStore?.read();
|
|
1422
|
+
const preset = storedCheck?.rounds.at(-1)?.preset ?? chosen;
|
|
1423
|
+
// Occlusion culling on the GPU needs WebGPU's compute passes. Phones and tablets run it only
|
|
1424
|
+
// when the page asks.
|
|
1425
|
+
const gpuOcclusion = tier === 'webgl2'
|
|
1426
|
+
? false
|
|
1427
|
+
: gpuOcclusionChoice(deviceKind(presetRequest.hints), pageSettings.gpuOcclusion);
|
|
1428
|
+
const tierSettings = { ...pageSettings, gpuOcclusion };
|
|
1429
|
+
const textureCapMiB = textureMemoryCap(deviceKind(presetRequest.hints));
|
|
1430
|
+
const quality = {
|
|
1431
|
+
preset,
|
|
1432
|
+
settings: capTextureMemory(checkedSettings(chosen, preset, tierSettings, tier), tierSettings, textureCapMiB),
|
|
1433
|
+
options: tierSettings,
|
|
1434
|
+
textureCapMiB,
|
|
1435
|
+
keepCopies: keepTextureCopies,
|
|
1436
|
+
highest: withinTier('ultra', tier),
|
|
1437
|
+
check: checks && !storedCheck,
|
|
1438
|
+
};
|
|
1439
|
+
mode = {
|
|
1440
|
+
build,
|
|
1441
|
+
latency: latency === 'pipelined' && sketchOnPage && renderThread === 'main' ? 'low' : latency,
|
|
1442
|
+
sketchThread,
|
|
1443
|
+
renderThread,
|
|
1444
|
+
jobWorkers,
|
|
1445
|
+
hold: hold ?? null,
|
|
1446
|
+
preset,
|
|
1447
|
+
presetCheck: storedCheck ?? null,
|
|
1448
|
+
crashedStarts: history.crashed,
|
|
1449
|
+
memoryMaximumMiB: threaded ? maximumMiB : null,
|
|
1450
|
+
renderFallback,
|
|
1451
|
+
keepTextureCopies,
|
|
1452
|
+
};
|
|
1453
|
+
/**
|
|
1454
|
+
* The preset that the first frame draws at: the one the engine starts with, because its own
|
|
1455
|
+
* preset check draws that frame before it can step down. The page can end on a lighter preset,
|
|
1456
|
+
* so the measurement keeps this one.
|
|
1457
|
+
*/
|
|
1458
|
+
const firstFramePreset = preset;
|
|
1459
|
+
/** Each engine thread's name and the roles it runs, for the frame figures. */
|
|
1460
|
+
engineThreads = [...threadRoles(mode)];
|
|
1461
|
+
// A recording run gathers the words of every thread that draws, and publishes them where the
|
|
1462
|
+
// tool that writes the build's list reads them.
|
|
1463
|
+
const recording = switches.permutations === 'record'
|
|
1464
|
+
? new PermutationRecording(renderThread === 'render-worker'
|
|
1465
|
+
? 'render'
|
|
1466
|
+
: renderThread === 'sketch-worker'
|
|
1467
|
+
? 'sketch'
|
|
1468
|
+
: 'page')
|
|
1469
|
+
: undefined;
|
|
1470
|
+
if (recording)
|
|
1471
|
+
for (const worker of allWorkers(threads))
|
|
1472
|
+
worker.recording = recording;
|
|
1473
|
+
/**
|
|
1474
|
+
* Ends the recording and lets the drawing thread answer with its words. A held page runs it
|
|
1475
|
+
* once its frame has drawn the scene's pipelines, and a live page when the tool that records
|
|
1476
|
+
* has driven the page through its states.
|
|
1477
|
+
*/
|
|
1478
|
+
const stopRecording = () => {
|
|
1479
|
+
if (!recording)
|
|
1480
|
+
return;
|
|
1481
|
+
if (renderThread === 'main') {
|
|
1482
|
+
recording.answered('page', stopRecordingPermutations());
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
const worker = renderThread === 'render-worker' ? threads?.render : threads?.sketch;
|
|
1486
|
+
worker?.send({ type: 'stop-recording' });
|
|
1487
|
+
};
|
|
1488
|
+
// A live page has no held frame to end its recording, so the tool that records calls the
|
|
1489
|
+
// page's stop once the page has shown every state that it offers.
|
|
1490
|
+
if (recording && hold === undefined)
|
|
1491
|
+
globalThis.__null3dStopRecording = stopRecording;
|
|
1492
|
+
if (recording && renderThread === 'main')
|
|
1493
|
+
recordPermutations();
|
|
1494
|
+
// What the thread that draws needs besides its canvas, whichever thread that is.
|
|
1495
|
+
const rendererSetup = {
|
|
1496
|
+
tier,
|
|
1497
|
+
forceCompat,
|
|
1498
|
+
powerPreference,
|
|
1499
|
+
fps: switches.fps,
|
|
1500
|
+
queue: switches.queue,
|
|
1501
|
+
displayChecks: switches.displayChecks,
|
|
1502
|
+
// A replay draws the frames it holds as a hold does: from the first frame that it made
|
|
1503
|
+
// every GPU object on, so that frame's creations reach the device before the last
|
|
1504
|
+
// frame draws with them.
|
|
1505
|
+
hold: hold !== undefined || replay !== undefined,
|
|
1506
|
+
glTiming: switches.glTiming,
|
|
1507
|
+
gpuSamples: switches.gpuSamples,
|
|
1508
|
+
preload: options.preload,
|
|
1509
|
+
// The recording run lists the words that the scene draws with, for a narrowed build.
|
|
1510
|
+
recordPermutations: switches.permutations === 'record',
|
|
1511
|
+
cloudSteps: quality.settings.cloudSteps,
|
|
1512
|
+
};
|
|
1513
|
+
const device = coreDevice(tier, report, {
|
|
1514
|
+
...switches,
|
|
1515
|
+
// The switch and the option can both only take the 8-bit path, and the switch wins.
|
|
1516
|
+
hdr: switches.hdr && options.hdr !== false,
|
|
1517
|
+
antialias: quality.settings.antialias,
|
|
1518
|
+
transparent: options.transparent === true,
|
|
1519
|
+
depthPrepass: quality.settings.depthPrepass,
|
|
1520
|
+
largeWorld: options.largeWorld === true,
|
|
1521
|
+
expectedObjects,
|
|
1522
|
+
gpuOcclusion: quality.settings.gpuOcclusion,
|
|
1523
|
+
});
|
|
1524
|
+
// The GPU path and the device's fixed bits choose the renderers and the shader file that the
|
|
1525
|
+
// thread that draws loads first, so it starts their downloads now, while the core downloads.
|
|
1526
|
+
const shaderPreload = { type: 'load-shaders', tier, bits: device.shaderBits };
|
|
1527
|
+
if (renderThread === 'render-worker')
|
|
1528
|
+
threads?.render?.send(shaderPreload);
|
|
1529
|
+
else if (renderThread === 'sketch-worker')
|
|
1530
|
+
threads?.sketch?.send(shaderPreload);
|
|
1531
|
+
else if (drawModule)
|
|
1532
|
+
preloadDeviceFiles(drawModule, tier, device.shaderBits);
|
|
1533
|
+
const core = await abortable(coreLoad, signal);
|
|
1534
|
+
coreMemory = core.memory;
|
|
1535
|
+
memoryKey = core.memoryKey;
|
|
1536
|
+
onProgress('core');
|
|
1537
|
+
wasmMemory = core.memory;
|
|
1538
|
+
const capabilities = {
|
|
1539
|
+
tier,
|
|
1540
|
+
threaded,
|
|
1541
|
+
features: tier === 'webgl2'
|
|
1542
|
+
? Object.keys(report.webgl2.extensions).filter((n) => report.webgl2.extensions[n])
|
|
1543
|
+
: report.webgpu.features,
|
|
1544
|
+
limits: tier === 'webgl2' ? {} : report.webgpu.limits,
|
|
1545
|
+
hdr: device.sceneColor !== FORMAT_CANVAS,
|
|
1546
|
+
halfPrecision: (device.shaderBits & PERMUTATION_HALF) !== 0,
|
|
1547
|
+
maxInstances: maxInstances(device),
|
|
1548
|
+
maxCanvasSize: maxCanvasSize(tier, report),
|
|
1549
|
+
depth: device.depth,
|
|
1550
|
+
directDraws: device.directDraws,
|
|
1551
|
+
drawPath: drawPath(tier, report, switches.direct).reason,
|
|
1552
|
+
};
|
|
1553
|
+
gpuFeatures = capabilities.features;
|
|
1554
|
+
// Where the browser lacks Atomics.waitAsync, the threads wake each other with messages.
|
|
1555
|
+
const wakeByMessage = switches.wakeByMessage || !report.atomicsWaitAsync;
|
|
1556
|
+
setWakeByMessage(wakeByMessage);
|
|
1557
|
+
const handoff = {
|
|
1558
|
+
build,
|
|
1559
|
+
module: core.module,
|
|
1560
|
+
memory: core.memory,
|
|
1561
|
+
control,
|
|
1562
|
+
metrics,
|
|
1563
|
+
device: {
|
|
1564
|
+
...device,
|
|
1565
|
+
memoryMaximumMiB: threaded && !switches.hideMemoryMaximum ? maximumMiB : undefined,
|
|
1566
|
+
},
|
|
1567
|
+
wakeByMessage,
|
|
1568
|
+
};
|
|
1569
|
+
// Only a canvas that no engine used before may need its CSS size fixed: the fix resizes the
|
|
1570
|
+
// canvas, which a canvas in a worker refuses.
|
|
1571
|
+
const watch = watchCanvas(options.canvas, control, quality.settings.maxPixelRatio, capabilities.maxCanvasSize, !canvasHold.sized);
|
|
1572
|
+
canvasHold.sized = true;
|
|
1573
|
+
canvasWatch = watch;
|
|
1574
|
+
watch.listen(true);
|
|
1575
|
+
// Hold mode keeps input out, so a held frame never depends on it. A page whose input another
|
|
1576
|
+
// library records turns it off, and then the engine adds no listener at all.
|
|
1577
|
+
const pageInput = hold === undefined && replay === undefined && options.input !== false
|
|
1578
|
+
? captureInput(options.canvas, control)
|
|
1579
|
+
: undefined;
|
|
1580
|
+
input = pageInput;
|
|
1581
|
+
pageInput?.listen(true);
|
|
1582
|
+
// A development build's sketch thread then says when the sketch relies on input.
|
|
1583
|
+
if (DEV && options.input === false)
|
|
1584
|
+
Atomics.store(slots, Slot.InputOff, 1);
|
|
1585
|
+
stopPreferences = watchPreferences(slots);
|
|
1586
|
+
// A worker that draws holds its frames to the display's rate, which only the page can measure.
|
|
1587
|
+
stopDisplay = renderThread !== 'main' && hold === undefined ? watchDisplay(slots) : undefined;
|
|
1588
|
+
let userPaused = false;
|
|
1589
|
+
let detached = false;
|
|
1590
|
+
const applyPause = () => {
|
|
1591
|
+
const paused = userPaused || detached;
|
|
1592
|
+
pageInput?.listen(!paused);
|
|
1593
|
+
// Counted before the flag clears, so the sketch's first step after the pause sees it.
|
|
1594
|
+
if (!paused && Atomics.load(slots, Slot.Paused) !== 0)
|
|
1595
|
+
Atomics.add(slots, Slot.Resumes, 1);
|
|
1596
|
+
Atomics.store(slots, Slot.Paused, paused ? 1 : 0);
|
|
1597
|
+
notifySlot(slots, Slot.Paused, threads?.sketch?.handle);
|
|
1598
|
+
};
|
|
1599
|
+
const pageLoss = (reason) => {
|
|
1600
|
+
forgetWorkerProbe();
|
|
1601
|
+
onFailure(new EngineError('E1302', `the page lost its GPU: ${reason}.`));
|
|
1602
|
+
};
|
|
1603
|
+
let draw;
|
|
1604
|
+
/**
|
|
1605
|
+
* Draws on the page's thread from the draw lists in `memory`, with the renderer that the page
|
|
1606
|
+
* loads for it. With a sketch, the page steps it before each draw. Texture images come into the
|
|
1607
|
+
* page's table from that sketch, or through a port from the sketch worker.
|
|
1608
|
+
*/
|
|
1609
|
+
const drawOnPage = async (memory, images, sketch) => {
|
|
1610
|
+
draw = await (drawModule ?? loadDrawModule());
|
|
1611
|
+
// The page's context stays with the canvas: an engine after this one draws on the page too.
|
|
1612
|
+
canvasHold.pageContext = true;
|
|
1613
|
+
return draw.startDrawing({
|
|
1614
|
+
canvas: options.canvas,
|
|
1615
|
+
...rendererSetup,
|
|
1616
|
+
metrics,
|
|
1617
|
+
device,
|
|
1618
|
+
scene: memory && { memory, control },
|
|
1619
|
+
control,
|
|
1620
|
+
sketch,
|
|
1621
|
+
...images,
|
|
1622
|
+
presented: () => labels.update(),
|
|
1623
|
+
fail: pageLoss,
|
|
1624
|
+
fault: (error) => onFailure(failureError('the drawing on the page', messageOf(error))),
|
|
1625
|
+
gpuError: (outOfMemory, message) => onFailure(gpuFailure('the page', outOfMemory, message), false),
|
|
1626
|
+
});
|
|
1627
|
+
};
|
|
1628
|
+
if (threads && jobWorkers > 0)
|
|
1629
|
+
globalThis.addEventListener?.('pagehide', stopJobsAsPageLeaves);
|
|
1630
|
+
if (DEV)
|
|
1631
|
+
globalThis.addEventListener?.(WGSL_UPDATE_EVENT, updateShaders);
|
|
1632
|
+
/**
|
|
1633
|
+
* Makes a port for each job worker that the engine may start, for the on-demand loader's
|
|
1634
|
+
* tasks, and returns the other end of each, for the thread that runs the sketch. The job
|
|
1635
|
+
* workers start as that thread asks for them: each gets the core and its port as it starts,
|
|
1636
|
+
* and that thread then hears which of them run, so it sends its tasks only to those.
|
|
1637
|
+
* A stop waits until each started job worker reports that it left the job system, which one
|
|
1638
|
+
* without the core never does.
|
|
1639
|
+
*/
|
|
1640
|
+
const startJobs = (jobs) => {
|
|
1641
|
+
jobsWithCore = jobs;
|
|
1642
|
+
const taskPorts = Array.from({ length: jobWorkers }, () => channel());
|
|
1643
|
+
/** The job workers that started, by index, which the on-demand loader sends its tasks to. */
|
|
1644
|
+
const running = [];
|
|
1645
|
+
/** Notes a job worker that started, by its index. */
|
|
1646
|
+
const noteStarted = (index) => running.push(index);
|
|
1647
|
+
growJobs = (count) => {
|
|
1648
|
+
const starting = [];
|
|
1649
|
+
for (let index = jobs.length; index < Math.min(count, jobWorkers); index++) {
|
|
1650
|
+
if (Atomics.load(slots, Slot.Running) === 0)
|
|
1651
|
+
break;
|
|
1652
|
+
const job = startJobWorker(index, slots, events, noteStarted);
|
|
1653
|
+
if (!job)
|
|
1654
|
+
break;
|
|
1655
|
+
jobs.push(job);
|
|
1656
|
+
const port = taskPorts[index].port1;
|
|
1657
|
+
job.send({ type: 'init', ...handoff, index, taskPort: port }, [port]);
|
|
1658
|
+
starting.push(job.ready());
|
|
1659
|
+
}
|
|
1660
|
+
// The sketch thread hears which of a batch of job workers run once the whole batch has
|
|
1661
|
+
// settled, so it never takes a worker for running before the batch is known. A batch
|
|
1662
|
+
// that started no worker, because the browser refused them or the engine is stopping,
|
|
1663
|
+
// stays unheard: the thread then uses the workers it asked for. A sketch on this page
|
|
1664
|
+
// reads the news itself, since no sketch worker carries it.
|
|
1665
|
+
if (starting.length === 0)
|
|
1666
|
+
return;
|
|
1667
|
+
void Promise.allSettled(starting).then(() => {
|
|
1668
|
+
running.sort((a, b) => a - b);
|
|
1669
|
+
threads?.sketch?.send({ type: 'job-workers', running: [...running] });
|
|
1670
|
+
if (jobTaskHost)
|
|
1671
|
+
jobTaskHost.running = [...running];
|
|
1672
|
+
});
|
|
1673
|
+
};
|
|
1674
|
+
return taskPorts.map((tasks) => tasks.port2);
|
|
1675
|
+
};
|
|
1676
|
+
/**
|
|
1677
|
+
* Moves the canvas to the worker that draws, unless that worker kept it from an engine before.
|
|
1678
|
+
* Returns the canvas to hand over, if any.
|
|
1679
|
+
*/
|
|
1680
|
+
const moveCanvas = (worker, role) => {
|
|
1681
|
+
canvasWorker = worker;
|
|
1682
|
+
if (canvasHold.movedTo)
|
|
1683
|
+
return undefined;
|
|
1684
|
+
const canvas = options.canvas.transferControlToOffscreen();
|
|
1685
|
+
canvasHold.movedTo = role;
|
|
1686
|
+
return canvas;
|
|
1687
|
+
};
|
|
1688
|
+
/** Hands the canvas and the core to the render worker, with the port that images come through. */
|
|
1689
|
+
const startRenderWorker = (render, imagePort) => {
|
|
1690
|
+
const canvas = moveCanvas(render, 'render');
|
|
1691
|
+
render.send({ type: 'init', ...handoff, canvas, ...rendererSetup, imagePort }, canvas ? [canvas, imagePort] : [imagePort]);
|
|
1692
|
+
rendererHost = render;
|
|
1693
|
+
withCore.add(render);
|
|
1694
|
+
};
|
|
1695
|
+
marker?.begin(history, tier);
|
|
1696
|
+
markerSet = true;
|
|
1697
|
+
if (sketchOnPage) {
|
|
1698
|
+
// The page starts its core before the workers get theirs. The first core in a new shared
|
|
1699
|
+
// memory fills it with the core's data, and a core that starts while another fills it
|
|
1700
|
+
// waits, which the page's thread must never do.
|
|
1701
|
+
const coreStart = startCore(build, core.module, core.memory);
|
|
1702
|
+
pageCoreStarting = true;
|
|
1703
|
+
void coreStart
|
|
1704
|
+
.catch(() => undefined)
|
|
1705
|
+
.then(() => {
|
|
1706
|
+
pageCoreStarting = false;
|
|
1707
|
+
});
|
|
1708
|
+
const started = await abortable(coreStart, start.signal).catch((error) => {
|
|
1709
|
+
// A start that ends while the page's core starts lets go of that core once it has
|
|
1710
|
+
// started, or the core would keep the engine's memory.
|
|
1711
|
+
void coreStart.then(({ glue }) => glue.releaseInstance?.(), () => undefined);
|
|
1712
|
+
throw error;
|
|
1713
|
+
});
|
|
1714
|
+
localCore = started.glue;
|
|
1715
|
+
const memory = started.memory;
|
|
1716
|
+
wasmMemory = memory;
|
|
1717
|
+
const imageTable = new ImageTable();
|
|
1718
|
+
const render = threads?.render;
|
|
1719
|
+
// The page's on-demand loader sends its tasks to this engine's job workers; without them, it
|
|
1720
|
+
// starts a task worker. The job workers start as the tasks and the frames' parallel work
|
|
1721
|
+
// ask for them.
|
|
1722
|
+
const glue = started.glue;
|
|
1723
|
+
const wantJobs = jobAsker(jobWorkers, (count) => growJobs?.(count));
|
|
1724
|
+
jobTaskHost = {
|
|
1725
|
+
ports: threads ? startJobs(threads.jobs) : [],
|
|
1726
|
+
call: (index) => glue.callJobWorker(index),
|
|
1727
|
+
want: wantJobs,
|
|
1728
|
+
};
|
|
1729
|
+
setJobTasks(jobTaskHost);
|
|
1730
|
+
let imagePort;
|
|
1731
|
+
if (render) {
|
|
1732
|
+
// The setup can wait for frames of the render worker: in hold mode, for a warm-up, and
|
|
1733
|
+
// for the preset check. So a render worker that does not start ends the start at once.
|
|
1734
|
+
render.ready().catch((error) => start.abort(error));
|
|
1735
|
+
// Texture images and custom materials' shaders go from the page straight to the render
|
|
1736
|
+
// worker.
|
|
1737
|
+
const images = channel();
|
|
1738
|
+
imagePort = images.port1;
|
|
1739
|
+
startRenderWorker(render, images.port2);
|
|
1740
|
+
}
|
|
1741
|
+
const senders = drawingSenders(imageTable, slots, imagePort);
|
|
1742
|
+
const { SketchRunner, runPipelined } = await (runnerModule ?? loadRunnerModule());
|
|
1743
|
+
localRunner = new SketchRunner((name, data) => onSketchMessage(name, data), metrics, {
|
|
1744
|
+
glue: started.glue,
|
|
1745
|
+
memory,
|
|
1746
|
+
control: views,
|
|
1747
|
+
keyCodes: KEY_CODES,
|
|
1748
|
+
jobWorkers,
|
|
1749
|
+
device,
|
|
1750
|
+
quality,
|
|
1751
|
+
applyQuality: events.quality,
|
|
1752
|
+
capabilities,
|
|
1753
|
+
...senders,
|
|
1754
|
+
pageUrl: pageUrl ?? sketchUrl,
|
|
1755
|
+
sketchUrl,
|
|
1756
|
+
maxTargetFps: maxTarget,
|
|
1757
|
+
threads: engineThreads,
|
|
1758
|
+
twoStepProbe: DEV && switches.twoStep,
|
|
1759
|
+
showStats: events.stats,
|
|
1760
|
+
wantJobs,
|
|
1761
|
+
sendLabelSlot: events.labelSlot,
|
|
1762
|
+
reportSketchError: (message) => events.sketchError(new Error(message)),
|
|
1763
|
+
// What the sketch's module loaded before the runner existed, then each later load.
|
|
1764
|
+
...(DEV && {
|
|
1765
|
+
hearAddons: (heard) => {
|
|
1766
|
+
stopEarlyAddons?.();
|
|
1767
|
+
for (const name of earlyAddons ?? [])
|
|
1768
|
+
heard(name);
|
|
1769
|
+
return onAddonChecked(heard);
|
|
1770
|
+
},
|
|
1771
|
+
}),
|
|
1772
|
+
}, hold, holdScript, replay, record, switches.view);
|
|
1773
|
+
// In hold mode the sketch module loads only now, after the runner seeded the random
|
|
1774
|
+
// numbers. The renderer starts before the setup, so a warm-up in the setup has a renderer
|
|
1775
|
+
// to build its pipelines.
|
|
1776
|
+
const sketchLoad = sketchModule ?? awaitLater(loadSketch(sketchUrl));
|
|
1777
|
+
if (!render)
|
|
1778
|
+
localDrawing = await abortable(drawOnPage(memory, { imageTable }, localRunner), start.signal);
|
|
1779
|
+
// A setup that fails without an engine code fails the start with E1405, as a sketch worker's
|
|
1780
|
+
// does: a setup function that throws, or a trap in the core during a warm-up.
|
|
1781
|
+
const setup = sketchLoad
|
|
1782
|
+
.then((sketch) => localRunner?.setup(sketch))
|
|
1783
|
+
.catch((error) => {
|
|
1784
|
+
throw error instanceof EngineError
|
|
1785
|
+
? error
|
|
1786
|
+
: new EngineError('E1405', `the sketch on the page did not start: ${messageOf(error)}.`);
|
|
1787
|
+
});
|
|
1788
|
+
await abortable(setup, start.signal);
|
|
1789
|
+
scriptResult = localRunner?.holdScriptResult;
|
|
1790
|
+
replayResult = localRunner?.replayOutcome;
|
|
1791
|
+
if (render) {
|
|
1792
|
+
await abortable(render.ready(), start.signal);
|
|
1793
|
+
if (hold === undefined && replay === undefined)
|
|
1794
|
+
void runPipelined(localRunner, control, (error) => onFailure(new EngineError('E1404', `the sketch on the page failed: ${messageOf(error)}.`)));
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
else if (threads?.sketch) {
|
|
1798
|
+
const { sketch, render, jobs } = threads;
|
|
1799
|
+
const taskPorts = startJobs(jobs);
|
|
1800
|
+
const init = {
|
|
1801
|
+
taskPorts,
|
|
1802
|
+
type: 'init',
|
|
1803
|
+
...handoff,
|
|
1804
|
+
sketchUrl,
|
|
1805
|
+
pageUrl: pageUrl ?? sketchUrl,
|
|
1806
|
+
keyCodes: KEY_CODES,
|
|
1807
|
+
jobWorkers,
|
|
1808
|
+
capabilities,
|
|
1809
|
+
hold,
|
|
1810
|
+
holdScript,
|
|
1811
|
+
replay,
|
|
1812
|
+
record,
|
|
1813
|
+
debugView: switches.view,
|
|
1814
|
+
quality,
|
|
1815
|
+
maxTargetFps: maxTarget,
|
|
1816
|
+
threads: engineThreads,
|
|
1817
|
+
twoStepProbe: DEV && switches.twoStep,
|
|
1818
|
+
};
|
|
1819
|
+
withCore.add(sketch);
|
|
1820
|
+
if (renderThread === 'sketch-worker') {
|
|
1821
|
+
const canvas = moveCanvas(sketch, 'sketch');
|
|
1822
|
+
sketch.send({ ...init, renderer: { canvas, ...rendererSetup } }, [
|
|
1823
|
+
...(canvas ? [canvas] : []),
|
|
1824
|
+
...taskPorts,
|
|
1825
|
+
]);
|
|
1826
|
+
rendererHost = sketch;
|
|
1827
|
+
}
|
|
1828
|
+
else {
|
|
1829
|
+
// Texture images go from the sketch worker straight to the thread that draws.
|
|
1830
|
+
const images = channel();
|
|
1831
|
+
sketch.send({ ...init, imagePort: images.port1 }, [images.port1, ...taskPorts]);
|
|
1832
|
+
if (render)
|
|
1833
|
+
startRenderWorker(render, images.port2);
|
|
1834
|
+
else
|
|
1835
|
+
localDrawing = await abortable(drawOnPage(core.memory, { imagePort: images.port2 }), start.signal);
|
|
1836
|
+
}
|
|
1837
|
+
// The engine is ready once the sketch worker and the render worker are.
|
|
1838
|
+
const essential = render ? [sketch, render] : [sketch];
|
|
1839
|
+
await abortable(Promise.all(essential.map((w) => w.ready())), start.signal);
|
|
1840
|
+
}
|
|
1841
|
+
start.signal.throwIfAborted();
|
|
1842
|
+
starting = false;
|
|
1843
|
+
signal?.removeEventListener('abort', cancelStart);
|
|
1844
|
+
const engineStartMs = performance.now() - startedAt;
|
|
1845
|
+
onProgress('sketch');
|
|
1846
|
+
// The thread that draws writes the time the GPU finished the first frame; the page checks for
|
|
1847
|
+
// it once per animation frame until it appears.
|
|
1848
|
+
const header = new MetricsReader(metrics);
|
|
1849
|
+
const firstFrame = new Promise((resolve) => {
|
|
1850
|
+
const check = () => {
|
|
1851
|
+
if (Atomics.load(slots, Slot.Running) === 0)
|
|
1852
|
+
return;
|
|
1853
|
+
if (header.firstFrameDoneTime > 0) {
|
|
1854
|
+
onProgress('first-frame');
|
|
1855
|
+
resolve();
|
|
1856
|
+
return;
|
|
1857
|
+
}
|
|
1858
|
+
requestAnimationFrame(check);
|
|
1859
|
+
};
|
|
1860
|
+
requestAnimationFrame(check);
|
|
1861
|
+
});
|
|
1862
|
+
marker?.endAfter(firstFrame);
|
|
1863
|
+
if (DEV && switches.twoStep)
|
|
1864
|
+
void firstFrame.then(() => logTwoStep(slots, false));
|
|
1865
|
+
/** Hold mode's frame, read back once. */
|
|
1866
|
+
let held;
|
|
1867
|
+
/** The error of a thread that draws when it could not capture a frame. */
|
|
1868
|
+
const captureFailure = (reply) => new Error(`the frame could not be captured${reply?.type === 'capture-failed' ? `: ${reply.message}` : ''}`);
|
|
1869
|
+
/** Draws a frame offscreen on the thread that draws, and reads it back. */
|
|
1870
|
+
const capture = async () => {
|
|
1871
|
+
if (localDrawing && draw)
|
|
1872
|
+
return draw.captureFrame(localDrawing, slots);
|
|
1873
|
+
const reply = await rendererHost?.request({ type: 'capture' });
|
|
1874
|
+
if (reply?.type === 'captured')
|
|
1875
|
+
return {
|
|
1876
|
+
width: reply.width,
|
|
1877
|
+
height: reply.height,
|
|
1878
|
+
pixels: reply.pixels,
|
|
1879
|
+
frame: reply.frame,
|
|
1880
|
+
};
|
|
1881
|
+
throw captureFailure(reply);
|
|
1882
|
+
};
|
|
1883
|
+
/**
|
|
1884
|
+
* Draws a frame offscreen on the thread that draws, which encodes it as a PNG file. Hold
|
|
1885
|
+
* mode's frame is read back already, so the page encodes that and the GPU draws nothing more.
|
|
1886
|
+
*/
|
|
1887
|
+
const captureImage = async () => {
|
|
1888
|
+
if (held)
|
|
1889
|
+
return encodeFrame({ ...held, pixels: held.pixels.slice() }, device.transparent);
|
|
1890
|
+
if (localDrawing && draw)
|
|
1891
|
+
return draw.captureImage(localDrawing, slots);
|
|
1892
|
+
const reply = await rendererHost?.request({ type: 'capture', image: true });
|
|
1893
|
+
if (reply?.type === 'captured-image')
|
|
1894
|
+
return reply.image;
|
|
1895
|
+
throw captureFailure(reply);
|
|
1896
|
+
};
|
|
1897
|
+
const stopped = () => Atomics.load(slots, Slot.Running) === 0;
|
|
1898
|
+
const engine = {
|
|
1899
|
+
capabilities,
|
|
1900
|
+
report,
|
|
1901
|
+
mode,
|
|
1902
|
+
firstFrame,
|
|
1903
|
+
labels,
|
|
1904
|
+
postToSketch: sendToSketch,
|
|
1905
|
+
registerVideo: (video, videoOptions) => videos.register(video, videoOptions),
|
|
1906
|
+
onSketchMessage(handler) {
|
|
1907
|
+
messageHandlers.add(handler);
|
|
1908
|
+
const early = earlyMessages;
|
|
1909
|
+
earlyMessages = undefined;
|
|
1910
|
+
if (early)
|
|
1911
|
+
for (const [name, data] of early)
|
|
1912
|
+
handler(name, data);
|
|
1913
|
+
return () => messageHandlers.delete(handler);
|
|
1914
|
+
},
|
|
1915
|
+
onFailure(handler) {
|
|
1916
|
+
failureHandlers.add(handler);
|
|
1917
|
+
for (const error of earlyFailures.splice(0))
|
|
1918
|
+
handler(error);
|
|
1919
|
+
return () => failureHandlers.delete(handler);
|
|
1920
|
+
},
|
|
1921
|
+
onStop(handler) {
|
|
1922
|
+
if (drawingEnded) {
|
|
1923
|
+
runStopHandler(handler);
|
|
1924
|
+
return () => { };
|
|
1925
|
+
}
|
|
1926
|
+
stopHandlers.add(handler);
|
|
1927
|
+
return () => stopHandlers.delete(handler);
|
|
1928
|
+
},
|
|
1929
|
+
onSketchError(handler) {
|
|
1930
|
+
sketchErrorHandlers.add(handler);
|
|
1931
|
+
return () => sketchErrorHandlers.delete(handler);
|
|
1932
|
+
},
|
|
1933
|
+
setPaused(paused) {
|
|
1934
|
+
userPaused = paused;
|
|
1935
|
+
applyPause();
|
|
1936
|
+
},
|
|
1937
|
+
detach() {
|
|
1938
|
+
if (detached)
|
|
1939
|
+
return;
|
|
1940
|
+
detached = true;
|
|
1941
|
+
watch.listen(false);
|
|
1942
|
+
applyPause();
|
|
1943
|
+
options.canvas.remove();
|
|
1944
|
+
},
|
|
1945
|
+
attach(container) {
|
|
1946
|
+
container.append(options.canvas);
|
|
1947
|
+
if (!detached)
|
|
1948
|
+
return;
|
|
1949
|
+
detached = false;
|
|
1950
|
+
watch.listen(true);
|
|
1951
|
+
applyPause();
|
|
1952
|
+
},
|
|
1953
|
+
async measure(seconds, options) {
|
|
1954
|
+
// The window opens at the call, before the figures' code loads, so work that the caller
|
|
1955
|
+
// starts right after the call is counted even when the import is cold. A sketch that
|
|
1956
|
+
// adds an object then builds its pipelines while the figures load.
|
|
1957
|
+
const reader = new MetricsReader(metrics);
|
|
1958
|
+
reader.begin();
|
|
1959
|
+
const { HeapSampler, secondRates, slowFrames, summarizeFrames, wasmDownloadBytes } = await loadFrameStats();
|
|
1960
|
+
const mainThread = new MainThreadWatch();
|
|
1961
|
+
const started = performance.now();
|
|
1962
|
+
const heap = new HeapSampler();
|
|
1963
|
+
heap.start();
|
|
1964
|
+
const drain = setInterval(() => reader.drain(), DRAIN_INTERVAL_MS);
|
|
1965
|
+
await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
|
|
1966
|
+
clearInterval(drain);
|
|
1967
|
+
reader.end();
|
|
1968
|
+
const firstFrame = reader.firstFrameTime;
|
|
1969
|
+
return {
|
|
1970
|
+
seconds: (performance.now() - started) / 1000,
|
|
1971
|
+
...summarizeFrames(reader.records, threadRoles(mode)),
|
|
1972
|
+
memory: { wasmBytes: memoryBytes(wasmMemory) ?? null, ...heap.stop() },
|
|
1973
|
+
load: {
|
|
1974
|
+
engineStartMs,
|
|
1975
|
+
probeMs,
|
|
1976
|
+
coreMs,
|
|
1977
|
+
firstFrameMs: firstFrame > 0 ? firstFrame - performance.timeOrigin : null,
|
|
1978
|
+
firstFrameDoneMs: reader.firstFrameDoneTime > 0
|
|
1979
|
+
? reader.firstFrameDoneTime - performance.timeOrigin
|
|
1980
|
+
: null,
|
|
1981
|
+
warmUpMs: reader.warmUpMs,
|
|
1982
|
+
firstDrawMs: reader.firstDrawMs,
|
|
1983
|
+
firstFramePipelines: reader.firstFramePipelines,
|
|
1984
|
+
firstFramePreset,
|
|
1985
|
+
},
|
|
1986
|
+
gpuLosses: Atomics.load(slots, Slot.GpuEpoch),
|
|
1987
|
+
downloadBytes: { wasm: wasmDownloadBytes() },
|
|
1988
|
+
lostRecords: reader.lost,
|
|
1989
|
+
completionSignal: tier === 'webgl2' ? 'fence' : 'queue',
|
|
1990
|
+
refreshHz: reader.refreshHz > 0 ? reader.refreshHz : null,
|
|
1991
|
+
mainThread: mainThread.stop(),
|
|
1992
|
+
perSecond: secondRates(reader.records),
|
|
1993
|
+
...(options?.slowMs === undefined
|
|
1994
|
+
? {}
|
|
1995
|
+
: { slow: slowFrames(reader.records, options.slowMs, threadRoles(mode)) }),
|
|
1996
|
+
};
|
|
1997
|
+
},
|
|
1998
|
+
stats(show = true) {
|
|
1999
|
+
if (!stopped())
|
|
2000
|
+
statsSwitch.show(show);
|
|
2001
|
+
},
|
|
2002
|
+
async capture() {
|
|
2003
|
+
try {
|
|
2004
|
+
if (stopped())
|
|
2005
|
+
throw new Error('the engine has stopped');
|
|
2006
|
+
return await captureImage();
|
|
2007
|
+
}
|
|
2008
|
+
catch (error) {
|
|
2009
|
+
throw new EngineError('E1414', `engine.capture() failed: ${messageOf(error)}.`);
|
|
2010
|
+
}
|
|
2011
|
+
},
|
|
2012
|
+
async captureFrame() {
|
|
2013
|
+
return held ? { ...held, pixels: held.pixels.slice() } : capture();
|
|
2014
|
+
},
|
|
2015
|
+
async saveRecording() {
|
|
2016
|
+
if (stopped())
|
|
2017
|
+
return undefined;
|
|
2018
|
+
if (localRunner !== undefined)
|
|
2019
|
+
return localRunner.saveRecording();
|
|
2020
|
+
const worker = threads?.sketch;
|
|
2021
|
+
if (worker === undefined)
|
|
2022
|
+
return undefined;
|
|
2023
|
+
return await new Promise((resolve) => {
|
|
2024
|
+
recordingWaiters.push(resolve);
|
|
2025
|
+
worker.send({ type: 'save-recording' });
|
|
2026
|
+
});
|
|
2027
|
+
},
|
|
2028
|
+
simulateGpuLoss() {
|
|
2029
|
+
if (localDrawing)
|
|
2030
|
+
localDrawing.simulateLoss();
|
|
2031
|
+
else
|
|
2032
|
+
rendererHost?.send({ type: 'lose-gpu' });
|
|
2033
|
+
},
|
|
2034
|
+
requestPointerLock(lockOptions) {
|
|
2035
|
+
// The lock is input: the sketch reads the mouse's movement through the engine's listeners.
|
|
2036
|
+
if (options.input === false)
|
|
2037
|
+
return Promise.reject(new EngineError('E1426', 'engine.requestPointerLock() was called on an engine started with input: false, which reads no pointer movement.'));
|
|
2038
|
+
return requestPointerLock(options.canvas, lockOptions).then(() => {
|
|
2039
|
+
tookLock = true;
|
|
2040
|
+
});
|
|
2041
|
+
},
|
|
2042
|
+
async destroy(destroyOptions) {
|
|
2043
|
+
await stop();
|
|
2044
|
+
if (destroyOptions?.release)
|
|
2045
|
+
releaseMemories();
|
|
2046
|
+
},
|
|
2047
|
+
};
|
|
2048
|
+
if (record && hold === undefined)
|
|
2049
|
+
void import('./record-button.js')
|
|
2050
|
+
.then(({ showRecordButton }) => showRecordButton(engine))
|
|
2051
|
+
.catch((error) => console.warn('null3D could not show the save-recording button:', error));
|
|
2052
|
+
if (hold === undefined && replay === undefined) {
|
|
2053
|
+
if (switches.bench)
|
|
2054
|
+
globalThis[BENCH_GLOBAL] = engine;
|
|
2055
|
+
// The switch's start state goes on top of the option's corner.
|
|
2056
|
+
if (switches.stats !== false) {
|
|
2057
|
+
if (options.stats)
|
|
2058
|
+
statsSwitch.show(options.stats);
|
|
2059
|
+
if (switches.stats)
|
|
2060
|
+
statsSwitch.show(switches.stats);
|
|
2061
|
+
}
|
|
2062
|
+
return engine;
|
|
2063
|
+
}
|
|
2064
|
+
try {
|
|
2065
|
+
held = await abortable(holdFrame(capture, failureHandlers), signal);
|
|
2066
|
+
// The held frame built every pipeline that the scene draws with, so its words are
|
|
2067
|
+
// complete here, before the page publishes the frame the tool waits on.
|
|
2068
|
+
stopRecording();
|
|
2069
|
+
}
|
|
2070
|
+
catch (error) {
|
|
2071
|
+
await stop();
|
|
2072
|
+
throw error;
|
|
2073
|
+
}
|
|
2074
|
+
if (DEV && switches.twoStep)
|
|
2075
|
+
logTwoStep(slots, true);
|
|
2076
|
+
const { summarizeFrames } = await loadFrameStats();
|
|
2077
|
+
// The held frame is the one the session's steps reached. A run that draws a settle frame
|
|
2078
|
+
// after it, for a pass that reads the frame before, still reports the held frame's number.
|
|
2079
|
+
const drawn = Atomics.load(slots, Slot.FramesTaken);
|
|
2080
|
+
const frame = Atomics.load(slots, Slot.HeldFrame);
|
|
2081
|
+
const patchFrame = Atomics.load(slots, Slot.ClusterPatchFrame);
|
|
2082
|
+
const patchRanges = Atomics.load(slots, Slot.ClusterPatches);
|
|
2083
|
+
publishHold({
|
|
2084
|
+
ok: true,
|
|
2085
|
+
time: hold ?? replayResult?.seconds ?? 0,
|
|
2086
|
+
...held,
|
|
2087
|
+
frame,
|
|
2088
|
+
tier,
|
|
2089
|
+
directDraws: device.directDraws,
|
|
2090
|
+
// What the frame builder recorded: the patch ranges that its tree walk chose, or none
|
|
2091
|
+
// where it drew the trees' whole levels. A negative count is a path that picks the
|
|
2092
|
+
// patches on the GPU, and a count from another frame tells nothing about this one.
|
|
2093
|
+
clusterPatches: patchFrame === drawn && patchRanges >= 0 ? patchRanges > 0 : null,
|
|
2094
|
+
stats: summarizeFrames(new MetricsReader(metrics).readWritten(), threadRoles(mode), frame),
|
|
2095
|
+
...(scriptResult !== undefined && { script: scriptResult }),
|
|
2096
|
+
...(replayResult !== undefined && { replay: replayResult }),
|
|
2097
|
+
});
|
|
2098
|
+
// A replay ends on its last frame: the sketch stops there, rather than running on past the
|
|
2099
|
+
// session that the file holds.
|
|
2100
|
+
if (replay !== undefined)
|
|
2101
|
+
engine.setPaused(true);
|
|
2102
|
+
return engine;
|
|
2103
|
+
}
|
|
2104
|
+
catch (e) {
|
|
2105
|
+
starting = false;
|
|
2106
|
+
signal?.removeEventListener('abort', cancelStart);
|
|
2107
|
+
await stop();
|
|
2108
|
+
// The fix text of a coded error arrives in a file of its own, so a failed start waits for it
|
|
2109
|
+
// to end the message it rejects with.
|
|
2110
|
+
await errorFixesReady();
|
|
2111
|
+
throw e;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
/**
|
|
2115
|
+
* Draws the held frame and reads it back through `capture`. The first failure that the engine
|
|
2116
|
+
* reports meanwhile, such as a lost GPU, ends the hold instead. A failure without a code becomes
|
|
2117
|
+
* E1408.
|
|
2118
|
+
*/
|
|
2119
|
+
async function holdFrame(capture, failureHandlers) {
|
|
2120
|
+
let fail = () => { };
|
|
2121
|
+
const failed = new Promise((_, reject) => {
|
|
2122
|
+
fail = reject;
|
|
2123
|
+
});
|
|
2124
|
+
failureHandlers.add(fail);
|
|
2125
|
+
try {
|
|
2126
|
+
return await Promise.race([capture(), failed]);
|
|
2127
|
+
}
|
|
2128
|
+
catch (error) {
|
|
2129
|
+
if (error instanceof EngineError)
|
|
2130
|
+
throw error;
|
|
2131
|
+
throw new EngineError('E1408', `hold mode stopped before it read the held frame back: ${messageOf(error)}.`);
|
|
2132
|
+
}
|
|
2133
|
+
finally {
|
|
2134
|
+
failureHandlers.delete(fail);
|
|
2135
|
+
}
|
|
2136
|
+
}
|