@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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EngineError } from '../errors/engine-error.js';
|
|
2
|
+
/** The first frame's promise, which the start settles once. */
|
|
3
|
+
export declare class FirstFrame {
|
|
4
|
+
readonly promise: Promise<void>;
|
|
5
|
+
private resolve;
|
|
6
|
+
private reject;
|
|
7
|
+
constructor();
|
|
8
|
+
/** The GPU has finished the first frame. */
|
|
9
|
+
drawn(): void;
|
|
10
|
+
/**
|
|
11
|
+
* The engine draws no more frames. `drawn` says whether the GPU finished the first frame first,
|
|
12
|
+
* which resolves the promise. Otherwise it rejects with `failure`, the failure that ended the
|
|
13
|
+
* frames, or with E1420 for a stop that no failure caused.
|
|
14
|
+
*/
|
|
15
|
+
stopped(drawn: boolean, failure?: EngineError): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// `engine.firstFrame`: resolves once the GPU has finished the first frame after the setup, and
|
|
2
|
+
// rejects when the engine stops drawing first, so a page that waits only for the first frame
|
|
3
|
+
// hears why it never came. The engine starts its frames once the setup has run, and the preset
|
|
4
|
+
// check measures them during play, so a failure of the thread that draws at its first frame comes
|
|
5
|
+
// after `createEngine` has resolved.
|
|
6
|
+
import { EngineError } from '../errors/engine-error.js';
|
|
7
|
+
/** The first frame's promise, which the start settles once. */
|
|
8
|
+
export class FirstFrame {
|
|
9
|
+
promise;
|
|
10
|
+
resolve = () => { };
|
|
11
|
+
reject = () => { };
|
|
12
|
+
constructor() {
|
|
13
|
+
this.promise = new Promise((resolve, reject) => {
|
|
14
|
+
this.resolve = resolve;
|
|
15
|
+
this.reject = reject;
|
|
16
|
+
});
|
|
17
|
+
// A page that never waits for the first frame hears nothing of a rejection.
|
|
18
|
+
this.promise.catch(() => { });
|
|
19
|
+
}
|
|
20
|
+
/** The GPU has finished the first frame. */
|
|
21
|
+
drawn() {
|
|
22
|
+
this.resolve();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The engine draws no more frames. `drawn` says whether the GPU finished the first frame first,
|
|
26
|
+
* which resolves the promise. Otherwise it rejects with `failure`, the failure that ended the
|
|
27
|
+
* frames, or with E1420 for a stop that no failure caused.
|
|
28
|
+
*/
|
|
29
|
+
stopped(drawn, failure) {
|
|
30
|
+
if (drawn)
|
|
31
|
+
this.resolve();
|
|
32
|
+
else
|
|
33
|
+
this.reject(failure ?? new EngineError('E1420', 'the engine stopped before it drew its first frame.'));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PhaseName, type RingRecords } from '../shared/metrics.js';
|
|
1
|
+
import { type MetricsReader, type PhaseName, type RingRecords } from '../shared/metrics.js';
|
|
2
2
|
import { type Percentiles } from '../shared/stats.js';
|
|
3
3
|
/**
|
|
4
4
|
* One thread's CPU time per frame, in `FrameSummary.threads`.
|
|
@@ -261,6 +261,13 @@ export interface FrameMetrics extends FrameSummary {
|
|
|
261
261
|
firstDrawMs: number | null;
|
|
262
262
|
/** GPU pipelines that the first frame built, or null before the first frame. */
|
|
263
263
|
firstFramePipelines: number | null;
|
|
264
|
+
/**
|
|
265
|
+
* When the thread that draws reached each step of its start, in milliseconds from the start
|
|
266
|
+
* of page navigation. Right after the probe, the page tells that thread which GPU path and
|
|
267
|
+
* device to start, so it asks for its device and its shader files while the core downloads.
|
|
268
|
+
* A step that the thread has not reached, or does not take, is null.
|
|
269
|
+
*/
|
|
270
|
+
drawingStart: DrawingStart;
|
|
264
271
|
/**
|
|
265
272
|
* The quality preset in force when the first frame was drawn: the one the engine starts with.
|
|
266
273
|
* It can differ from the preset the page ends on, because the engine's own preset check may
|
|
@@ -296,6 +303,32 @@ export interface FrameMetrics extends FrameSummary {
|
|
|
296
303
|
*/
|
|
297
304
|
slow?: SlowFrame[];
|
|
298
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* When the thread that draws reached each step of its start, in `FrameMetrics.load.drawingStart`:
|
|
308
|
+
* milliseconds from the start of page navigation, or null for a step that it has not reached or
|
|
309
|
+
* does not take.
|
|
310
|
+
*
|
|
311
|
+
* @category api/debug
|
|
312
|
+
*/
|
|
313
|
+
export interface DrawingStart {
|
|
314
|
+
/**
|
|
315
|
+
* The page's message after the probe arrived. The thread then started the downloads of its
|
|
316
|
+
* renderers and shader files, and on WebGPU the request for its device.
|
|
317
|
+
*/
|
|
318
|
+
requestMs: number | null;
|
|
319
|
+
/** Its WebGPU adapter arrived. Null on WebGL2. */
|
|
320
|
+
adapterMs: number | null;
|
|
321
|
+
/** Its WebGPU device arrived. Null on WebGL2. */
|
|
322
|
+
deviceMs: number | null;
|
|
323
|
+
/** The shader file of its device arrived. */
|
|
324
|
+
shadersMs: number | null;
|
|
325
|
+
/** The core and the thread's setup arrived from the page. */
|
|
326
|
+
initMs: number | null;
|
|
327
|
+
/** Its first renderer was built, so its frame loop could start. */
|
|
328
|
+
rendererMs: number | null;
|
|
329
|
+
}
|
|
330
|
+
/** The start of the thread that draws, as `reader` holds it, on the page's timeline. */
|
|
331
|
+
export declare function drawingStartFigures(reader: MetricsReader): DrawingStart;
|
|
299
332
|
/**
|
|
300
333
|
* The frame rates of one second of a measurement, in `FrameMetrics.perSecond`.
|
|
301
334
|
*
|
package/lib/page/frame-stats.js
CHANGED
|
@@ -7,6 +7,21 @@ import { commonStep, stepMs } from '../shared/gpu-clock.js';
|
|
|
7
7
|
import { COUNTER_NAMES, Counter, GPU_TIMED_PASSES, GpuCounter, PHASE_NAMES, Role, UNTIMED, } from '../shared/metrics.js';
|
|
8
8
|
import { measureWithEveryThread } from '../shared/page-measurement.js';
|
|
9
9
|
import { countPerSecond, percentiles, ratePerSecond, spanMs, } from '../shared/stats.js';
|
|
10
|
+
/** The start of the thread that draws, as `reader` holds it, on the page's timeline. */
|
|
11
|
+
export function drawingStartFigures(reader) {
|
|
12
|
+
const at = (step) => {
|
|
13
|
+
const epoch = reader.drawingStep(step);
|
|
14
|
+
return epoch > 0 ? epoch - performance.timeOrigin : null;
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
requestMs: at('request'),
|
|
18
|
+
adapterMs: at('adapter'),
|
|
19
|
+
deviceMs: at('device'),
|
|
20
|
+
shadersMs: at('shaders'),
|
|
21
|
+
initMs: at('init'),
|
|
22
|
+
rendererMs: at('renderer'),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
10
25
|
const NO_RECORDS = {
|
|
11
26
|
frames: [],
|
|
12
27
|
busy: [],
|
package/lib/page/label-loop.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export declare class LabelLoop {
|
|
|
25
25
|
private readonly seen;
|
|
26
26
|
/** The camera that the containers show, and the canvas size, as the update read them. */
|
|
27
27
|
private readonly cameraSeen;
|
|
28
|
+
/** The presented frame's camera, which the update reads with the tables. */
|
|
29
|
+
private readonly cameraNext;
|
|
28
30
|
/** The transform of a container, and the container of each parent element that holds 3D labels. */
|
|
29
31
|
private containerTransform;
|
|
30
32
|
private readonly containers;
|
|
@@ -52,11 +54,13 @@ export declare class LabelLoop {
|
|
|
52
54
|
/** Moves each bound element to its label in the frame on screen, if anything changed. */
|
|
53
55
|
update(): void;
|
|
54
56
|
/**
|
|
55
|
-
* Reads each binding's place from the presented tables into `next
|
|
56
|
-
*
|
|
57
|
+
* Reads each binding's place from the presented tables into `next`, and the presented frame's
|
|
58
|
+
* camera with them, under the same sequence count, so the elements and the containers show one
|
|
59
|
+
* frame. Returns that count, or -1 when the thread that draws kept changing the tables, so the
|
|
60
|
+
* elements stay as they are until the next update.
|
|
57
61
|
*/
|
|
58
62
|
private read;
|
|
59
|
-
/** Moves the containers to the
|
|
63
|
+
/** Moves the containers to the camera that the update read, when it or the canvas changed. */
|
|
60
64
|
private updateCamera;
|
|
61
65
|
/** Writes the styles of the elements whose place or view changed, after every read. */
|
|
62
66
|
private write;
|
package/lib/page/label-loop.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// scene: it sits in a container of its own, which holds the camera's perspective and turn, and its
|
|
12
12
|
// transform is the element's world matrix. The browser then turns it as it turns the scene.
|
|
13
13
|
import { controlLabels, Slot } from '../shared/control.js';
|
|
14
|
-
import { CAMERA_CENTER_X, CAMERA_CENTER_Y, CAMERA_HALF_HEIGHT, CAMERA_ORTHO, GENERATION_SHIFT, LABEL_SHOWN, LABEL_STATE, LABEL_WORDS, LABEL_X, LABEL_Y, LABEL3D_STATE, LABEL3D_WORDS, labelSequence, PRESENTED_TABLE, presentedCount, presentedCount3d, presentedFrame, presentedTable3d, TABLE_3D, } from '../shared/labels.js';
|
|
14
|
+
import { CAMERA_CENTER_X, CAMERA_CENTER_Y, CAMERA_FLOATS, CAMERA_HALF_HEIGHT, CAMERA_ORTHO, CAMERA_SHIFT_X, CAMERA_SHIFT_Y, GENERATION_SHIFT, LABEL_SHOWN, LABEL_STATE, LABEL_WORDS, LABEL_X, LABEL_Y, LABEL3D_STATE, LABEL3D_WORDS, labelSequence, PRESENTED_TABLE, presentedCount, presentedCount3d, presentedFrame, presentedTable3d, TABLE_3D, } from '../shared/labels.js';
|
|
15
15
|
/** How many times an update reads the labels again when the thread that draws changed them meanwhile. */
|
|
16
16
|
const READ_TRIES = 3;
|
|
17
17
|
/** The smallest move, in CSS pixels, that moves a screen label's element. */
|
|
@@ -23,7 +23,7 @@ const STATE_Y = 1;
|
|
|
23
23
|
const STATE_SHOWN = 2;
|
|
24
24
|
const STATE_MATRIX = 3;
|
|
25
25
|
/** The camera record that the containers show, then the canvas size they were made for. */
|
|
26
|
-
const CAMERA_STATE =
|
|
26
|
+
const CAMERA_STATE = CAMERA_FLOATS + 2;
|
|
27
27
|
/** The smallest number of a matrix that counts as zero, so a turn of the camera writes no noise. */
|
|
28
28
|
const EPSILON = 1e-10;
|
|
29
29
|
/** The bound elements, and the loop that moves them. */
|
|
@@ -50,6 +50,8 @@ export class LabelLoop {
|
|
|
50
50
|
seen = Float64Array.of(-1, 0, 0);
|
|
51
51
|
/** The camera that the containers show, and the canvas size, as the update read them. */
|
|
52
52
|
cameraSeen = new Float64Array(CAMERA_STATE).fill(Number.NaN);
|
|
53
|
+
/** The presented frame's camera, which the update reads with the tables. */
|
|
54
|
+
cameraNext = new Float64Array(CAMERA_STATE - 2);
|
|
53
55
|
/** The transform of a container, and the container of each parent element that holds 3D labels. */
|
|
54
56
|
containerTransform = '';
|
|
55
57
|
containers = new Map();
|
|
@@ -146,19 +148,22 @@ export class LabelLoop {
|
|
|
146
148
|
const sequence = labelSequence(region);
|
|
147
149
|
if (!this.changed && sequence === seen[0] && width === seen[1] && height === seen[2])
|
|
148
150
|
return;
|
|
149
|
-
|
|
151
|
+
const read = this.read(region, count, width, height);
|
|
152
|
+
if (read < 0)
|
|
150
153
|
return;
|
|
151
|
-
seen[0] =
|
|
154
|
+
seen[0] = read;
|
|
152
155
|
seen[1] = width;
|
|
153
156
|
seen[2] = height;
|
|
154
157
|
this.changed = false;
|
|
155
158
|
if (this.three > 0)
|
|
156
|
-
this.updateCamera(
|
|
159
|
+
this.updateCamera(width, height);
|
|
157
160
|
this.write(count);
|
|
158
161
|
}
|
|
159
162
|
/**
|
|
160
|
-
* Reads each binding's place from the presented tables into `next
|
|
161
|
-
*
|
|
163
|
+
* Reads each binding's place from the presented tables into `next`, and the presented frame's
|
|
164
|
+
* camera with them, under the same sequence count, so the elements and the containers show one
|
|
165
|
+
* frame. Returns that count, or -1 when the thread that draws kept changing the tables, so the
|
|
166
|
+
* elements stay as they are until the next update.
|
|
162
167
|
*/
|
|
163
168
|
read(region, count, width, height) {
|
|
164
169
|
const { ints, floats } = region;
|
|
@@ -194,17 +199,19 @@ export class LabelLoop {
|
|
|
194
199
|
next[n + STATE_X] = ((floats[at + LABEL_X] + 1) / 2) * width;
|
|
195
200
|
next[n + STATE_Y] = ((1 - floats[at + LABEL_Y]) / 2) * height;
|
|
196
201
|
}
|
|
202
|
+
if (this.three > 0)
|
|
203
|
+
this.cameraNext.set(region.presentedCamera);
|
|
197
204
|
if (labelSequence(region) !== sequence)
|
|
198
205
|
continue;
|
|
199
206
|
this.frame = frame;
|
|
200
|
-
return
|
|
207
|
+
return sequence;
|
|
201
208
|
}
|
|
202
|
-
return
|
|
209
|
+
return -1;
|
|
203
210
|
}
|
|
204
|
-
/** Moves the containers to the
|
|
205
|
-
updateCamera(
|
|
211
|
+
/** Moves the containers to the camera that the update read, when it or the canvas changed. */
|
|
212
|
+
updateCamera(width, height) {
|
|
206
213
|
const seen = this.cameraSeen;
|
|
207
|
-
const camera =
|
|
214
|
+
const camera = this.cameraNext;
|
|
208
215
|
let changed = seen[CAMERA_STATE - 2] !== width || seen[CAMERA_STATE - 1] !== height;
|
|
209
216
|
for (let k = 0; k < CAMERA_STATE - 2; k++) {
|
|
210
217
|
if (seen[k] !== camera[k])
|
|
@@ -399,10 +406,15 @@ export function cameraTransform(camera, width, height) {
|
|
|
399
406
|
`${number(camera[1])},${number(-camera[4])},${number(camera[7])},0,` +
|
|
400
407
|
`${number(camera[2])},${number(-camera[5])},${number(camera[8])},0,` +
|
|
401
408
|
`${number(tx)},${number(-ty)},${number(tz)},1)`;
|
|
402
|
-
const
|
|
409
|
+
const lens = camera[CAMERA_ORTHO] !== 0
|
|
403
410
|
? `scale(${number(focal)}) translate(${number(-camera[CAMERA_CENTER_X])}px,${number(camera[CAMERA_CENTER_Y])}px) `
|
|
404
411
|
: `perspective(${number(focal)}px) translateZ(${number(focal)}px) `;
|
|
405
|
-
|
|
412
|
+
// A lens shift moves the whole image after the projection, left and down for a view shifted
|
|
413
|
+
// right and up.
|
|
414
|
+
const shiftX = camera[CAMERA_SHIFT_X] * width;
|
|
415
|
+
const shiftY = camera[CAMERA_SHIFT_Y] * height;
|
|
416
|
+
const shift = shiftX === 0 && shiftY === 0 ? '' : `translate(${number(-shiftX)}px,${number(shiftY)}px) `;
|
|
417
|
+
return `${shift}${lens}${matrix} translate(${number(width / 2)}px,${number(height / 2)}px)`;
|
|
406
418
|
}
|
|
407
419
|
/** A number as CSS takes it, with the noise of a turn that did not move it set to zero. */
|
|
408
420
|
function number(value) {
|
package/lib/page/labels.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ export interface EngineLabels {
|
|
|
16
16
|
*
|
|
17
17
|
* A label that the sketch tracks with `transform: 'world'` or `'billboard'` is a plane of the
|
|
18
18
|
* scene: the engine moves the element into a container of its own inside the element's parent,
|
|
19
|
-
* and turns it with the scene's perspective
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* and turns it with the scene's perspective. Leave the element's `transform-origin` at its
|
|
20
|
+
* center, and size the element in CSS pixels, which are the scene's units at the distance where
|
|
21
|
+
* the view is one pixel per unit.
|
|
22
22
|
*/
|
|
23
23
|
bind(id: string, element: HTMLElement): () => void;
|
|
24
24
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { QualityPreset } from '../quality/presets.js';
|
|
2
|
+
import type { Tier } from '../shared/tier.js';
|
|
3
|
+
/**
|
|
4
|
+
* The facts that a pipeline list depends on, as one text: the engine's version, the GPU path, the
|
|
5
|
+
* device's fixed shader bits, the preset and the canvas's format. Two starts with the same text
|
|
6
|
+
* ask for the same pipelines for the same scene.
|
|
7
|
+
*/
|
|
8
|
+
export declare function pipelineConditions(tier: Tier, shaderBits: number, preset: QualityPreset, canvasFormat: string | undefined): string;
|
|
9
|
+
/** True when `list` holds whole create commands only, as a thread that draws lists them. */
|
|
10
|
+
export declare function isPipelineList(list: readonly number[]): boolean;
|
|
11
|
+
/** The stored pipeline list of one sketch, for one start of it. */
|
|
12
|
+
export declare class PipelineStore {
|
|
13
|
+
private readonly conditions;
|
|
14
|
+
private readonly storage;
|
|
15
|
+
private readonly key;
|
|
16
|
+
/**
|
|
17
|
+
* `conditions` are the start's, as `pipelineConditions` gives them. `storage` stands in for the
|
|
18
|
+
* page's localStorage in tests.
|
|
19
|
+
*/
|
|
20
|
+
constructor(sketchUrl: string, conditions: string, storage?: Storage | undefined);
|
|
21
|
+
/** The stored list that applies to this start, or undefined. */
|
|
22
|
+
read(): Uint32Array | undefined;
|
|
23
|
+
/** Stores the list of the pipelines that this start's first frame built. */
|
|
24
|
+
save(list: Uint32Array): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// The stored pipeline list: the pipelines that the first frame of each sketch's last start built,
|
|
2
|
+
// kept in the page's localStorage. The next start of the sketch in the same browser hands the list
|
|
3
|
+
// to the thread that draws, which starts those builds as soon as their shaders are there, while
|
|
4
|
+
// the core downloads and the setup runs (`gpu/early-builds.ts`). A start without a stored list
|
|
5
|
+
// builds each pipeline when the first frame asks for it. Chrome's own cache of compiled pipelines
|
|
6
|
+
// is small on Android, so a scene of a few dozen pipelines outgrows it and each visit compiles
|
|
7
|
+
// every pipeline again. A list applies only to a start on the same GPU path, with the same fixed
|
|
8
|
+
// shader bits, at the same preset, with the same engine version. It only names pipelines, so a
|
|
9
|
+
// list that the scene outgrew costs builds that no frame takes, never a wrong picture. Storage that
|
|
10
|
+
// cannot be read or written counts as empty.
|
|
11
|
+
import { OP_CREATE_COMPUTE_PIPELINE, OP_CREATE_RENDER_PIPELINE } from '../generated/gpu.js';
|
|
12
|
+
import { operandsAfterId, PIPELINE_LIST_LIMIT } from '../gpu/early-builds.js';
|
|
13
|
+
import { VERSION } from '../shared/version.js';
|
|
14
|
+
import { pageStorage } from './start-marker.js';
|
|
15
|
+
const KEY_PREFIX = 'null3d.pipelines:';
|
|
16
|
+
/**
|
|
17
|
+
* The facts that a pipeline list depends on, as one text: the engine's version, the GPU path, the
|
|
18
|
+
* device's fixed shader bits, the preset and the canvas's format. Two starts with the same text
|
|
19
|
+
* ask for the same pipelines for the same scene.
|
|
20
|
+
*/
|
|
21
|
+
export function pipelineConditions(tier, shaderBits, preset, canvasFormat) {
|
|
22
|
+
return JSON.stringify([VERSION, tier, shaderBits, preset, canvasFormat ?? null]);
|
|
23
|
+
}
|
|
24
|
+
/** True when `list` holds whole create commands only, as a thread that draws lists them. */
|
|
25
|
+
export function isPipelineList(list) {
|
|
26
|
+
let commands = 0;
|
|
27
|
+
for (let i = 0; i < list.length; commands++) {
|
|
28
|
+
const op = list[i];
|
|
29
|
+
if (op !== OP_CREATE_RENDER_PIPELINE && op !== OP_CREATE_COMPUTE_PIPELINE)
|
|
30
|
+
return false;
|
|
31
|
+
const end = i + 1 + operandsAfterId(op);
|
|
32
|
+
if (end > list.length || commands >= PIPELINE_LIST_LIMIT)
|
|
33
|
+
return false;
|
|
34
|
+
for (let k = i + 1; k < end; k++) {
|
|
35
|
+
const word = list[k];
|
|
36
|
+
if (!Number.isInteger(word) || word < 0 || word > 0xffffffff)
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
i = end;
|
|
40
|
+
}
|
|
41
|
+
return list.length > 0;
|
|
42
|
+
}
|
|
43
|
+
/** The stored pipeline list of one sketch, for one start of it. */
|
|
44
|
+
export class PipelineStore {
|
|
45
|
+
conditions;
|
|
46
|
+
storage;
|
|
47
|
+
key;
|
|
48
|
+
/**
|
|
49
|
+
* `conditions` are the start's, as `pipelineConditions` gives them. `storage` stands in for the
|
|
50
|
+
* page's localStorage in tests.
|
|
51
|
+
*/
|
|
52
|
+
constructor(sketchUrl, conditions, storage = pageStorage()) {
|
|
53
|
+
this.conditions = conditions;
|
|
54
|
+
this.storage = storage;
|
|
55
|
+
this.key = KEY_PREFIX + sketchUrl;
|
|
56
|
+
}
|
|
57
|
+
/** The stored list that applies to this start, or undefined. */
|
|
58
|
+
read() {
|
|
59
|
+
try {
|
|
60
|
+
const text = this.storage?.getItem(this.key);
|
|
61
|
+
if (!text)
|
|
62
|
+
return undefined;
|
|
63
|
+
const stored = JSON.parse(text);
|
|
64
|
+
if (stored?.conditions !== this.conditions || !Array.isArray(stored.list))
|
|
65
|
+
return undefined;
|
|
66
|
+
return isPipelineList(stored.list) ? Uint32Array.from(stored.list) : undefined;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Stores the list of the pipelines that this start's first frame built. */
|
|
73
|
+
save(list) {
|
|
74
|
+
if (!isPipelineList(Array.from(list)))
|
|
75
|
+
return;
|
|
76
|
+
const stored = { conditions: this.conditions, list: Array.from(list) };
|
|
77
|
+
try {
|
|
78
|
+
this.storage?.setItem(this.key, JSON.stringify(stored));
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// The next start builds each pipeline when its first frame asks for it.
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -37,7 +37,10 @@ export declare class StartMarker {
|
|
|
37
37
|
* and removes it when the page leaves.
|
|
38
38
|
*/
|
|
39
39
|
begin(history: StartHistory, tier: Tier): void;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Removes the note once the engine has drawn for `playMs` after `firstFrame`. A first frame that
|
|
42
|
+
* never comes leaves the note to the stop, which removes it.
|
|
43
|
+
*/
|
|
41
44
|
endAfter(firstFrame: Promise<void>, playMs?: number): void;
|
|
42
45
|
/** Removes the note, if this page load wrote it. Later calls do nothing. */
|
|
43
46
|
end(): void;
|
package/lib/page/start-marker.js
CHANGED
|
@@ -90,12 +90,15 @@ export class StartMarker {
|
|
|
90
90
|
}
|
|
91
91
|
globalThis.addEventListener?.('pagehide', this.onPageHide);
|
|
92
92
|
}
|
|
93
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Removes the note once the engine has drawn for `playMs` after `firstFrame`. A first frame that
|
|
95
|
+
* never comes leaves the note to the stop, which removes it.
|
|
96
|
+
*/
|
|
94
97
|
endAfter(firstFrame, playMs = STABLE_PLAY_MS) {
|
|
95
98
|
void firstFrame.then(() => {
|
|
96
99
|
if (!this.ended)
|
|
97
100
|
this.timer = setTimeout(() => this.end(), playMs);
|
|
98
|
-
});
|
|
101
|
+
}, () => { });
|
|
99
102
|
}
|
|
100
103
|
/** Removes the note, if this page load wrote it. Later calls do nothing. */
|
|
101
104
|
end() {
|
package/lib/page/stats-switch.js
CHANGED
|
@@ -27,6 +27,8 @@ export class StatsSwitch {
|
|
|
27
27
|
if (show !== true) {
|
|
28
28
|
if (show.collapsed !== undefined)
|
|
29
29
|
this.options.collapsed = show.collapsed;
|
|
30
|
+
if (show.corner !== undefined)
|
|
31
|
+
this.options.corner = show.corner;
|
|
30
32
|
this.overlay?.configure(show);
|
|
31
33
|
}
|
|
32
34
|
this.load ??= import('../debug/overlay.js');
|
package/lib/page/switches.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StatsRequest } from '../debug/stats-options.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type PresetCheckTiming, type TargetFps } from '../quality/check.js';
|
|
3
3
|
import { type QualityPreset } from '../quality/presets.js';
|
|
4
4
|
export type GpuSwitch = 'auto' | 'webgpu' | 'compat' | 'webgl2';
|
|
5
5
|
/**
|
|
@@ -34,17 +34,25 @@ export type LatencyMode = 'pipelined' | 'low';
|
|
|
34
34
|
export type SketchThread = 'worker' | 'main';
|
|
35
35
|
/**
|
|
36
36
|
* How the GPU path stores depth. In `reversed` depth, the near plane stores 1 and the far plane 0,
|
|
37
|
-
* in a 32-bit float depth buffer. That keeps depth precise far from the camera.
|
|
38
|
-
*
|
|
37
|
+
* in a 32-bit float depth buffer. That keeps depth precise far from the camera.
|
|
38
|
+
*
|
|
39
|
+
* WebGPU always draws it. WebGL2 draws it where the browser has the `EXT_clip_control` extension, which gives
|
|
39
40
|
* WebGL2 the depth range from 0 to 1 that WebGPU has. The `reversed-gl` mode keeps the same
|
|
40
41
|
* order, but in WebGL2's own depth range from -1 to 1, which loses most of the precision. In
|
|
41
|
-
* `standard` depth, the near plane stores 0
|
|
42
|
+
* `standard` depth, the near plane stores 0 and the far plane 1.
|
|
42
43
|
*
|
|
43
44
|
* @category api/engine
|
|
44
45
|
*/
|
|
45
46
|
export type DepthMode = 'reversed' | 'reversed-gl' | 'standard';
|
|
46
47
|
/** A format of the HDR scene color that the ?scene-format= switch names. */
|
|
47
48
|
export type SceneFormat = 'rg11b10' | 'rgba16f';
|
|
49
|
+
/**
|
|
50
|
+
* The quality tier that ?tier= names: `lowest` starts the page in the tier below the four presets,
|
|
51
|
+
* with its start values; `off` keeps the governor out of the tier, so a test measures the presets
|
|
52
|
+
* alone. Without the switch the governor enters the tier only when frames still miss at the
|
|
53
|
+
* preset's floor (D-382).
|
|
54
|
+
*/
|
|
55
|
+
export type LowestTier = 'lowest' | 'off';
|
|
48
56
|
/** The bits per texel of the shadow cascades' depth. */
|
|
49
57
|
export type ShadowDepthBits = 16 | 32;
|
|
50
58
|
/**
|
|
@@ -108,6 +116,11 @@ export interface Switches {
|
|
|
108
116
|
* of taking the preset check's stored result from an earlier start.
|
|
109
117
|
*/
|
|
110
118
|
freshCheck: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* True when ?builds=fresh makes the first frame start every pipeline build itself, as on a first
|
|
121
|
+
* visit, instead of building the stored list of an earlier start's first frame ahead of it.
|
|
122
|
+
*/
|
|
123
|
+
freshBuilds: boolean;
|
|
111
124
|
/**
|
|
112
125
|
* True when ?two-step=report makes a development page log the two-step pass's answers once the
|
|
113
126
|
* first frame is on screen: whether the frame wanted the pass, declared it, had its second step
|
|
@@ -231,6 +244,12 @@ export interface Switches {
|
|
|
231
244
|
* the page's `targetFps` option, or undefined without the switch or with another value.
|
|
232
245
|
*/
|
|
233
246
|
targetFps: TargetFps | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* When the preset check measures, from ?preset-check=: `during-play` or `before-play`, which
|
|
249
|
+
* wins over the page's `presetCheck` option, or undefined without the switch or with another
|
|
250
|
+
* value.
|
|
251
|
+
*/
|
|
252
|
+
presetCheck: PresetCheckTiming | undefined;
|
|
234
253
|
/**
|
|
235
254
|
* The most job workers that ?jobs= lets the engine start, or undefined for the count from the
|
|
236
255
|
* device's cores. The engine starts them as the work grows, and no more than the device has
|
|
@@ -253,6 +272,13 @@ export interface Switches {
|
|
|
253
272
|
* crash marker, or undefined without the switch or with a name that is no preset.
|
|
254
273
|
*/
|
|
255
274
|
preset: QualityPreset | undefined;
|
|
275
|
+
/**
|
|
276
|
+
* `'lowest'` when ?tier=lowest starts the page in the lowest quality tier: the render scale at
|
|
277
|
+
* a third, the sun's shadows and bloom off, and WebGL2's depth prepass off. The tier exists for
|
|
278
|
+
* tests, devices and a known weak class, while the governor is the default path to it. Undefined
|
|
279
|
+
* for any other name, or without the switch.
|
|
280
|
+
*/
|
|
281
|
+
lowestTier: LowestTier | undefined;
|
|
256
282
|
/**
|
|
257
283
|
* The text of ?hold=, an empty text for a bare ?hold, or undefined without the switch. The
|
|
258
284
|
* engine checks it when it starts, so a bad time fails at once instead of starting a live engine.
|
|
@@ -274,6 +300,11 @@ export interface Switches {
|
|
|
274
300
|
still: boolean;
|
|
275
301
|
/** True when ?bench asks the engine to publish itself on the page for a benchmark tool. */
|
|
276
302
|
bench: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* True when ?inspect opens the development build's in-page inspector, which lists the scene,
|
|
305
|
+
* selects an object and edits its transform, material and visibility.
|
|
306
|
+
*/
|
|
307
|
+
inspect: boolean;
|
|
277
308
|
/**
|
|
278
309
|
* The debug view that ?view= asks for, by the name that `debug.view` takes: one of the engine's
|
|
279
310
|
* own views, or a view that an add-on's feature registers. Undefined without the switch.
|
|
@@ -281,8 +312,9 @@ export interface Switches {
|
|
|
281
312
|
view: string | undefined;
|
|
282
313
|
/**
|
|
283
314
|
* True when a bare ?stats or ?stats=on shows the stats overlay, false when ?stats=off hides it,
|
|
284
|
-
*
|
|
285
|
-
*
|
|
315
|
+
* and undefined without the switch. Options when the switch names a start state, `collapsed` or
|
|
316
|
+
* `open`, a corner, `top-right` or `bottom-right`, or one of each with a comma between, such as
|
|
317
|
+
* ?stats=collapsed,bottom-right. It wins over the page's option.
|
|
286
318
|
*/
|
|
287
319
|
stats: StatsRequest | undefined;
|
|
288
320
|
/**
|
package/lib/page/switches.js
CHANGED
|
@@ -17,12 +17,16 @@
|
|
|
17
17
|
// in a pass each, none joined, for pages that measure what joining saves. ?replay-delay= makes the
|
|
18
18
|
// thread that draws wait before it replays each frame's list, for a test of memory that the sketch
|
|
19
19
|
// thread frees while the list may still point at it. ?hold starts hold mode for image tests, ?preset= fixes the quality preset,
|
|
20
|
-
// ?target-fps= sets the frame rate that the
|
|
20
|
+
// ?tier=lowest starts in the lowest quality tier, ?target-fps= sets the frame rate that the
|
|
21
|
+
// engine defends, ?preset-check= says whether the preset check measures during play or before it,
|
|
22
|
+
// ?bench publishes the running engine
|
|
21
23
|
// for benchmark tools, ?gl-timing times each WebGL call for benchmark pages, ?stats shows the
|
|
22
24
|
// stats overlay, and ?view picks a debug view, one of the engine's own or one that an add-on's
|
|
23
25
|
// feature registers.
|
|
26
|
+
import { PRESET_CHECK_TIMINGS } from '../quality/check.js';
|
|
24
27
|
import { QUALITY_PRESETS, QUALITY_SETTINGS } from '../quality/presets.js';
|
|
25
28
|
const SCENE_FORMATS = ['rg11b10', 'rgba16f'];
|
|
29
|
+
const LOWEST_TIERS = ['lowest', 'off'];
|
|
26
30
|
const COMPRESSION_FAMILIES = ['astc', 'bc', 'etc2'];
|
|
27
31
|
/** The longest wait that ?replay-delay= gives, in ms: longer would stall the frames for good. */
|
|
28
32
|
const MAX_REPLAY_DELAY_MS = 1000;
|
|
@@ -51,11 +55,27 @@ function oneOf(value, allowed) {
|
|
|
51
55
|
function onOff(value) {
|
|
52
56
|
return value === 'on' ? true : value === 'off' ? false : undefined;
|
|
53
57
|
}
|
|
54
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* ?stats: on for a bare switch or `on`, off for `off`, or options from a comma-separated list of a
|
|
60
|
+
* start state, `collapsed` or `open`, and a corner, `top-right` or `bottom-right`. A word that none
|
|
61
|
+
* of these is leaves the switch out.
|
|
62
|
+
*/
|
|
55
63
|
function statsSwitch(value) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
if (value === '')
|
|
65
|
+
return true;
|
|
66
|
+
const on = onOff(value);
|
|
67
|
+
if (on !== undefined || value === null)
|
|
68
|
+
return on;
|
|
69
|
+
const options = {};
|
|
70
|
+
for (const word of value.split(',')) {
|
|
71
|
+
if (word === 'collapsed' || word === 'open')
|
|
72
|
+
options.collapsed = word === 'collapsed';
|
|
73
|
+
else if (word === 'top-right' || word === 'bottom-right')
|
|
74
|
+
options.corner = word;
|
|
75
|
+
else
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
return options;
|
|
59
79
|
}
|
|
60
80
|
/** A number above 0, or undefined for a missing or unusable value. */
|
|
61
81
|
function positive(value) {
|
|
@@ -97,6 +117,7 @@ export function parseSwitches(search) {
|
|
|
97
117
|
parallelCompile: params.get('compile') !== 'wait',
|
|
98
118
|
freshShaders: params.get('shaders') === 'fresh',
|
|
99
119
|
freshCheck: params.get('check') === 'fresh',
|
|
120
|
+
freshBuilds: params.get('builds') === 'fresh',
|
|
100
121
|
wakeByMessage: params.get('wake') === 'message',
|
|
101
122
|
twoStep: params.get('two-step') === 'report',
|
|
102
123
|
displayChecks: params.get('display-check') !== 'off',
|
|
@@ -119,15 +140,18 @@ export function parseSwitches(search) {
|
|
|
119
140
|
derivedCache: params.get('derived-cache') !== 'off',
|
|
120
141
|
fps: positive(params.get('fps')),
|
|
121
142
|
targetFps: params.get('target-fps') === 'display' ? 'display' : whole(params.get('target-fps')),
|
|
143
|
+
presetCheck: oneOf(params.get('preset-check'), PRESET_CHECK_TIMINGS),
|
|
122
144
|
jobs: whole(params.get('jobs'), MAX_JOB_WORKERS),
|
|
123
145
|
queue: params.get('queue') === 'off' ? Number.POSITIVE_INFINITY : whole(params.get('queue')),
|
|
124
146
|
memoryMiB: within(whole(params.get('memory')), MEMORY_MIB.min, MEMORY_MIB.max),
|
|
125
147
|
preset: oneOf(params.get('preset'), QUALITY_PRESETS),
|
|
148
|
+
lowestTier: oneOf(params.get('tier'), LOWEST_TIERS),
|
|
126
149
|
hold: params.get('hold') ?? undefined,
|
|
127
150
|
replay: params.get('replay') ?? undefined,
|
|
128
151
|
record: params.has('record'),
|
|
129
152
|
still: params.get('still-camera') !== 'off',
|
|
130
153
|
bench: params.has('bench'),
|
|
154
|
+
inspect: params.has('inspect'),
|
|
131
155
|
view: params.get('view') || undefined,
|
|
132
156
|
stats: statsSwitch(params.get('stats')),
|
|
133
157
|
permutations: params.get('permutations') === 'record' ? 'record' : undefined,
|