@null3d/engine 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -0
- package/THIRD-PARTY-NOTICES.txt +0 -1
- package/dist/wasm/single/null3d.js +25 -10
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +25 -10
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +114 -86
- package/docs/api/assets.md +135 -49
- package/docs/api/cameras.md +45 -12
- package/docs/api/controls.md +88 -62
- package/docs/api/debug.md +116 -41
- package/docs/api/engine.md +117 -35
- package/docs/api/feature-draws.md +23 -17
- package/docs/api/feature-effects.md +11 -11
- package/docs/api/feature-instances.md +70 -19
- package/docs/api/features.md +77 -47
- package/docs/api/geometry.md +132 -82
- package/docs/api/grass.md +55 -13
- package/docs/api/impostors.md +175 -22
- package/docs/api/input.md +24 -18
- package/docs/api/lights.md +78 -51
- package/docs/api/lines.md +41 -33
- package/docs/api/materials.md +248 -121
- package/docs/api/math.md +12 -13
- package/docs/api/objects.md +47 -22
- package/docs/api/page.md +58 -7
- package/docs/api/particles.md +33 -20
- package/docs/api/points.md +19 -31
- package/docs/api/post.md +75 -42
- package/docs/api/quality.md +42 -17
- package/docs/api/raycast.md +65 -51
- package/docs/api/reference/animation.md +10 -11
- package/docs/api/reference/assets.md +25 -22
- package/docs/api/reference/cameras.md +8 -4
- package/docs/api/reference/controls.md +134 -25
- package/docs/api/reference/debug.md +81 -14
- package/docs/api/reference/engine.md +58 -17
- package/docs/api/reference/feature-draws.md +3 -4
- package/docs/api/reference/feature-effects.md +2 -3
- package/docs/api/reference/feature-instances.md +5 -4
- package/docs/api/reference/features.md +7 -4
- package/docs/api/reference/geometry.md +287 -97
- package/docs/api/reference/grass.md +63 -3
- package/docs/api/reference/impostors.md +208 -13
- package/docs/api/reference/input.md +4 -5
- package/docs/api/reference/lights.md +13 -12
- package/docs/api/reference/lines.md +10 -11
- package/docs/api/reference/materials.md +54 -53
- package/docs/api/reference/math.md +35 -24
- package/docs/api/reference/objects.md +11 -12
- package/docs/api/reference/particles.md +31 -6
- package/docs/api/reference/points.md +6 -7
- package/docs/api/reference/post.md +21 -20
- package/docs/api/reference/quality.md +8 -5
- package/docs/api/reference/raycast.md +7 -8
- package/docs/api/reference/render.md +5 -4
- package/docs/api/reference/scene.md +52 -30
- package/docs/api/reference/sketch.md +15 -11
- package/docs/api/reference/sound.md +234 -0
- package/docs/api/reference/splats.md +42 -3
- package/docs/api/reference/sprites.md +7 -8
- package/docs/api/reference/tasks.md +16 -3
- package/docs/api/reference/terrain.md +27 -5
- package/docs/api/reference/textures.md +5 -6
- package/docs/api/reference/three-compat.md +18 -7
- package/docs/api/reference/time.md +1 -2
- package/docs/api/reference/ui.md +12 -9
- package/docs/api/reference/vertex-draws.md +5 -6
- package/docs/api/reference/water.md +153 -9
- package/docs/api/reference/wind.md +17 -4
- package/docs/api/render.md +73 -29
- package/docs/api/scene.md +164 -60
- package/docs/api/sketch.md +102 -15
- package/docs/api/sound.md +205 -0
- package/docs/api/splats.md +46 -12
- package/docs/api/sprites.md +10 -24
- package/docs/api/tasks.md +33 -24
- package/docs/api/terrain.md +42 -22
- package/docs/api/textures.md +68 -19
- package/docs/api/three-compat.md +15 -7
- package/docs/api/time.md +3 -5
- package/docs/api/ui.md +19 -23
- package/docs/api/vertex-draws.md +13 -12
- package/docs/api/water.md +262 -35
- package/docs/api/wind.md +63 -17
- package/docs/cli/null3d.md +177 -27
- package/docs/concepts/architecture.md +73 -27
- package/docs/concepts/assets.md +57 -33
- package/docs/concepts/backends.md +69 -27
- package/docs/concepts/color-management.md +54 -36
- package/docs/concepts/culling.md +68 -47
- package/docs/concepts/handles.md +14 -5
- package/docs/concepts/instances.md +74 -25
- package/docs/concepts/large-worlds.md +18 -8
- package/docs/concepts/lighting.md +155 -87
- package/docs/concepts/lod.md +126 -44
- package/docs/concepts/materials.md +58 -27
- package/docs/concepts/particle-buffer.md +48 -35
- package/docs/concepts/post-processing.md +84 -43
- package/docs/concepts/quality-preset-tables.md +56 -52
- package/docs/concepts/quality-presets.md +164 -52
- package/docs/concepts/render-graph.md +69 -29
- package/docs/concepts/render-layers.md +11 -21
- package/docs/concepts/shadows.md +105 -52
- package/docs/concepts/static-dynamic.md +22 -7
- package/docs/cookbook/index.md +164 -120
- package/docs/data/threejs-mapping.json +362 -367
- package/docs/errors/E1101.md +23 -5
- package/docs/errors/E1102.md +11 -3
- package/docs/errors/E1103.md +11 -3
- package/docs/errors/E1104.md +11 -3
- package/docs/errors/E1105.md +13 -5
- package/docs/errors/E1106.md +11 -3
- package/docs/errors/E1107.md +15 -5
- package/docs/errors/E1108.md +11 -3
- package/docs/errors/E1109.md +32 -6
- package/docs/errors/E1110.md +23 -5
- package/docs/errors/E1111.md +11 -3
- package/docs/errors/E1112.md +11 -3
- package/docs/errors/E1203.md +12 -4
- package/docs/errors/E1204.md +11 -3
- package/docs/errors/E1205.md +11 -3
- package/docs/errors/E1206.md +28 -6
- package/docs/errors/E1207.md +11 -3
- package/docs/errors/E1208.md +12 -3
- package/docs/errors/E1209.md +11 -3
- package/docs/errors/E1213.md +27 -5
- package/docs/errors/E1214.md +14 -6
- package/docs/errors/E1215.md +31 -6
- package/docs/errors/E1216.md +31 -6
- package/docs/errors/E1217.md +29 -6
- package/docs/errors/E1218.md +22 -6
- package/docs/errors/E1219.md +11 -3
- package/docs/errors/E1220.md +24 -5
- package/docs/errors/E1221.md +24 -5
- package/docs/errors/E1222.md +11 -3
- package/docs/errors/E1223.md +39 -6
- package/docs/errors/E1224.md +11 -3
- package/docs/errors/E1225.md +11 -3
- package/docs/errors/E1301.md +11 -3
- package/docs/errors/E1302.md +11 -3
- package/docs/errors/E1303.md +11 -3
- package/docs/errors/E1304.md +11 -3
- package/docs/errors/E1305.md +13 -3
- package/docs/errors/E1306.md +11 -3
- package/docs/errors/E1307.md +40 -0
- package/docs/errors/E1401.md +11 -3
- package/docs/errors/E1402.md +13 -5
- package/docs/errors/E1403.md +11 -3
- package/docs/errors/E1404.md +13 -3
- package/docs/errors/E1405.md +15 -4
- package/docs/errors/E1406.md +31 -5
- package/docs/errors/E1407.md +11 -3
- package/docs/errors/E1408.md +11 -3
- package/docs/errors/E1409.md +11 -3
- package/docs/errors/E1410.md +13 -5
- package/docs/errors/E1411.md +11 -3
- package/docs/errors/E1412.md +29 -6
- package/docs/errors/E1413.md +11 -3
- package/docs/errors/E1414.md +11 -3
- package/docs/errors/E1415.md +11 -3
- package/docs/errors/E1416.md +27 -6
- package/docs/errors/E1417.md +11 -3
- package/docs/errors/E1418.md +12 -3
- package/docs/errors/E1419.md +13 -5
- package/docs/errors/E1420.md +14 -6
- package/docs/errors/E1421.md +11 -3
- package/docs/errors/E1422.md +12 -3
- package/docs/errors/E1423.md +12 -3
- package/docs/errors/E1424.md +24 -5
- package/docs/errors/E1425.md +11 -3
- package/docs/errors/E1426.md +11 -3
- package/docs/errors/E1430.md +11 -3
- package/docs/errors/E1431.md +11 -3
- package/docs/errors/E1432.md +11 -3
- package/docs/errors/E1433.md +11 -3
- package/docs/errors/E1434.md +15 -6
- package/docs/errors/E1435.md +11 -3
- package/docs/errors/E1436.md +11 -3
- package/docs/errors/E1437.md +14 -6
- package/docs/errors/E1501.md +41 -6
- package/docs/errors/E1502.md +13 -3
- package/docs/errors/E1503.md +11 -3
- package/docs/errors/E1504.md +11 -3
- package/docs/errors/E1505.md +23 -5
- package/docs/errors/E1506.md +11 -3
- package/docs/errors/index.md +54 -30
- package/docs/getting-started/cdn.md +32 -10
- package/docs/getting-started/first-scene.md +21 -13
- package/docs/getting-started/hosting.md +152 -63
- package/docs/getting-started/install.md +44 -28
- package/docs/getting-started/network-use.md +33 -15
- package/docs/getting-started/project-structure.md +33 -12
- package/docs/getting-started/third-party-notices.md +12 -14
- package/docs/guides/accessibility.md +5 -5
- package/docs/guides/add-ons.md +86 -15
- package/docs/guides/agents.md +16 -9
- package/docs/guides/assets-pipeline.md +259 -82
- package/docs/guides/audio.md +115 -128
- package/docs/guides/baked-light-data.md +44 -23
- package/docs/guides/car-paint.md +38 -32
- package/docs/guides/content-pages.md +63 -35
- package/docs/guides/custom-passes.md +65 -22
- package/docs/guides/custom-shaders.md +59 -39
- package/docs/guides/debugging.md +74 -10
- package/docs/guides/deploying.md +85 -6
- package/docs/guides/deterministic-simulation.md +24 -17
- package/docs/guides/first-use-shaders.md +83 -45
- package/docs/guides/lens-kit.md +29 -26
- package/docs/guides/loading-screens.md +132 -47
- package/docs/guides/multiple-views.md +63 -13
- package/docs/guides/performance.md +192 -38
- package/docs/guides/phones.md +78 -15
- package/docs/guides/physics.md +7 -11
- package/docs/guides/screens.md +47 -33
- package/docs/guides/start-time.md +363 -0
- package/docs/guides/testing.md +152 -95
- package/docs/guides/ui-overlays.md +19 -14
- package/docs/guides/video-textures.md +14 -13
- package/docs/images/api/animation/character.webp +0 -0
- package/docs/images/api/animation/look-at-ring.webp +0 -0
- package/docs/images/api/animation/morph-tulips.webp +0 -0
- package/docs/images/api/animation/skeleton-lines.webp +0 -0
- package/docs/images/api/controls/gizmo-handles.webp +0 -0
- package/docs/images/api/controls/walk-and-fly.webp +0 -0
- package/docs/images/api/debug/debug-shapes.webp +0 -0
- package/docs/images/api/debug/levels-view.webp +0 -0
- package/docs/images/api/engine/transparent-canvas.webp +0 -0
- package/docs/images/api/feature-draws/feature-draw-clouds.webp +0 -0
- package/docs/images/api/feature-instances/compute-instances.webp +0 -0
- package/docs/images/api/feature-instances/instances-shadow.webp +0 -0
- package/docs/images/api/geometry/extra-shapes.webp +0 -0
- package/docs/images/api/geometry/generators.webp +0 -0
- package/docs/images/api/geometry/mesh-arrays.webp +0 -0
- package/docs/images/api/geometry/vertex-updates.webp +0 -0
- package/docs/images/api/grass/grass-grove.webp +0 -0
- package/docs/images/api/grass/grass-presets.webp +0 -0
- package/docs/images/api/grass/grass-shadow.webp +0 -0
- package/docs/images/api/impostors/impostor-handover.webp +0 -0
- package/docs/images/api/impostors/impostor-shadow.webp +0 -0
- package/docs/images/api/impostors/impostors-forest.webp +0 -0
- package/docs/images/api/lights/spot-cookies.webp +0 -0
- package/docs/images/api/lines/lines-lit.webp +0 -0
- package/docs/images/api/lines/lines-widths.webp +0 -0
- package/docs/images/api/materials/coat-and-sheen.webp +0 -0
- package/docs/images/api/materials/decals.webp +0 -0
- package/docs/images/api/materials/iridescence-and-anisotropy.webp +0 -0
- package/docs/images/api/materials/relief.webp +0 -0
- package/docs/images/api/materials/shader-inputs.webp +0 -0
- package/docs/images/api/materials/standard-grid.webp +0 -0
- package/docs/images/api/materials/subsurface.webp +0 -0
- package/docs/images/api/materials/translucency.webp +0 -0
- package/docs/images/api/objects/objects-turntable.webp +0 -0
- package/docs/images/api/particles/campfire.webp +0 -0
- package/docs/images/api/points/galaxy.webp +0 -0
- package/docs/images/api/reference/textures/texture-wrap.webp +0 -0
- package/docs/images/api/render/fullscreen-glow.webp +0 -0
- package/docs/images/api/render/reflection-mirror.webp +0 -0
- package/docs/images/api/render/security-camera.webp +0 -0
- package/docs/images/api/scene/aurora-sky-layer.webp +0 -0
- package/docs/images/api/sound/sound-demo.webp +0 -0
- package/docs/images/api/splats/splats-demo.webp +0 -0
- package/docs/images/api/sprites/sprites-lines.webp +0 -0
- package/docs/images/api/terrain/terrain-demo.webp +0 -0
- package/docs/images/api/textures/canvas-screen.webp +0 -0
- package/docs/images/api/textures/mipmaps.webp +0 -0
- package/docs/images/api/vertex-draws/rain.webp +0 -0
- package/docs/images/api/water/ocean.webp +0 -0
- package/docs/images/api/water/water-demo.webp +0 -0
- package/docs/images/api/water/water-rain.webp +0 -0
- package/docs/images/api/water/waterfall.webp +0 -0
- package/docs/images/concepts/assets/gltf-model.webp +0 -0
- package/docs/images/concepts/color-management/tone-mapped.webp +0 -0
- package/docs/images/concepts/culling/far-from-origin.webp +0 -0
- package/docs/images/concepts/instances/instances.webp +0 -0
- package/docs/images/concepts/instances/per-row-colors.webp +0 -0
- package/docs/images/concepts/large-worlds/large-world.webp +0 -0
- package/docs/images/concepts/lighting/area-lights.webp +0 -0
- package/docs/images/concepts/lighting/atmosphere.webp +0 -0
- package/docs/images/concepts/lighting/environment.webp +0 -0
- package/docs/images/concepts/lighting/light-shafts.webp +0 -0
- package/docs/images/concepts/lighting/reflection-probes.webp +0 -0
- package/docs/images/concepts/lod/forest.webp +0 -0
- package/docs/images/concepts/materials/weighted-transparency.webp +0 -0
- package/docs/images/concepts/post-processing/auto-exposure.webp +0 -0
- package/docs/images/concepts/post-processing/bounce-light.webp +0 -0
- package/docs/images/concepts/post-processing/depth-of-field.webp +0 -0
- package/docs/images/concepts/post-processing/post-effects-alley.webp +0 -0
- package/docs/images/concepts/post-processing/sharpen.webp +0 -0
- package/docs/images/concepts/post-processing/ssr-wet-street.webp +0 -0
- package/docs/images/concepts/render-layers/layers-cottages.webp +0 -0
- package/docs/images/concepts/shadows/hero-shadow.webp +0 -0
- package/docs/images/cookbook/index/picking.webp +0 -0
- package/docs/images/cookbook/index/time-of-day.webp +0 -0
- package/docs/images/errors/E1431/area-lights-no-tables.webp +0 -0
- package/docs/images/guides/custom-passes/reflection-water.webp +0 -0
- package/docs/images/guides/deterministic-simulation/replay-demo.webp +0 -0
- package/docs/images/guides/multiple-views/split-screen.webp +0 -0
- package/docs/images/guides/performance/overdraw-view.webp +0 -0
- package/docs/images/guides/testing/hold-mode-frame.webp +0 -0
- package/docs/images/index/showcase-island.webp +0 -0
- package/docs/images/porting/threejs-shaders/dissolve.webp +0 -0
- package/docs/images/shaders/builtins/builtins.webp +0 -0
- package/docs/images/shaders/surface-functions/custom-surface.webp +0 -0
- package/docs/images/shaders/surface-functions/vertex-offset.webp +0 -0
- package/docs/images/shots.json +2231 -0
- package/docs/index.md +18 -23
- package/docs/moves.json +1 -0
- package/docs/nav.json +300 -0
- package/docs/pages.md +230 -209
- package/docs/porting/react-three-fiber.md +225 -6
- package/docs/porting/threejs-loop-and-threads.md +217 -7
- package/docs/porting/threejs-mapping.md +1249 -233
- package/docs/porting/threejs-materials.md +218 -6
- package/docs/porting/threejs-overview.md +240 -7
- package/docs/porting/threejs-postprocessing.md +4 -8
- package/docs/porting/threejs-shaders.md +301 -6
- package/docs/porting/threejs-unsupported.md +83 -7
- package/docs/porting/verification.md +178 -6
- package/docs/shaders/builtins.md +15 -4
- package/docs/shaders/library.md +72 -45
- package/docs/shaders/surface-functions.md +59 -23
- package/docs/shaders/wgsl-rules.md +12 -5
- package/lib/debug/channel.d.ts +103 -0
- package/lib/debug/channel.js +269 -0
- package/lib/debug/debug.d.ts +11 -9
- package/lib/debug/draw.d.ts +11 -2
- package/lib/debug/draw.js +57 -6
- package/lib/debug/inspector.d.ts +60 -0
- package/lib/debug/inspector.js +475 -0
- package/lib/debug/overlay-look.d.ts +6 -0
- package/lib/debug/overlay-look.js +29 -7
- package/lib/debug/overlay.js +15 -11
- package/lib/debug/stats-options.d.ts +13 -0
- package/lib/debug/stats-panel.d.ts +22 -7
- package/lib/debug/stats-panel.js +80 -13
- package/lib/debug/stats.d.ts +2 -3
- package/lib/errors/codes.d.ts +17 -3
- package/lib/errors/codes.js +117 -105
- package/lib/errors/engine-error.js +25 -10
- package/lib/errors/fixes.d.ts +1 -0
- package/lib/errors/fixes.js +20 -19
- package/lib/generated/core.d.ts +1 -1
- package/lib/generated/core.js +1 -1
- package/lib/gpu/early-builds.d.ts +68 -0
- package/lib/gpu/early-builds.js +158 -0
- package/lib/gpu/pipeline-name.d.ts +6 -0
- package/lib/gpu/pipeline-name.js +23 -0
- package/lib/gpu/variants.d.ts +8 -2
- package/lib/gpu/variants.js +39 -7
- package/lib/gpu/webgl2/backend.d.ts +63 -2
- package/lib/gpu/webgl2/backend.js +226 -8
- package/lib/gpu/webgl2/programs.d.ts +18 -0
- package/lib/gpu/webgl2/programs.js +5 -2
- package/lib/gpu/webgpu/backend.d.ts +89 -2
- package/lib/gpu/webgpu/backend.js +255 -8
- package/lib/gpu/webgpu/pipelines.d.ts +13 -0
- package/lib/gpu/webgpu/pipelines.js +28 -14
- package/lib/index.d.ts +7 -5
- package/lib/index.js +3 -2
- package/lib/math/color.d.ts +5 -5
- package/lib/math/color.js +5 -5
- package/lib/math/mat4.d.ts +6 -12
- package/lib/math/mat4.js +6 -12
- package/lib/math/namespaces/quat.d.ts +3 -3
- package/lib/math/namespaces/quat.js +3 -3
- package/lib/math/quat.d.ts +8 -12
- package/lib/math/quat.js +8 -12
- package/lib/math/random.d.ts +2 -3
- package/lib/math/random.js +2 -3
- package/lib/math/types.d.ts +4 -4
- package/lib/math/vec3.d.ts +3 -6
- package/lib/math/vec3.js +3 -6
- package/lib/page/capabilities.d.ts +8 -8
- package/lib/page/capabilities.js +39 -25
- package/lib/page/check-store.d.ts +14 -2
- package/lib/page/check-store.js +34 -11
- package/lib/page/engine.d.ts +117 -31
- package/lib/page/engine.js +438 -99
- package/lib/page/first-frame.d.ts +16 -0
- package/lib/page/first-frame.js +35 -0
- package/lib/page/frame-stats.d.ts +34 -1
- package/lib/page/frame-stats.js +15 -0
- package/lib/page/label-loop.d.ts +7 -3
- package/lib/page/label-loop.js +26 -14
- package/lib/page/labels.d.ts +3 -3
- package/lib/page/pipeline-store.d.ts +25 -0
- package/lib/page/pipeline-store.js +84 -0
- package/lib/page/start-marker.d.ts +4 -1
- package/lib/page/start-marker.js +5 -2
- package/lib/page/stats-switch.js +2 -0
- package/lib/page/switches.d.ts +38 -6
- package/lib/page/switches.js +29 -5
- package/lib/quality/check.d.ts +24 -3
- package/lib/quality/check.js +21 -7
- package/lib/quality/chooser.d.ts +6 -0
- package/lib/quality/chooser.js +8 -0
- package/lib/quality/governor.d.ts +98 -6
- package/lib/quality/governor.js +250 -20
- package/lib/quality/preset-docs.d.ts +16 -1
- package/lib/quality/preset-docs.js +3 -0
- package/lib/quality/presets.d.ts +84 -7
- package/lib/quality/presets.js +94 -2
- package/lib/render/draw.d.ts +3 -2
- package/lib/render/draw.js +15 -5
- package/lib/render/load-draw.d.ts +7 -5
- package/lib/render/load-draw.js +7 -5
- package/lib/render/loss.d.ts +28 -10
- package/lib/render/loss.js +50 -22
- package/lib/render/recovery.d.ts +20 -0
- package/lib/render/recovery.js +44 -4
- package/lib/render/renderer.d.ts +85 -9
- package/lib/render/renderer.js +181 -42
- package/lib/render/scene-renderer.d.ts +19 -1
- package/lib/render/scene-renderer.js +25 -1
- package/lib/render/webgl2-renderers.js +8 -5
- package/lib/render/webgpu-renderers.js +5 -4
- package/lib/scene/animation.d.ts +28 -32
- package/lib/scene/animation.js +12 -15
- package/lib/scene/assets.d.ts +61 -86
- package/lib/scene/assets.js +103 -236
- package/lib/scene/background.d.ts +14 -18
- package/lib/scene/background.js +5 -2
- package/lib/scene/baked-light.d.ts +2 -2
- package/lib/scene/color.d.ts +3 -3
- package/lib/scene/downloads.d.ts +2 -0
- package/lib/scene/downloads.js +371 -0
- package/lib/scene/environment.d.ts +7 -7
- package/lib/scene/environment.js +1 -1
- package/lib/scene/fake-call-values.js +3 -3
- package/lib/scene/fog.d.ts +11 -4
- package/lib/scene/fog.js +8 -2
- package/lib/scene/frame-cameras.d.ts +35 -4
- package/lib/scene/frame-cameras.js +86 -10
- package/lib/scene/gltf.d.ts +33 -3
- package/lib/scene/gltf.js +78 -49
- package/lib/scene/grading.d.ts +2 -2
- package/lib/scene/grading.js +3 -3
- package/lib/scene/ktx2.d.ts +9 -1
- package/lib/scene/ktx2.js +3 -2
- package/lib/scene/level-rule.d.ts +121 -0
- package/lib/scene/level-rule.js +130 -0
- package/lib/scene/lines.d.ts +13 -17
- package/lib/scene/lines.js +3 -3
- package/lib/scene/lut.d.ts +1 -2
- package/lib/scene/lut.js +1 -2
- package/lib/scene/particles.d.ts +7 -3
- package/lib/scene/particles.js +3 -1
- package/lib/scene/picks.d.ts +2 -2
- package/lib/scene/pointer-events.d.ts +4 -7
- package/lib/scene/post.d.ts +39 -43
- package/lib/scene/post.js +4 -1
- package/lib/scene/prefab.d.ts +7 -8
- package/lib/scene/prefab.js +7 -8
- package/lib/scene/property-animation.d.ts +1 -1
- package/lib/scene/property-animation.js +1 -1
- package/lib/scene/queries.d.ts +7 -13
- package/lib/scene/resources.d.ts +238 -261
- package/lib/scene/resources.js +179 -81
- package/lib/scene/scene.d.ts +167 -120
- package/lib/scene/scene.js +243 -103
- package/lib/scene/serial-loads.d.ts +29 -0
- package/lib/scene/serial-loads.js +68 -0
- package/lib/scene/shader-preloads.d.ts +34 -0
- package/lib/scene/shader-preloads.js +38 -0
- package/lib/scene/sprites.d.ts +14 -17
- package/lib/scene/sprites.js +5 -6
- package/lib/scene/textures.d.ts +11 -12
- package/lib/scene/textures.js +9 -10
- package/lib/scene/time-of-day.d.ts +11 -7
- package/lib/scene/time-of-day.js +11 -8
- package/lib/scene/vertex-draws.d.ts +5 -4
- package/lib/scene/vertex-draws.js +7 -5
- package/lib/shader-artifact.json +1 -0
- package/lib/shared/core.d.ts +5 -0
- package/lib/shared/core.js +1 -0
- package/lib/shared/import-once.d.ts +6 -0
- package/lib/shared/import-once.js +19 -0
- package/lib/shared/labels.d.ts +5 -2
- package/lib/shared/labels.js +5 -2
- package/lib/shared/metrics.d.ts +38 -0
- package/lib/shared/metrics.js +62 -1
- package/lib/shared/permutation-words.d.ts +2 -0
- package/lib/shared/permutation-words.js +8 -0
- package/lib/shared/recording.d.ts +13 -5
- package/lib/shared/recording.js +31 -10
- package/lib/shared/run-task.js +7 -1
- package/lib/shared/sketch-data.d.ts +9 -0
- package/lib/shared/sketch-data.js +57 -0
- package/lib/shared/task-pending.d.ts +12 -0
- package/lib/shared/task-pending.js +61 -1
- package/lib/shared/tasks.js +79 -32
- package/lib/shared/version.d.ts +17 -1
- package/lib/shared/version.js +19 -1
- package/lib/shared/wasm.d.ts +12 -4
- package/lib/shared/wasm.js +50 -27
- package/lib/shared/worker-start.d.ts +7 -0
- package/lib/shared/worker-start.js +27 -0
- package/lib/sketch/define-sketch.d.ts +51 -7
- package/lib/sketch/define-sketch.js +2 -1
- package/lib/sketch/input.d.ts +2 -2
- package/lib/sketch/preset-check.d.ts +20 -6
- package/lib/sketch/preset-check.js +42 -17
- package/lib/sketch/quality.d.ts +69 -11
- package/lib/sketch/quality.js +54 -13
- package/lib/sketch/runner.d.ts +80 -9
- package/lib/sketch/runner.js +390 -52
- package/lib/sketch/ui.d.ts +5 -8
- package/lib/sketch/ui.js +4 -2
- package/lib/stats.d.ts +1 -0
- package/lib/workers/probe-worker.d.ts +5 -0
- package/lib/workers/probe-worker.js +13 -4
- package/lib/workers/protocol.d.ts +71 -13
- package/lib/workers/protocol.js +4 -0
- package/lib/workers/render-worker.js +29 -5
- package/lib/workers/sketch-worker.js +108 -16
- package/package.json +2 -2
package/lib/sketch/runner.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// the engine chose the preset itself, the setup ends with the preset check (preset-check.ts), which
|
|
18
18
|
// loads after the first frame. The first frame after a change of preset, and the first frame whose
|
|
19
19
|
// handlers hear of it, wait for their pipelines on the thread that draws.
|
|
20
|
+
import { DebugChannel } from '../debug/channel.js';
|
|
20
21
|
import { DebugDraw } from '../debug/draw.js';
|
|
21
22
|
import { SketchDebug } from '../debug/sketch-debug.js';
|
|
22
23
|
import { DEV } from '../errors/checks.js';
|
|
@@ -28,7 +29,7 @@ import { FORMAT_CANVAS, PERMUTATION_DRAW_INDEX, PERMUTATION_TONE_MAP } from '../
|
|
|
28
29
|
import { cellTableWarning } from '../page/limits.js';
|
|
29
30
|
import { FULL_SCALE, thousandths } from '../quality/budget.js';
|
|
30
31
|
import { Governor, GovernorLoop } from '../quality/governor.js';
|
|
31
|
-
import { SKETCH_SETTINGS } from '../quality/presets.js';
|
|
32
|
+
import { lowestTierCuts, presetSettings, presetValue, SKETCH_SETTINGS, tierRestoreSettings, } from '../quality/presets.js';
|
|
32
33
|
import { FrameCameras } from '../scene/frame-cameras.js';
|
|
33
34
|
import { GltfExtensions } from '../scene/gltf-extensions.js';
|
|
34
35
|
import { GradeTable } from '../scene/grade-table.js';
|
|
@@ -46,8 +47,8 @@ import { stopHelperWorkers } from '../shared/helper-workers.js';
|
|
|
46
47
|
import { imagesArrived, } from '../shared/images.js';
|
|
47
48
|
import { MEMORY_AREA_COUNT } from '../shared/memory-area.js';
|
|
48
49
|
import { MemoryViews } from '../shared/memory-views.js';
|
|
49
|
-
import { Counter, FrameRecorder, MemoryFigure, PHASE_NAMES, Phase, RingFrames, Role, } from '../shared/metrics.js';
|
|
50
|
-
import { plansPending, tasksPending } from '../shared/task-pending.js';
|
|
50
|
+
import { Counter, FrameRecorder, MemoryFigure, PHASE_NAMES, Phase, RingFrames, Role, refreshRate, } from '../shared/metrics.js';
|
|
51
|
+
import { endPlanHold, holdPlans, plansPending, releasePlans, tasksPending, } from '../shared/task-pending.js';
|
|
51
52
|
import { VIDEO_FRAME } from '../shared/videos.js';
|
|
52
53
|
import { slotChange, slotChangeOrRecheck } from '../shared/wake.js';
|
|
53
54
|
import { FixedClock, FrameClock, holdSteps } from './clock.js';
|
|
@@ -92,6 +93,75 @@ const COMMAND_CAPACITY = 1 << 16;
|
|
|
92
93
|
/** The id of the pointer that a timed script drives, and the bit of its main button. */
|
|
93
94
|
const MAIN_POINTER = 1;
|
|
94
95
|
const MAIN_BUTTON = 1;
|
|
96
|
+
/**
|
|
97
|
+
* How many of a sketch's listed files download at once, while no load asks for one. On HTTP/1.1 a
|
|
98
|
+
* browser opens few connections to one server, and a large file holds one until it has arrived, so
|
|
99
|
+
* the engine's own start files, such as the shader files that the setup's first frame asks for,
|
|
100
|
+
* still find free ones. One file at a time would leave the link idle for a round trip between files.
|
|
101
|
+
*/
|
|
102
|
+
const LISTED_AT_ONCE = 2;
|
|
103
|
+
/**
|
|
104
|
+
* How many of a sketch's listed files download at once while loads wait for them: those loads go
|
|
105
|
+
* ahead of the rest of the list. A setup that asks for many listed files together then still
|
|
106
|
+
* leaves connections for the engine's own files, which its loads need too, such as the model
|
|
107
|
+
* loader's code and the warm-up's shader files.
|
|
108
|
+
*/
|
|
109
|
+
const LISTED_MOST = 4;
|
|
110
|
+
/**
|
|
111
|
+
* Fetches a listed file that no load has asked for yet, at low priority, so the engine's own files
|
|
112
|
+
* go first where the browser orders requests, as it does on HTTP/2.
|
|
113
|
+
*/
|
|
114
|
+
const fetchListed = (address) => fetch(address, { priority: 'low' });
|
|
115
|
+
/**
|
|
116
|
+
* The addresses of a sketch's download list, resolved against the page's address, without repeats.
|
|
117
|
+
* Throws E1214 for a list that is not an array, and for an entry that is not a file's address.
|
|
118
|
+
*/
|
|
119
|
+
function listedAddresses(list, base) {
|
|
120
|
+
if (!Array.isArray(list))
|
|
121
|
+
throw new EngineError('E1214', `defineSketch() got ${String(list)} for downloads, which takes an array of addresses.`);
|
|
122
|
+
const addresses = new Map();
|
|
123
|
+
for (const entry of list) {
|
|
124
|
+
let address;
|
|
125
|
+
if (entry instanceof URL || (typeof entry === 'string' && entry.trim() !== '')) {
|
|
126
|
+
try {
|
|
127
|
+
address = new URL(entry, base);
|
|
128
|
+
}
|
|
129
|
+
catch { }
|
|
130
|
+
}
|
|
131
|
+
if (!address)
|
|
132
|
+
throw new EngineError('E1214', `defineSketch() got ${typeof entry === 'string' ? JSON.stringify(entry) : String(entry)} in downloads, which is not the address of a file.`);
|
|
133
|
+
addresses.set(address.href, address);
|
|
134
|
+
}
|
|
135
|
+
return [...addresses.values()];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @internal Begins the downloads of a live sketch's list, unless `files` holds them already: the
|
|
139
|
+
* first two fetches at once, and the assets loader's code beside them, whose downloads read the
|
|
140
|
+
* bodies as they arrive and start the rest. A list that is not valid begins nothing, and the setup
|
|
141
|
+
* reports it.
|
|
142
|
+
*/
|
|
143
|
+
export function startListedFiles(files, sketch, base) {
|
|
144
|
+
const list = sketch.options.downloads;
|
|
145
|
+
if (files.downloads || list === undefined)
|
|
146
|
+
return;
|
|
147
|
+
let addresses;
|
|
148
|
+
try {
|
|
149
|
+
addresses = listedAddresses(list, base);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (addresses.length === 0)
|
|
155
|
+
return;
|
|
156
|
+
const started = addresses
|
|
157
|
+
.slice(0, LISTED_AT_ONCE)
|
|
158
|
+
.map((address) => awaitLater(fetchListed(address)));
|
|
159
|
+
files.downloads = awaitLater(import('../scene/assets.js').then(({ Downloads }) => {
|
|
160
|
+
const downloads = new Downloads(base);
|
|
161
|
+
downloads.list(addresses, started, LISTED_AT_ONCE, LISTED_MOST, fetchListed);
|
|
162
|
+
return downloads;
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
95
165
|
/** How often a wait for a control slot checks it, where the control block is not shared memory. */
|
|
96
166
|
const SLOT_POLL_MS = 4;
|
|
97
167
|
/** Each meter of automatic exposure, by its code in the core. */
|
|
@@ -103,6 +173,17 @@ const EXPOSURE_METERS = { downsample: 0, histogram: 1 };
|
|
|
103
173
|
const MEMORY_EVERY = 8;
|
|
104
174
|
/** Frames over which the sketch thread averages its parallel work before it asks for job workers. */
|
|
105
175
|
const JOB_WINDOW = 30;
|
|
176
|
+
/**
|
|
177
|
+
* The longest a window waits for its frames, in seconds of the sketch's own time, and the fewest
|
|
178
|
+
* frames it judges: a software GPU draws so few frames a second that a window of frames alone
|
|
179
|
+
* would never end inside a page's run, so the deadline ends the window once it holds the fewest
|
|
180
|
+
* frames. The runner reads no clock for this and allocates nothing per frame: its own step time
|
|
181
|
+
* carries the deadline, and a step is capped at a quarter second, so the deadline takes as few as
|
|
182
|
+
* eight frames. The mean over the frames it has then decides as it does for a full window.
|
|
183
|
+
*/
|
|
184
|
+
const JOB_WINDOW_SECONDS = 2;
|
|
185
|
+
/** The fewest frames a window needs before the deadline may end it. */
|
|
186
|
+
const JOB_WINDOW_MIN_FRAMES = 2;
|
|
106
187
|
/**
|
|
107
188
|
* The mean time per frame that the sketch thread spends in loops it hands out, in microseconds,
|
|
108
189
|
* from which it asks for more job workers: twice as many, and at least 2.
|
|
@@ -119,14 +200,35 @@ const JOB_PAUSE_SECONDS = 4.5;
|
|
|
119
200
|
* The assets API, whose loader loads with the first call that reads a file: a sketch that loads no
|
|
120
201
|
* file downloads none of it. Every call waits for the loader first. The two calls that answer with
|
|
121
202
|
* a function of their own answer at once: the extension handlers live beside the runner, so a
|
|
122
|
-
* registration keeps its errors, and the progress handlers join the loader once it arrives.
|
|
203
|
+
* registration keeps its errors, and the progress handlers join the loader once it arrives. The
|
|
204
|
+
* loader takes the downloads of the sketch's list when `listed` gives them, and a development build
|
|
205
|
+
* watches the sketch's loads while `watching` says so.
|
|
206
|
+
*
|
|
207
|
+
* With `inOrder`, as while the engine holds its frames, the calls run one at a time in the order
|
|
208
|
+
* the sketch made them: each starts once the call before it has answered. A load makes its
|
|
209
|
+
* textures, meshes and materials when its files arrive, and files arrive in an order that changes
|
|
210
|
+
* from run to run, so loads that ran together would make the scene's content in another order on
|
|
211
|
+
* each run, and the held frame would draw its objects in another order and with other ids.
|
|
123
212
|
*/
|
|
124
|
-
function lazyAssets(textures, base, makers) {
|
|
213
|
+
function lazyAssets(textures, base, makers, listed, watching, inOrder) {
|
|
125
214
|
const extensions = new GltfExtensions();
|
|
126
|
-
// The loader's file starts downloading at the first call that reads a file,
|
|
127
|
-
// a page that loads nothing must download none of it.
|
|
215
|
+
// The loader's file starts downloading at the first call that reads a file, or with the
|
|
216
|
+
// sketch's list, never at the start: a page that loads nothing must download none of it.
|
|
128
217
|
let ready;
|
|
129
|
-
|
|
218
|
+
/** The answer of the call made last, which the next call waits for when the calls run in order. */
|
|
219
|
+
let answered = Promise.resolve();
|
|
220
|
+
const load = () => (ready ??= awaitLater(import('../scene/assets.js').then(({ Assets, Downloads }) => {
|
|
221
|
+
const make = (downloads) => {
|
|
222
|
+
if (DEV)
|
|
223
|
+
downloads.watch(watching);
|
|
224
|
+
return new Assets(textures, base, makers, extensions, downloads);
|
|
225
|
+
};
|
|
226
|
+
// Without a list the loader is ready within the import's own promise steps, so its
|
|
227
|
+
// calls keep their place among the setup's other promises, as hold mode, a replay
|
|
228
|
+
// and a recording need.
|
|
229
|
+
const early = listed();
|
|
230
|
+
return early ? early.then(make) : make(new Downloads(base));
|
|
231
|
+
})));
|
|
130
232
|
return new Proxy({}, {
|
|
131
233
|
get(_target, name) {
|
|
132
234
|
// The proxy must not look like a promise to the code that awaits a call's result.
|
|
@@ -145,7 +247,14 @@ function lazyAssets(textures, base, makers) {
|
|
|
145
247
|
return () => off?.();
|
|
146
248
|
};
|
|
147
249
|
}
|
|
148
|
-
return (...args) =>
|
|
250
|
+
return (...args) => {
|
|
251
|
+
const call = () => load().then((assets) => assets[name](...args));
|
|
252
|
+
if (!inOrder)
|
|
253
|
+
return call();
|
|
254
|
+
const answer = answered.then(call, call);
|
|
255
|
+
answered = answer;
|
|
256
|
+
return answer;
|
|
257
|
+
};
|
|
149
258
|
},
|
|
150
259
|
});
|
|
151
260
|
}
|
|
@@ -234,6 +343,15 @@ export class SketchRunner {
|
|
|
234
343
|
callbacks = {};
|
|
235
344
|
/** True once the setup function has returned. */
|
|
236
345
|
setUp = false;
|
|
346
|
+
/** The downloads of the sketch's list, once a live setup began or took them. */
|
|
347
|
+
listed;
|
|
348
|
+
/** Resolves the sketch's `engine.firstFrame`, until it has. */
|
|
349
|
+
firstFrameReached;
|
|
350
|
+
/**
|
|
351
|
+
* True while a development build watches the sketch's loads for one that waits for another:
|
|
352
|
+
* during the setup function of a live start.
|
|
353
|
+
*/
|
|
354
|
+
watchesLoads = false;
|
|
237
355
|
/** The frames that warm-ups during the setup published, one after another, as the last one's number. */
|
|
238
356
|
setupFrames = Promise.resolve(0);
|
|
239
357
|
clock = new FrameClock();
|
|
@@ -276,6 +394,8 @@ export class SketchRunner {
|
|
|
276
394
|
*/
|
|
277
395
|
jobWindowUs = 0;
|
|
278
396
|
jobWindowFrames = 0;
|
|
397
|
+
/** The sketch time at which the window's first frame arrived, in seconds. */
|
|
398
|
+
jobWindowStart = 0;
|
|
279
399
|
/** The sketch time at which the sketch thread times its parallel loops again, while they pause. */
|
|
280
400
|
jobPauseUntil = -1;
|
|
281
401
|
/** Whether the core times the parallel loops that the sketch thread hands out. */
|
|
@@ -312,6 +432,10 @@ export class SketchRunner {
|
|
|
312
432
|
frameTimes;
|
|
313
433
|
/** The governor's count of changes when the core last took the settings that its steps move. */
|
|
314
434
|
stepChanges = 0;
|
|
435
|
+
/** The governor's count of tier changes when the sketch last took the tier's settings. */
|
|
436
|
+
tierChanges = 0;
|
|
437
|
+
/** The settings that the tier replaced, to give back when it leaves, or undefined outside it. */
|
|
438
|
+
tierRestore;
|
|
315
439
|
/** The budgets' count of changes when the governor last took the steps that they allow. */
|
|
316
440
|
budgetChanges = 0;
|
|
317
441
|
/** The sketch's post-processing settings, which say whether bloom is on. */
|
|
@@ -360,6 +484,11 @@ export class SketchRunner {
|
|
|
360
484
|
heldScale = FULL_SCALE;
|
|
361
485
|
/** The sketch's debug drawing, in development builds only, which is also its `ctx.debug`. */
|
|
362
486
|
debugDraw;
|
|
487
|
+
/**
|
|
488
|
+
* The development build's inspection channel, which the in-page inspector and the MCP server
|
|
489
|
+
* call. A release build holds none of it.
|
|
490
|
+
*/
|
|
491
|
+
channel;
|
|
363
492
|
/** The sketch's labels, which each frame projects. */
|
|
364
493
|
ui;
|
|
365
494
|
/** True once the sketch thread has warned that the grid cells ran out. */
|
|
@@ -376,11 +505,24 @@ export class SketchRunner {
|
|
|
376
505
|
replaying = false;
|
|
377
506
|
/** True when the page records this session's frames and input. */
|
|
378
507
|
records;
|
|
508
|
+
/** The start data as JSON text: a replay's own, or the page's. A recording keeps it. */
|
|
509
|
+
dataText;
|
|
379
510
|
/**
|
|
380
511
|
* True when the session runs fixed frames rather than the page's: hold mode, which steps to a
|
|
381
512
|
* time, or a replay, which steps through a recording.
|
|
382
513
|
*/
|
|
383
514
|
holdsFrames;
|
|
515
|
+
/**
|
|
516
|
+
* True while the preset check measures the frames of play. The governor waits until it ends, so
|
|
517
|
+
* the check measures each preset at the full render scale.
|
|
518
|
+
*/
|
|
519
|
+
checking = false;
|
|
520
|
+
/**
|
|
521
|
+
* The refresh rate that the thread that draws measured when the sketch's setup returned, before
|
|
522
|
+
* the frames of play loaded the GPU, or 0 before it measured one. The preset check's target and
|
|
523
|
+
* the governor's start from it.
|
|
524
|
+
*/
|
|
525
|
+
setupRefreshHz = 0;
|
|
384
526
|
context;
|
|
385
527
|
/**
|
|
386
528
|
* Starts the engine on the core's thread. `holdSeconds` starts hold mode at that sketch time: it
|
|
@@ -395,6 +537,7 @@ export class SketchRunner {
|
|
|
395
537
|
this.holdScript = holdScript;
|
|
396
538
|
this.replayProgram = replay;
|
|
397
539
|
this.records = record;
|
|
540
|
+
this.dataText = replay === undefined ? sketch.data : replay.data;
|
|
398
541
|
this.holdsFrames = holdSeconds !== undefined || replay !== undefined;
|
|
399
542
|
this.record = new FrameRecorder(metrics, Role.Sketch);
|
|
400
543
|
this.jobRecords = Array.from({ length: sketch.jobWorkers }, (_, k) => new FrameRecorder(metrics, Role.Job + k));
|
|
@@ -447,6 +590,9 @@ export class SketchRunner {
|
|
|
447
590
|
// A device that draws on the CPU keeps the whole render scale once a step below it failed:
|
|
448
591
|
// its two-step upscale costs about what the smaller scene saves (D-237).
|
|
449
592
|
this.governor.setSoftware(device.softwareRenderer);
|
|
593
|
+
// The page's `?tier=off` switch keeps the tier out, which a test that measures the presets
|
|
594
|
+
// asks for.
|
|
595
|
+
this.governor.setLowestTier(sketch.quality.lowestAllowed !== false);
|
|
450
596
|
this.governorLoop =
|
|
451
597
|
holdSeconds === undefined
|
|
452
598
|
? new GovernorLoop(this.governor, metrics, {
|
|
@@ -458,12 +604,21 @@ export class SketchRunner {
|
|
|
458
604
|
// Alpha to coverage fades a mask's edges only on targets with MSAA.
|
|
459
605
|
this.preloads = new ShaderPreloads(sketch.sendPreload);
|
|
460
606
|
this.preloads.setUsable('coverage', device.antialias === ANTIALIAS_MSAA);
|
|
607
|
+
this.preloads.setPassFacts({
|
|
608
|
+
tier: sketch.capabilities.tier,
|
|
609
|
+
device,
|
|
610
|
+
settings: () => this.quality.settings,
|
|
611
|
+
});
|
|
461
612
|
const { governor } = this;
|
|
462
613
|
const bloomSize = () => this.bloomSetting / 2 ** governor.bloomHalvings;
|
|
463
614
|
this.quality = new SketchQuality(sketch.quality, (update, changed) => {
|
|
464
615
|
this.applyFrameSettings(update.settings);
|
|
465
616
|
textures.applyQuality(update.settings, changed);
|
|
466
617
|
sketch.applyQuality(update);
|
|
618
|
+
// A preset or the sketch gives the settings their own values again, and the tier
|
|
619
|
+
// keeps its cuts.
|
|
620
|
+
if (this.governor.lowest)
|
|
621
|
+
this.applyTierSettings();
|
|
467
622
|
}, () => this.settle(true), () => this.renderScale() / FULL_SCALE, {
|
|
468
623
|
get steps() {
|
|
469
624
|
return governor.steps;
|
|
@@ -489,8 +644,20 @@ export class SketchRunner {
|
|
|
489
644
|
get farAnimationInterval() {
|
|
490
645
|
return governor.animationInterval;
|
|
491
646
|
},
|
|
647
|
+
get lowest() {
|
|
648
|
+
return governor.lowest;
|
|
649
|
+
},
|
|
492
650
|
}, textures.memory);
|
|
493
651
|
this.textures = textures;
|
|
652
|
+
if (sketch.quality.lowest === true) {
|
|
653
|
+
// The page started in the tier, so the settings carry its values already. Remember the
|
|
654
|
+
// preset's, which the governor gives back when the frames have room for its window.
|
|
655
|
+
const { preset } = sketch.quality;
|
|
656
|
+
const path = sketch.capabilities.tier;
|
|
657
|
+
this.governor.startLowest(thousandths(presetValue('minRenderScale', preset, path)), thousandths(presetValue('maxRenderScale', preset, path)));
|
|
658
|
+
this.tierRestore = tierRestoreSettings(presetSettings(preset, {}, path));
|
|
659
|
+
this.tierChanges = this.governor.tierChanges;
|
|
660
|
+
}
|
|
494
661
|
this.applyFrameSettings(this.quality.settings);
|
|
495
662
|
this.readViewport();
|
|
496
663
|
const host = {
|
|
@@ -527,19 +694,41 @@ export class SketchRunner {
|
|
|
527
694
|
if (debugView !== undefined)
|
|
528
695
|
this.debugDraw?.requestView(debugView);
|
|
529
696
|
const debug = this.debugDraw ?? new SketchDebug(host);
|
|
697
|
+
if (DEV) {
|
|
698
|
+
// The channel reads the scene, the render passes and the quality settings that the
|
|
699
|
+
// inspector changes, and outlines the object that it selects.
|
|
700
|
+
const channel = new DebugChannel({
|
|
701
|
+
scene,
|
|
702
|
+
render: this.render,
|
|
703
|
+
quality: this.quality,
|
|
704
|
+
debug,
|
|
705
|
+
debugDraw: this.debugDraw,
|
|
706
|
+
info: () => ({
|
|
707
|
+
tier: sketch.capabilities.tier,
|
|
708
|
+
preset: this.quality.preset,
|
|
709
|
+
renderScale: this.renderScale() / FULL_SCALE,
|
|
710
|
+
}),
|
|
711
|
+
});
|
|
712
|
+
this.channel = channel;
|
|
713
|
+
this.inspect = (call, args) => channel.inspect(call, args);
|
|
714
|
+
}
|
|
530
715
|
const holdsFrames = this.holdsFrames;
|
|
531
716
|
this.context = {
|
|
717
|
+
data: this.dataText === undefined ? undefined : JSON.parse(this.dataText),
|
|
532
718
|
time: this.time,
|
|
533
719
|
engine: {
|
|
534
720
|
viewport: this.viewport,
|
|
535
721
|
capabilities: sketch.capabilities,
|
|
536
722
|
held: this.holdsFrames,
|
|
723
|
+
firstFrame: new Promise((resolve) => {
|
|
724
|
+
this.firstFrameReached = resolve;
|
|
725
|
+
}),
|
|
537
726
|
},
|
|
538
727
|
scene,
|
|
539
728
|
materials,
|
|
540
729
|
geometry,
|
|
541
730
|
textures,
|
|
542
|
-
assets: lazyAssets(textures, sketch.pageUrl, { core: this.core, geometry, materials, scene }),
|
|
731
|
+
assets: lazyAssets(textures, sketch.pageUrl, { core: this.core, geometry, materials, scene }, () => this.listed, () => this.watchesLoads, this.holdsFrames),
|
|
543
732
|
input: this.input,
|
|
544
733
|
post: this.post,
|
|
545
734
|
render: this.render,
|
|
@@ -582,23 +771,54 @@ export class SketchRunner {
|
|
|
582
771
|
: (replay?.seed ?? (record ? RECORDING_SEED : undefined));
|
|
583
772
|
if (seed !== undefined)
|
|
584
773
|
this.restoreRandom = seedMathRandom(seed);
|
|
774
|
+
// The level plans that the setup starts hand over their levels when the hold begins, in the
|
|
775
|
+
// order they started, so the scene's meshes sit in engine memory in one order on every run.
|
|
776
|
+
// Last too, so a constructor that fails leaves the plans handing over as they answer.
|
|
777
|
+
if (holdSeconds !== undefined)
|
|
778
|
+
holdPlans();
|
|
585
779
|
}
|
|
586
780
|
/**
|
|
587
781
|
* Runs the sketch's setup function, which returns the sketch's callbacks. When the page asks for
|
|
588
|
-
*
|
|
589
|
-
*
|
|
782
|
+
* the preset check before play, the check follows, and the setup resolves after it. When it asks
|
|
783
|
+
* for the check during play, the check starts as the setup resolves, and measures the frames
|
|
784
|
+
* that the frame loop draws from then on. In hold mode, it then steps the sketch to the held time
|
|
785
|
+
* (see `hold`). Options out of range fail with E1214 before the setup function runs. A live
|
|
786
|
+
* start's listed files are downloading by then; hold mode, a replay and a recording leave each
|
|
787
|
+
* file to its load, so their order stays as without the list.
|
|
590
788
|
*/
|
|
591
789
|
async setup(sketch) {
|
|
790
|
+
const { options } = sketch;
|
|
592
791
|
try {
|
|
593
|
-
this.fixed = new FixedClock(
|
|
792
|
+
this.fixed = new FixedClock(options.fixedRate, options.maxFixedSteps);
|
|
793
|
+
// A sketch whose own thread limits its frames keeps the governor out of the lowest tier:
|
|
794
|
+
// its smaller render cannot speed the sketch work, so the cut only loses the picture.
|
|
795
|
+
if (options.lowestTier === false)
|
|
796
|
+
this.governor.setLowestTier(false);
|
|
797
|
+
const live = !this.holdsFrames && !this.records;
|
|
798
|
+
if (options.downloads !== undefined) {
|
|
799
|
+
const { pageUrl, listed = {} } = this.sketch;
|
|
800
|
+
listedAddresses(options.downloads, pageUrl);
|
|
801
|
+
if (live) {
|
|
802
|
+
startListedFiles(listed, sketch, pageUrl);
|
|
803
|
+
this.listed = listed.downloads;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
594
806
|
// The setup grows the scene, and a page that stalls here reports the time it spent doing it.
|
|
595
807
|
this.record.markSetupStart();
|
|
596
808
|
const growing = performance.now();
|
|
809
|
+
// The development warning watches the setup function's own loads. A setup that fails ends
|
|
810
|
+
// the start, so the watch needs no end of its own then.
|
|
811
|
+
if (DEV)
|
|
812
|
+
this.watchesLoads = live && options.serialLoadWarning !== false;
|
|
597
813
|
this.callbacks = (await sketch.setup(this.context)) ?? {};
|
|
814
|
+
if (DEV)
|
|
815
|
+
this.watchesLoads = false;
|
|
598
816
|
this.record.markSetupDone(performance.now() - growing);
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
817
|
+
this.setupRefreshHz = refreshRate(this.metrics);
|
|
818
|
+
this.governorLoop?.startTarget(this.setupRefreshHz);
|
|
819
|
+
const check = this.holdsFrames ? undefined : this.sketch.quality.check;
|
|
820
|
+
if (check === 'before-play')
|
|
821
|
+
await this.checkPreset(() => this.drawSetupFrame());
|
|
602
822
|
// Warm-ups that the setup started without waiting for them publish their frames first, so
|
|
603
823
|
// the frame loop never records while a setup frame does.
|
|
604
824
|
await this.setupFrames;
|
|
@@ -610,10 +830,16 @@ export class SketchRunner {
|
|
|
610
830
|
this.input.recorder = this.recorder;
|
|
611
831
|
}
|
|
612
832
|
this.setUp = true;
|
|
833
|
+
if (check === 'during-play')
|
|
834
|
+
void this.checkDuringPlay();
|
|
613
835
|
if (this.holdSeconds !== undefined)
|
|
614
836
|
await this.hold(this.holdSeconds);
|
|
615
837
|
else if (this.replayProgram !== undefined)
|
|
616
838
|
await this.replay(this.replayProgram);
|
|
839
|
+
// Hold mode and a replay record no frame after their last, so the sketch's `firstFrame`
|
|
840
|
+
// work can no longer change the frames that they show.
|
|
841
|
+
if (this.holdsFrames)
|
|
842
|
+
this.reachFirstFrame();
|
|
617
843
|
}
|
|
618
844
|
catch (error) {
|
|
619
845
|
// A setup that fails, at any step, leaves no runner to dispose, so the runner stops hearing
|
|
@@ -623,45 +849,92 @@ export class SketchRunner {
|
|
|
623
849
|
throw error;
|
|
624
850
|
}
|
|
625
851
|
}
|
|
852
|
+
/**
|
|
853
|
+
* The preset check during play: the frame loop draws the scene and runs the sketch, and the
|
|
854
|
+
* check measures its frames. The governor waits until the check ends. A preset that the sketch
|
|
855
|
+
* asks for itself ends the check, which then reports no result: the sketch chose its preset.
|
|
856
|
+
*/
|
|
857
|
+
async checkDuringPlay() {
|
|
858
|
+
const { slots } = this.sketch.control;
|
|
859
|
+
const { quality } = this;
|
|
860
|
+
const requests = quality.presetRequests;
|
|
861
|
+
this.checking = true;
|
|
862
|
+
try {
|
|
863
|
+
await this.checkPreset(async () => {
|
|
864
|
+
if (Atomics.load(slots, Slot.Running) === 0)
|
|
865
|
+
return false;
|
|
866
|
+
await reached(slots, Slot.FramesTaken, nextFrame(Atomics.load(slots, Slot.FramesTaken)));
|
|
867
|
+
return Atomics.load(slots, Slot.Running) !== 0 && quality.presetRequests === requests;
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
finally {
|
|
871
|
+
this.checking = false;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
626
874
|
/**
|
|
627
875
|
* The preset check, after the setup: the first frame draws with every pipeline built, then the
|
|
628
|
-
* check measures the scene
|
|
629
|
-
*
|
|
630
|
-
*
|
|
876
|
+
* check measures the scene, and lowers the preset where the device cannot hold its frame rate.
|
|
877
|
+
* `drawFrame` resolves once the thread that draws has taken one more frame: a frame that it
|
|
878
|
+
* publishes of the scene as the setup built it, before play, or the frame loop's next frame,
|
|
879
|
+
* during play. It resolves with false when the check must stop. The check's code loads after the
|
|
880
|
+
* first frame, while the scene keeps drawing. A check that cannot load leaves the preset as it
|
|
881
|
+
* is. It goes on from the rounds that an earlier start measured before its check ended, when the
|
|
882
|
+
* page gives them. While the engine runs, the page hears of each lowering with the rounds so
|
|
883
|
+
* far, and that the check ended, with its result when it measured one.
|
|
631
884
|
*/
|
|
632
|
-
async checkPreset() {
|
|
633
|
-
|
|
885
|
+
async checkPreset(drawFrame) {
|
|
886
|
+
let check;
|
|
887
|
+
try {
|
|
888
|
+
check = await this.measurePreset(drawFrame);
|
|
889
|
+
}
|
|
890
|
+
catch (error) {
|
|
891
|
+
console.warn(`null3D could not check the quality preset: ${messageOf(error)}`);
|
|
892
|
+
}
|
|
893
|
+
if (this.core.stopped || Atomics.load(this.sketch.control.slots, Slot.Running) === 0)
|
|
634
894
|
return;
|
|
895
|
+
try {
|
|
896
|
+
this.quality.report(check);
|
|
897
|
+
}
|
|
898
|
+
catch (error) {
|
|
899
|
+
console.warn(`null3D could not report the quality preset check: ${messageOf(error)}`);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Runs the preset check with `drawFrame`, as `checkPreset` says, once the thread that draws has
|
|
904
|
+
* built the pipelines that the scene needs; undefined when it stopped.
|
|
905
|
+
*/
|
|
906
|
+
async measurePreset(drawFrame) {
|
|
907
|
+
await this.warmUp();
|
|
908
|
+
if (!(await drawFrame()))
|
|
909
|
+
return undefined;
|
|
635
910
|
const loading = import('./preset-check.js');
|
|
636
911
|
let loaded = false;
|
|
637
912
|
const settled = () => {
|
|
638
913
|
loaded = true;
|
|
639
914
|
};
|
|
640
915
|
loading.then(settled, settled);
|
|
641
|
-
const graceStart = performance.now();
|
|
642
916
|
while (!loaded)
|
|
643
|
-
if (!(await
|
|
644
|
-
return;
|
|
645
|
-
const { glue } = this.sketch;
|
|
917
|
+
if (!(await drawFrame()))
|
|
918
|
+
return undefined;
|
|
919
|
+
const { glue, maxTargetFps } = this.sketch;
|
|
646
920
|
const { quality } = this;
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
}
|
|
921
|
+
const { checkPreset, checkStart } = await loading;
|
|
922
|
+
return checkPreset({
|
|
923
|
+
metrics: this.metrics,
|
|
924
|
+
get preset() {
|
|
925
|
+
return quality.preset;
|
|
926
|
+
},
|
|
927
|
+
lower: (check, to) => quality.lower(check, to),
|
|
928
|
+
drawFrame,
|
|
929
|
+
uploading: () => glue.textureStat(TEXTURE_STAT_WAITING, 0) > 0,
|
|
930
|
+
maxTargetFps,
|
|
931
|
+
resumes: () => Atomics.load(this.sketch.control.slots, Slot.Resumes),
|
|
932
|
+
}, checkStart(quality.preset, this.setupRefreshHz, maxTargetFps, this.sketch.quality.resume));
|
|
933
|
+
}
|
|
934
|
+
/** Resolves the sketch's `engine.firstFrame`, once. */
|
|
935
|
+
reachFirstFrame() {
|
|
936
|
+
this.firstFrameReached?.();
|
|
937
|
+
this.firstFrameReached = undefined;
|
|
665
938
|
}
|
|
666
939
|
/** True once the setup function has returned, so the frame loop may step the sketch. */
|
|
667
940
|
get started() {
|
|
@@ -725,9 +998,14 @@ export class SketchRunner {
|
|
|
725
998
|
/**
|
|
726
999
|
* Ends the sketch when the engine stops: runs its onDestroy, then makes every later call to the
|
|
727
1000
|
* engine fail with E1420, so code that outlives the engine never reaches the next engine's core.
|
|
728
|
-
* It also gives the thread its own Math.random back, where hold mode seeded it
|
|
1001
|
+
* It also gives the thread its own Math.random back, where hold mode seeded it, and ends hold
|
|
1002
|
+
* mode's hold on the level plans, for a setup that failed before its hold.
|
|
729
1003
|
*/
|
|
730
1004
|
dispose() {
|
|
1005
|
+
// Before the check below: a runner whose core stopped first still lets go of the channel,
|
|
1006
|
+
// which holds the scene and its memory.
|
|
1007
|
+
this.inspect = undefined;
|
|
1008
|
+
this.channel = undefined;
|
|
731
1009
|
// Before the check below: a runner whose core stopped first still stops hearing add-ons.
|
|
732
1010
|
if (DEV)
|
|
733
1011
|
this.stopAddonNotes?.();
|
|
@@ -745,6 +1023,7 @@ export class SketchRunner {
|
|
|
745
1023
|
stopHelperWorkers();
|
|
746
1024
|
this.restoreRandom?.();
|
|
747
1025
|
this.restoreRandom = undefined;
|
|
1026
|
+
endPlanHold();
|
|
748
1027
|
}
|
|
749
1028
|
/**
|
|
750
1029
|
* Delivers a message the page sent with engine.postToSketch. It arrives between frames. A
|
|
@@ -799,6 +1078,7 @@ export class SketchRunner {
|
|
|
799
1078
|
this.updateFailed = true;
|
|
800
1079
|
if (!this.reported.has(message)) {
|
|
801
1080
|
this.reported.add(message);
|
|
1081
|
+
this.channel?.recordError(message);
|
|
802
1082
|
console.error(error);
|
|
803
1083
|
this.sketch.reportSketchError?.(message);
|
|
804
1084
|
}
|
|
@@ -830,8 +1110,9 @@ export class SketchRunner {
|
|
|
830
1110
|
/**
|
|
831
1111
|
* Adds a frame's parallel work to the window, and at the window's end asks the page for twice
|
|
832
1112
|
* the `asked` job workers, and at least 2, when the frames handed out enough work to share.
|
|
833
|
-
*
|
|
834
|
-
*
|
|
1113
|
+
* The window ends at its frame count, or at its deadline once it holds enough frames, so a
|
|
1114
|
+
* slow GPU asks as a fast one does. After a window with less, the loops go untimed for a
|
|
1115
|
+
* while; once every job worker has been asked for, for good.
|
|
835
1116
|
*/
|
|
836
1117
|
growJobs(glue, asked) {
|
|
837
1118
|
if (asked >= this.jobRecords.length) {
|
|
@@ -845,8 +1126,14 @@ export class SketchRunner {
|
|
|
845
1126
|
this.timeHandedLoops(glue, true);
|
|
846
1127
|
return;
|
|
847
1128
|
}
|
|
1129
|
+
if (this.jobWindowFrames === 0)
|
|
1130
|
+
this.jobWindowStart = this.clock.now;
|
|
848
1131
|
this.jobWindowUs += glue.takeHandedUs();
|
|
849
|
-
|
|
1132
|
+
this.jobWindowFrames++;
|
|
1133
|
+
const byFrames = this.jobWindowFrames >= JOB_WINDOW;
|
|
1134
|
+
const byDeadline = this.jobWindowFrames >= JOB_WINDOW_MIN_FRAMES &&
|
|
1135
|
+
this.clock.now - this.jobWindowStart >= JOB_WINDOW_SECONDS;
|
|
1136
|
+
if (!byFrames && !byDeadline)
|
|
850
1137
|
return;
|
|
851
1138
|
const enough = this.jobWindowUs >= JOB_GROW_US * this.jobWindowFrames;
|
|
852
1139
|
this.jobWindowUs = 0;
|
|
@@ -901,7 +1188,8 @@ export class SketchRunner {
|
|
|
901
1188
|
this.heldScale = high;
|
|
902
1189
|
const { governor } = this;
|
|
903
1190
|
governor.setOn(settings.governor);
|
|
904
|
-
governor.
|
|
1191
|
+
governor.setLevelSteps(settings.governorLevels);
|
|
1192
|
+
governor.setRange(low, high, this.quality.owns('minRenderScale'));
|
|
905
1193
|
this.followMovers = settings.followMovingCasters;
|
|
906
1194
|
this.cascadeBlend = settings.shadowCascadeBlend;
|
|
907
1195
|
this.lodThreshold = settings.lodThreshold;
|
|
@@ -923,6 +1211,7 @@ export class SketchRunner {
|
|
|
923
1211
|
this.stepChanges = governor.stepChanges;
|
|
924
1212
|
const { glue } = this.sketch;
|
|
925
1213
|
if (glue.setRenderScaling((settings.governor ? low : high) < FULL_SCALE) !== 0 ||
|
|
1214
|
+
glue.setDepthPrepass(settings.depthPrepass) !== 0 ||
|
|
926
1215
|
this.setShadowQuality() !== 0 ||
|
|
927
1216
|
glue.setBloomChain(this.bloomSetting, governor.bloomHalvings) !== 0 ||
|
|
928
1217
|
glue.setAoScale(governor.aoScale) !== 0 ||
|
|
@@ -996,11 +1285,13 @@ export class SketchRunner {
|
|
|
996
1285
|
}
|
|
997
1286
|
/**
|
|
998
1287
|
* Gives the core the shadow settings and bloom's base after a step of the governor, and tells
|
|
999
|
-
* the sketch's change handlers of it.
|
|
1288
|
+
* the sketch's change handlers of it. The lowest quality tier's settings come before those
|
|
1289
|
+
* steps, so a step that the tier's cuts allow reads the values that it leaves.
|
|
1000
1290
|
*/
|
|
1001
1291
|
applyGovernedSteps() {
|
|
1002
1292
|
const { governor } = this;
|
|
1003
1293
|
const { glue } = this.sketch;
|
|
1294
|
+
this.applyTierSettings();
|
|
1004
1295
|
this.stepChanges = governor.stepChanges;
|
|
1005
1296
|
if (this.setLevelQuality() !== 0 ||
|
|
1006
1297
|
this.setShadowQuality() !== 0 ||
|
|
@@ -1012,6 +1303,39 @@ export class SketchRunner {
|
|
|
1012
1303
|
this.report(coreFailure(glue, 'the quality governor'));
|
|
1013
1304
|
this.quality.governed();
|
|
1014
1305
|
}
|
|
1306
|
+
/**
|
|
1307
|
+
* Applies the lowest quality tier's cuts when the governor enters it, and gives the settings
|
|
1308
|
+
* back when it leaves. The sketch's own choice of a preset does not keep them: a preset gives
|
|
1309
|
+
* the settings its own values again.
|
|
1310
|
+
*/
|
|
1311
|
+
applyTierSettings() {
|
|
1312
|
+
const { governor, quality } = this;
|
|
1313
|
+
this.tierChanges = governor.tierChanges;
|
|
1314
|
+
const { settings } = quality;
|
|
1315
|
+
// A render-scale floor that the sketch set itself wins over the tier's, in the tier and as it
|
|
1316
|
+
// leaves.
|
|
1317
|
+
const ownFloor = quality.owns('minRenderScale');
|
|
1318
|
+
if (governor.lowest) {
|
|
1319
|
+
this.tierRestore ??= tierRestoreSettings(settings);
|
|
1320
|
+
const cuts = lowestTierCuts(this.sketch.capabilities.tier, settings.minRenderScale);
|
|
1321
|
+
if (ownFloor)
|
|
1322
|
+
delete cuts.minRenderScale;
|
|
1323
|
+
const current = settings;
|
|
1324
|
+
if (Object.entries(cuts).some(([name, value]) => current[name] !== value))
|
|
1325
|
+
void quality.setGoverned(cuts);
|
|
1326
|
+
if (ownFloor)
|
|
1327
|
+
governor.setRange(thousandths(settings.minRenderScale), thousandths(settings.maxRenderScale), true);
|
|
1328
|
+
}
|
|
1329
|
+
else if (this.tierRestore) {
|
|
1330
|
+
const restore = { ...this.tierRestore };
|
|
1331
|
+
this.tierRestore = undefined;
|
|
1332
|
+
if (ownFloor) {
|
|
1333
|
+
delete restore.minRenderScale;
|
|
1334
|
+
restore.maxRenderScale = Math.max(restore.maxRenderScale ?? settings.maxRenderScale, settings.minRenderScale);
|
|
1335
|
+
}
|
|
1336
|
+
void quality.setGoverned(restore);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1015
1339
|
/**
|
|
1016
1340
|
* Gives the governor the steps that the sketch's budgets allow, and moves the budgets to the
|
|
1017
1341
|
* governor's steps of their scale, which calls their `onScale` handlers.
|
|
@@ -1131,6 +1455,10 @@ export class SketchRunner {
|
|
|
1131
1455
|
* `timestamp` is the frame's time in milliseconds.
|
|
1132
1456
|
*/
|
|
1133
1457
|
step(timestamp) {
|
|
1458
|
+
// A live sketch's `firstFrame` resolves at the first step after the GPU finished the first
|
|
1459
|
+
// frame, which the thread that draws records; the check ends once it has.
|
|
1460
|
+
if (this.firstFrameReached !== undefined && !this.holdsFrames && this.record.firstFrameDone)
|
|
1461
|
+
this.reachFirstFrame();
|
|
1134
1462
|
const resumes = Atomics.load(this.sketch.control.slots, Slot.Resumes);
|
|
1135
1463
|
this.resumed = this.resumes >= 0 && resumes !== this.resumes;
|
|
1136
1464
|
this.resumes = resumes;
|
|
@@ -1170,6 +1498,12 @@ export class SketchRunner {
|
|
|
1170
1498
|
this.render.held = true;
|
|
1171
1499
|
this.recorded.held = true;
|
|
1172
1500
|
try {
|
|
1501
|
+
// The tasks and level plans that the setup started answer whenever the job workers finish
|
|
1502
|
+
// them. The steps start once they all have, and the plans hand over their levels in the
|
|
1503
|
+
// order they started, so the steps and the held frame find the same scene on every run.
|
|
1504
|
+
releasePlans();
|
|
1505
|
+
if (tasksPending() > 0)
|
|
1506
|
+
await this.settleTasks();
|
|
1173
1507
|
for (let step = 0; step <= steps; step++) {
|
|
1174
1508
|
this.clock.holdStep(step, steps, seconds);
|
|
1175
1509
|
const now = this.clock.now;
|
|
@@ -1237,6 +1571,7 @@ export class SketchRunner {
|
|
|
1237
1571
|
throw new EngineError('E1408', `hold mode stopped at ${Number(this.clock.now.toFixed(3))} seconds, in frame ${this.context.time.frame}: ${messageOf(error)}${phase}`);
|
|
1238
1572
|
}
|
|
1239
1573
|
finally {
|
|
1574
|
+
endPlanHold();
|
|
1240
1575
|
this.holding = false;
|
|
1241
1576
|
this.time.held = false;
|
|
1242
1577
|
this.time.drawn = true;
|
|
@@ -1389,6 +1724,7 @@ export class SketchRunner {
|
|
|
1389
1724
|
return this.recorder.encode({
|
|
1390
1725
|
fixedRate: Math.round(1 / this.fixed.step),
|
|
1391
1726
|
sketch: this.sketch.sketchUrl,
|
|
1727
|
+
data: this.dataText,
|
|
1392
1728
|
});
|
|
1393
1729
|
}
|
|
1394
1730
|
/** The dump steps that fall at the frame that is about to run, which read it after it ran. */
|
|
@@ -1561,11 +1897,12 @@ export class SketchRunner {
|
|
|
1561
1897
|
this.readViewport();
|
|
1562
1898
|
// The governor judges the frames so far before the sketch's update, which then sees the
|
|
1563
1899
|
// render scale of this frame, and whose change handlers hear of a shadow step.
|
|
1564
|
-
if (play && this.governorLoop) {
|
|
1900
|
+
if (play && this.governorLoop && !this.checking) {
|
|
1565
1901
|
this.governorLoop.now[0] = start;
|
|
1566
1902
|
this.governorLoop.frame(this.resumed);
|
|
1567
1903
|
this.resumed = false;
|
|
1568
|
-
if (this.governor.stepChanges !== this.stepChanges
|
|
1904
|
+
if (this.governor.stepChanges !== this.stepChanges ||
|
|
1905
|
+
this.governor.tierChanges !== this.tierChanges)
|
|
1569
1906
|
this.applyGovernedSteps();
|
|
1570
1907
|
}
|
|
1571
1908
|
// Handlers that hear of a restart may create objects with new pipelines, so their frame
|
|
@@ -1652,7 +1989,8 @@ export class SketchRunner {
|
|
|
1652
1989
|
}
|
|
1653
1990
|
if (this.followEffects())
|
|
1654
1991
|
restart = true;
|
|
1655
|
-
if (this.governor.stepChanges !== this.stepChanges
|
|
1992
|
+
if (this.governor.stepChanges !== this.stepChanges ||
|
|
1993
|
+
this.governor.tierChanges !== this.tierChanges)
|
|
1656
1994
|
this.applyGovernedSteps();
|
|
1657
1995
|
// Development builds first report static batch rows written without markDirty, because the
|
|
1658
1996
|
// batch update clears the marks.
|