@egret/engine 7.0.1-rc.3 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Engine.js +7 -2
- package/dist/animation/sequenceResetTypes.d.ts +6 -0
- package/dist/animation/types.d.ts +6 -0
- package/dist/assetBundle.d.ts +2 -0
- package/dist/assetGroupTypes.d.ts +2 -0
- package/dist/audioCues.d.ts +4 -0
- package/dist/audioTypes.d.ts +13 -0
- package/dist/bitmapButtonTypes.d.ts +2 -0
- package/dist/bitmapFontTypes.d.ts +3 -0
- package/dist/bitmapResourceSlot.d.ts +1 -0
- package/dist/camera2d.js +10 -2
- package/dist/cameraTypes.d.ts +12 -0
- package/dist/contentTypes.d.ts +2 -0
- package/dist/createEngineForProfile.js +8 -5
- package/dist/fontContentTypes.d.ts +5 -0
- package/dist/gameClockTypes.d.ts +6 -0
- package/dist/gameRun.d.ts +3 -0
- package/dist/gamepadTypes.d.ts +8 -0
- package/dist/hoverInputTypes.d.ts +10 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2 -1
- package/dist/inputActions.d.ts +5 -0
- package/dist/internal/uiFactoryState.d.ts +4 -0
- package/dist/internal/uiFactoryState.js +18 -2
- package/dist/keyboardInput.d.ts +1 -0
- package/dist/keyboardInput.js +1 -0
- package/dist/keyboardInputTypes.d.ts +12 -0
- package/dist/kit.d.ts +3 -1
- package/dist/kit.js +2 -1
- package/dist/manifestResourceState.d.ts +1 -0
- package/dist/manifestResourceState.js +1 -0
- package/dist/manifestResourceTypes.d.ts +1 -0
- package/dist/motion.d.ts +2 -0
- package/dist/mouseInputTypes.d.ts +4 -0
- package/dist/particleEmitter.js +8 -0
- package/dist/particleTypes.d.ts +8 -0
- package/dist/physics2d.d.ts +2 -2
- package/dist/physics2d.js +1 -1
- package/dist/physics2dTypes.d.ts +55 -1
- package/dist/physics2dWorld.js +209 -9
- package/dist/pointerInput.d.ts +1 -0
- package/dist/pointerInput.js +1 -0
- package/dist/pointerInputTypes.d.ts +3 -0
- package/dist/random.d.ts +1 -0
- package/dist/rendering/packSharedDraws2D.js +53 -5
- package/dist/rendering/prepareSharedDraws2D.d.ts +2 -0
- package/dist/rendering/prepareSharedDraws2D.js +17 -6
- package/dist/rendering/sharedColor2D.d.ts +35 -1
- package/dist/rendering/sharedColor2D.js +131 -8
- package/dist/rendering/sharedEffects2D.js +16 -8
- package/dist/rendering/world3d/Animation3D.d.ts +9 -0
- package/dist/rendering/world3d/Animation3D.js +4 -0
- package/dist/rendering/world3d/AnimationTexture3D.d.ts +6 -0
- package/dist/rendering/world3d/AnimationTexture3D.js +2 -0
- package/dist/rendering/world3d/Batch3D.d.ts +4 -0
- package/dist/rendering/world3d/Batch3D.js +3 -0
- package/dist/rendering/world3d/Camera3D.d.ts +5 -0
- package/dist/rendering/world3d/Camera3D.js +3 -0
- package/dist/rendering/world3d/Character3D.d.ts +4 -0
- package/dist/rendering/world3d/Character3D.js +2 -0
- package/dist/rendering/world3d/Cloth3D.d.ts +18 -3
- package/dist/rendering/world3d/Cloth3D.js +6 -1
- package/dist/rendering/world3d/Compression3D.d.ts +1 -0
- package/dist/rendering/world3d/Compression3D.js +1 -0
- package/dist/rendering/world3d/Curves3D.d.ts +8 -0
- package/dist/rendering/world3d/Curves3D.js +5 -0
- package/dist/rendering/world3d/Decal3D.d.ts +2 -0
- package/dist/rendering/world3d/Decal3D.js +1 -0
- package/dist/rendering/world3d/Export3D.d.ts +13 -0
- package/dist/rendering/world3d/Export3D.js +263 -0
- package/dist/rendering/world3d/Geometry3D.d.ts +11 -1
- package/dist/rendering/world3d/Geometry3D.js +10 -1
- package/dist/rendering/world3d/GeometryBuilder3D.d.ts +2 -0
- package/dist/rendering/world3d/Gizmo3D.d.ts +5 -0
- package/dist/rendering/world3d/Gizmo3D.js +2 -0
- package/dist/rendering/world3d/Gltf3D.d.ts +6 -0
- package/dist/rendering/world3d/Gltf3D.js +25 -5
- package/dist/rendering/world3d/GpuParticles3D.d.ts +2 -0
- package/dist/rendering/world3d/GpuParticles3D.js +1 -0
- package/dist/rendering/world3d/Hdr3D.d.ts +2 -0
- package/dist/rendering/world3d/Hdr3D.js +1 -0
- package/dist/rendering/world3d/Jelly3D.d.ts +2 -0
- package/dist/rendering/world3d/Jelly3D.js +1 -0
- package/dist/rendering/world3d/Ktx23D.d.ts +3 -0
- package/dist/rendering/world3d/Light3D.d.ts +9 -0
- package/dist/rendering/world3d/Light3D.js +4 -0
- package/dist/rendering/world3d/Material3D.d.ts +10 -0
- package/dist/rendering/world3d/Material3D.js +2 -0
- package/dist/rendering/world3d/Mesh3D.d.ts +4 -0
- package/dist/rendering/world3d/Mesh3D.js +16 -2
- package/dist/rendering/world3d/Meshopt3D.d.ts +3 -0
- package/dist/rendering/world3d/Meshopt3D.js +1 -0
- package/dist/rendering/world3d/Navigation3D.d.ts +41 -1
- package/dist/rendering/world3d/Navigation3D.js +74 -2
- package/dist/rendering/world3d/Object3D.d.ts +11 -0
- package/dist/rendering/world3d/Object3D.js +10 -0
- package/dist/rendering/world3d/Particles3D.d.ts +5 -0
- package/dist/rendering/world3d/Particles3D.js +3 -0
- package/dist/rendering/world3d/Physics3D.d.ts +14 -0
- package/dist/rendering/world3d/Physics3D.js +5 -0
- package/dist/rendering/world3d/PhysicsHull3D.d.ts +2 -0
- package/dist/rendering/world3d/PhysicsHull3D.js +2 -0
- package/dist/rendering/world3d/PhysicsMesh3D.d.ts +2 -0
- package/dist/rendering/world3d/PhysicsMesh3D.js +2 -0
- package/dist/rendering/world3d/PhysicsRemote3D.d.ts +5 -0
- package/dist/rendering/world3d/PhysicsRemote3D.js +2 -0
- package/dist/rendering/world3d/Ragdoll3D.d.ts +5 -0
- package/dist/rendering/world3d/Ragdoll3D.js +2 -0
- package/dist/rendering/world3d/Raycast3D.d.ts +3 -0
- package/dist/rendering/world3d/Raycast3D.js +1 -0
- package/dist/rendering/world3d/RenderList3D.d.ts +3 -0
- package/dist/rendering/world3d/RenderList3D.js +12 -0
- package/dist/rendering/world3d/Retarget3D.d.ts +1 -0
- package/dist/rendering/world3d/Rig3D.d.ts +57 -0
- package/dist/rendering/world3d/Rig3D.js +219 -0
- package/dist/rendering/world3d/Sdf3D.d.ts +181 -0
- package/dist/rendering/world3d/Sdf3D.js +1136 -0
- package/dist/rendering/world3d/SdfLod3D.d.ts +17 -0
- package/dist/rendering/world3d/SdfLod3D.js +56 -0
- package/dist/rendering/world3d/Serialize3D.d.ts +17 -0
- package/dist/rendering/world3d/Serialize3D.js +22 -0
- package/dist/rendering/world3d/Simplify3D.d.ts +29 -0
- package/dist/rendering/world3d/Simplify3D.js +426 -0
- package/dist/rendering/world3d/StateMachine3D.d.ts +9 -0
- package/dist/rendering/world3d/StateMachine3D.js +3 -0
- package/dist/rendering/world3d/SurfaceMaterial3D.d.ts +26 -0
- package/dist/rendering/world3d/SurfaceMaterial3D.js +138 -0
- package/dist/rendering/world3d/Terrain3D.d.ts +21 -0
- package/dist/rendering/world3d/Terrain3D.js +25 -1
- package/dist/rendering/world3d/Text3D.d.ts +5 -0
- package/dist/rendering/world3d/Text3D.js +2 -0
- package/dist/rendering/world3d/Texture3D.d.ts +16 -1
- package/dist/rendering/world3d/Texture3D.js +19 -1
- package/dist/rendering/world3d/Trail3D.d.ts +3 -0
- package/dist/rendering/world3d/Trail3D.js +2 -0
- package/dist/rendering/world3d/Vehicle3D.d.ts +5 -0
- package/dist/rendering/world3d/Vehicle3D.js +2 -0
- package/dist/rendering/world3d/VolumetricFog3D.d.ts +2 -0
- package/dist/rendering/world3d/VolumetricFog3D.js +1 -0
- package/dist/rendering/world3d/Water3D.d.ts +2 -0
- package/dist/rendering/world3d/Water3D.js +1 -0
- package/dist/rendering/world3d/core3D.d.ts +2 -0
- package/dist/rendering/world3d/debug3D.d.ts +5 -0
- package/dist/rendering/world3d/debug3D.js +5 -0
- package/dist/rendering/world3d/geometries3D.d.ts +12 -0
- package/dist/rendering/world3d/geometries3D.js +5 -0
- package/dist/rendering/world3d/helpers3D.d.ts +2 -0
- package/dist/rendering/world3d/helpers3D.js +1 -0
- package/dist/rendering/world3d/index.d.ts +12 -0
- package/dist/rendering/world3d/index.js +6 -0
- package/dist/rendering/world3d/math3D.d.ts +36 -0
- package/dist/rendering/world3d/math3D.js +35 -0
- package/dist/rendering/world3d/primitives3D.d.ts +7 -0
- package/dist/rendering/world3d/primitives3D.js +1 -0
- package/dist/saveStore.d.ts +18 -3
- package/dist/saveStore.js +23 -4
- package/dist/semanticList.d.ts +4 -0
- package/dist/semanticList.js +1 -0
- package/dist/semanticTree.js +11 -4
- package/dist/semanticTypes.d.ts +8 -0
- package/dist/sequencePlaybackTypes.d.ts +3 -0
- package/dist/text.d.ts +1 -0
- package/dist/textTable.d.ts +41 -0
- package/dist/textTable.js +114 -0
- package/dist/tilemapTypes.d.ts +13 -0
- package/dist/timer.d.ts +34 -0
- package/dist/timer.js +119 -0
- package/dist/tweenTypes.d.ts +4 -0
- package/dist/ui/controlKeys.d.ts +4 -0
- package/dist/ui/controlKeys.js +1 -0
- package/dist/ui/controls.d.ts +6 -0
- package/dist/ui/controls.js +2 -0
- package/dist/ui/layerTypes.d.ts +7 -0
- package/dist/ui/rangeControl.d.ts +3 -0
- package/dist/ui/rangeControl.js +1 -0
- package/dist/ui/scrollControl.d.ts +12 -0
- package/dist/ui/scrollControl.js +5 -1
- package/dist/ui/stateControls.d.ts +8 -0
- package/dist/ui/stateControls.js +3 -0
- package/dist/ui/textEditor.d.ts +1 -0
- package/dist/ui/textEditor.js +1 -0
- package/dist/ui/textEditorTypes.d.ts +7 -0
- package/dist/ui/textFieldControl.d.ts +4 -0
- package/dist/ui/textFieldControl.js +1 -0
- package/dist/ui/theme.d.ts +5 -0
- package/dist/ui/theme.js +1 -0
- package/dist/ui/types.d.ts +20 -0
- package/dist/ui/uiRoot.js +38 -9
- package/dist/ui/uiRootModel.d.ts +3 -1
- package/dist/ui/uiRootModel.js +8 -2
- package/dist/videoTypes.d.ts +3 -0
- package/dist/web/BrowserAssetBundle.d.ts +2 -0
- package/dist/web/BrowserAudio.d.ts +34 -1
- package/dist/web/BrowserAudio.js +69 -39
- package/dist/web/BrowserFrameLoop.d.ts +4 -0
- package/dist/web/BrowserGame.d.ts +64 -2
- package/dist/web/BrowserGame.js +129 -8
- package/dist/web/BrowserGamepadInput.d.ts +3 -0
- package/dist/web/BrowserHoverInput.d.ts +1 -0
- package/dist/web/BrowserImageTextures.d.ts +6 -0
- package/dist/web/BrowserInputActions.d.ts +10 -0
- package/dist/web/BrowserInputActions.js +4 -1
- package/dist/web/BrowserPlay.d.ts +130 -2
- package/dist/web/BrowserPlay.js +366 -19
- package/dist/web/BrowserPreferences.d.ts +10 -0
- package/dist/web/BrowserPreferences.js +39 -0
- package/dist/web/BrowserSemantics.d.ts +2 -0
- package/dist/web/BrowserStatsPanel.d.ts +10 -0
- package/dist/web/BrowserStatsPanel.js +9 -3
- package/dist/web/BrowserStorage.d.ts +2 -0
- package/dist/web/BrowserTextEditor.d.ts +3 -0
- package/dist/web/BrowserTextInput.d.ts +6 -0
- package/dist/web/BrowserTextureProvider.d.ts +6 -0
- package/dist/web/BrowserVideo.d.ts +13 -1
- package/dist/web/BrowserVideo.js +28 -2
- package/dist/web/CanvasKitFontSetProvider.d.ts +3 -0
- package/dist/web/CanvasKitParagraphProvider.d.ts +4 -0
- package/dist/web/CanvasKitParagraphProvider.js +1 -0
- package/dist/web/ManifestByteSource.d.ts +4 -0
- package/dist/web/ManifestByteSource.js +1 -0
- package/dist/web/ManifestFontContentLoader.d.ts +1 -0
- package/dist/web/WebGL2Host.js +64 -25
- package/dist/web/WebGPUHost.d.ts +13 -0
- package/dist/web/WebGPUHost.js +117 -36
- package/dist/web/audio.d.ts +2 -2
- package/dist/web/audio.js +1 -1
- package/dist/web/editorFonts.d.ts +4 -0
- package/dist/web/game.d.ts +1 -1
- package/dist/web/imageProjections2D.d.ts +2 -0
- package/dist/web/kit.d.ts +1 -0
- package/dist/web/kit.js +1 -0
- package/dist/web/play.d.ts +6 -1
- package/dist/web/play.js +4 -1
- package/dist/web/playMusic.d.ts +33 -0
- package/dist/web/playMusic.js +194 -0
- package/dist/web/playTouch.d.ts +45 -0
- package/dist/web/playTouch.js +141 -0
- package/dist/web/playWidgets.d.ts +71 -0
- package/dist/web/playWidgets.js +431 -0
- package/dist/web/prepareSharedSubmission2D.js +9 -3
- package/dist/web/resources.d.ts +2 -0
- package/dist/web/sharedEffectShaders.d.ts +6 -2
- package/dist/web/sharedEffectShaders.js +23 -7
- package/dist/web/sharedSubmissionStorage2D.js +1 -1
- package/dist/web/sharedWebGL2Options.d.ts +3 -0
- package/dist/web/sharedWebGL2Options.js +8 -2
- package/dist/web/sharedWebGL2Shaders.d.ts +15 -2
- package/dist/web/sharedWebGL2Shaders.js +108 -14
- package/dist/web/sharedWebGPUOptions.d.ts +5 -1
- package/dist/web/sharedWebGPUOptions.js +6 -2
- package/dist/web/video.d.ts +1 -1
- package/dist/web/webgl2Native.d.ts +3 -1
- package/dist/web/webgl2Native.js +9 -5
- package/dist/web/webgl2Types.d.ts +18 -0
- package/dist/web/webgpuImageResidency.d.ts +5 -2
- package/dist/web/webgpuImageResidency.js +7 -3
- package/dist/web/webgpuRetentionPool.d.ts +2 -2
- package/dist/web/webgpuRetentionPool.js +2 -1
- package/dist/web/webgpuSharedPass.d.ts +1 -1
- package/dist/web/webgpuSharedPass.js +87 -5
- package/dist/web/webgpuSharedResolvePass.d.ts +1 -1
- package/dist/web/webgpuSharedResolvePass.js +9 -4
- package/dist/web/world3d/Audio3D.d.ts +18 -1
- package/dist/web/world3d/Audio3D.js +62 -3
- package/dist/web/world3d/BrowserPlay3D.d.ts +115 -2
- package/dist/web/world3d/BrowserPlay3D.js +448 -43
- package/dist/web/world3d/FlyControls3D.d.ts +4 -0
- package/dist/web/world3d/FlyControls3D.js +2 -0
- package/dist/web/world3d/FollowControls3D.d.ts +3 -0
- package/dist/web/world3d/FollowControls3D.js +2 -0
- package/dist/web/world3d/OrbitControls3D.d.ts +3 -0
- package/dist/web/world3d/OrbitControls3D.js +2 -0
- package/dist/web/world3d/TransformControls3D.d.ts +5 -2
- package/dist/web/world3d/TransformControls3D.js +7 -4
- package/dist/web/world3d/WebGL2Renderer3D.d.ts +3 -0
- package/dist/web/world3d/WebGL2Renderer3D.js +2 -0
- package/dist/web/world3d/WebGPURenderer3D.d.ts +2 -0
- package/dist/web/world3d/WebGPURenderer3D.js +1 -0
- package/dist/web/world3d/World3DView.d.ts +3 -0
- package/dist/web/world3d/World3DView.js +2 -0
- package/dist/web/world3d/app3D.d.ts +7 -0
- package/dist/web/world3d/app3D.js +1 -0
- package/dist/web/world3d/assets3D.d.ts +1 -0
- package/dist/web/world3d/atmosphere3D.d.ts +9 -0
- package/dist/web/world3d/atmosphere3D.js +19 -4
- package/dist/web/world3d/canvasFont3D.d.ts +21 -0
- package/dist/web/world3d/canvasFont3D.js +165 -0
- package/dist/web/world3d/frame3D.d.ts +2 -0
- package/dist/web/world3d/host3D.d.ts +1 -0
- package/dist/web/world3d/index.d.ts +4 -2
- package/dist/web/world3d/index.js +2 -1
- package/dist/web/world3d/loaders3D.d.ts +1 -0
- package/dist/web/world3d/markers3D.d.ts +4 -0
- package/dist/web/world3d/overlay3D.d.ts +19 -0
- package/dist/web/world3d/overlay3D.js +21 -4
- package/dist/web/world3d/post3D.d.ts +4 -0
- package/dist/web/world3d/post3D.js +3 -0
- package/dist/web/world3d/probe3D.d.ts +1 -0
- package/dist/web/world3d/stats3D.d.ts +3 -0
- package/dist/web/world3d/stats3D.js +1 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +5 -0
- package/dist/web/world3d/webgpu.d.ts +2 -0
- package/dist/web/world3d/webgpu.js +1 -0
- package/package.json +3 -3
package/dist/web/WebGPUHost.js
CHANGED
|
@@ -5,7 +5,7 @@ import { SharedPreparationRetention2D } from '../rendering/sharedPreparationRete
|
|
|
5
5
|
import { planSharedSubmission2D, packSharedSubmission2D, packSharedRegionWindows2D, SHARED_REGION_WINDOW_STRIDE_2D, SHARED_REGION_WINDOW_BYTES_2D, materializeSharedPages2D, checkSharedCapacity2D, SharedStorageError2D } from './prepareSharedSubmission2D.js';
|
|
6
6
|
import { SHARED_BATCH_PAGES_2D } from '../rendering/packSharedDraws2D.js';
|
|
7
7
|
import { prepareSharedBatches2D } from '../rendering/preparedSharedBatches2D.js';
|
|
8
|
-
import {
|
|
8
|
+
import { sharedBlendSpace2D, sharedPageLevelLayout2D, sharedTargetChannel2D } from '../rendering/sharedColor2D.js';
|
|
9
9
|
import { createSharedWebGPUPipeline, SHARED_BLENDS, SHARED_PIPELINE_KINDS } from './webgpuSharedPass.js';
|
|
10
10
|
import { createSharedEffectPipeline, EFFECT_PASSES, EFFECT_UNIFORM_BYTES } from './sharedEffectShaders.js';
|
|
11
11
|
import { createSharedResolvePipeline } from './webgpuSharedResolvePass.js';
|
|
@@ -80,6 +80,7 @@ class WebGPUHostImplementation {
|
|
|
80
80
|
pendingGeometryBytes = 0;
|
|
81
81
|
pendingColorBytes = 0;
|
|
82
82
|
pendingCanonicalBytes = 0;
|
|
83
|
+
frameDrawCalls = 0;
|
|
83
84
|
ledger = new Set();
|
|
84
85
|
batchScratch = new PreparedBatchScratch2D();
|
|
85
86
|
/** The prepared draws of the last frame. A Host that is not active keeps none. */
|
|
@@ -223,8 +224,11 @@ class WebGPUHostImplementation {
|
|
|
223
224
|
throw error('WEBGPU_OPTIONS_INVALID', cause);
|
|
224
225
|
}
|
|
225
226
|
this.borrowedPolicy = this.borrowed !== undefined;
|
|
227
|
+
const admittedSpace = SHARED_OPTIONS.get(this).blendSpace;
|
|
226
228
|
Object.defineProperties(this, {
|
|
227
229
|
sharedFrameProfile: { value: SHARED_FRAME_PROFILE_2D, enumerable: true },
|
|
230
|
+
// The space this Host mixes in; an Engine's frames record it.
|
|
231
|
+
sharedBlendSpace: { value: admittedSpace, enumerable: true },
|
|
228
232
|
renderSharedFrame: {
|
|
229
233
|
value: (frame) => this.renderSharedOwnedFrame(frame),
|
|
230
234
|
enumerable: true
|
|
@@ -245,6 +249,10 @@ class WebGPUHostImplementation {
|
|
|
245
249
|
value: (frame, options) => this.renderSharedOwnedFrame(frame, { options }),
|
|
246
250
|
enumerable: true
|
|
247
251
|
},
|
|
252
|
+
getFrameDrawCalls: {
|
|
253
|
+
value: () => this.frameDrawCalls,
|
|
254
|
+
enumerable: true
|
|
255
|
+
},
|
|
248
256
|
getSharedStatus: {
|
|
249
257
|
value: () => Object.freeze({
|
|
250
258
|
host: this.getStatus(),
|
|
@@ -1071,13 +1079,15 @@ class WebGPUHostImplementation {
|
|
|
1071
1079
|
let synchronous;
|
|
1072
1080
|
try {
|
|
1073
1081
|
this.scoped(null, 'startup', scopes, gate, () => {
|
|
1082
|
+
// A target that mixes stored codes, as a 2D canvas does, is ordinary UNORM; its pipelines write codes.
|
|
1083
|
+
const coded = SHARED_OPTIONS.get(this).blendSpace === 'srgb';
|
|
1074
1084
|
for (const kind of SHARED_PIPELINE_KINDS)
|
|
1075
1085
|
for (const blend of SHARED_BLENDS)
|
|
1076
|
-
createSharedWebGPUPipeline(capturedShader, capturedPipeline, kind, blend);
|
|
1077
|
-
createSharedResolvePipeline(capturedShader, capturedPipeline, this.format, SHARED_OPTIONS.get(this).outputAlpha === 'opaque');
|
|
1086
|
+
createSharedWebGPUPipeline(capturedShader, capturedPipeline, kind, blend, coded);
|
|
1087
|
+
createSharedResolvePipeline(capturedShader, capturedPipeline, this.format, SHARED_OPTIONS.get(this).outputAlpha === 'opaque', coded);
|
|
1078
1088
|
if (SHARED_OPTIONS.get(this).enableEffects)
|
|
1079
1089
|
for (const mode of EFFECT_PASSES)
|
|
1080
|
-
createSharedEffectPipeline(capturedShader, capturedPipeline, mode);
|
|
1090
|
+
createSharedEffectPipeline(capturedShader, capturedPipeline, mode, coded);
|
|
1081
1091
|
for (const filter of ['nearest', 'linear'])
|
|
1082
1092
|
for (const u of ['clamp-to-edge', 'repeat', 'mirror-repeat'])
|
|
1083
1093
|
for (const v of ['clamp-to-edge', 'repeat', 'mirror-repeat']) {
|
|
@@ -1279,7 +1289,7 @@ class WebGPUHostImplementation {
|
|
|
1279
1289
|
size: { width: view.region.width, height: view.region.height, depthOrArrayLayers: 1 },
|
|
1280
1290
|
dimension: '2d',
|
|
1281
1291
|
format: candidate.entry.format,
|
|
1282
|
-
mipLevelCount: 1,
|
|
1292
|
+
mipLevelCount: view.levels ?? 1,
|
|
1283
1293
|
sampleCount: 1,
|
|
1284
1294
|
usage: 2 | 4
|
|
1285
1295
|
});
|
|
@@ -1319,10 +1329,10 @@ class WebGPUHostImplementation {
|
|
|
1319
1329
|
gate();
|
|
1320
1330
|
return { texture, view: result };
|
|
1321
1331
|
}
|
|
1322
|
-
planImageResidency(projectionPlan, draws,
|
|
1332
|
+
planImageResidency(projectionPlan, draws, borrowSubmitted) {
|
|
1323
1333
|
this.active();
|
|
1324
1334
|
const hits = new Map(), candidates = new Map();
|
|
1325
|
-
const bytes = collectWebGPUImageDemand(projectionPlan, draws,
|
|
1335
|
+
const bytes = collectWebGPUImageDemand(projectionPlan, draws, true, this.imageDirectory, this.imageEnabled, this.imageEpoch, hits, candidates, borrowSubmitted);
|
|
1326
1336
|
// Every profile of this Host shares one ready residence; a shared Host may lower its bytes.
|
|
1327
1337
|
const victims = selectWebGPUImageVictims(this.imageOldest, this.imageEpoch, this.allocatedImageBytes + this.reservedImageBytes, this.readyCount, SHARED_OPTIONS.get(this)?.maxReadyPageBytes ?? 33554432, bytes, candidates.size, hits);
|
|
1328
1338
|
return {
|
|
@@ -1410,7 +1420,9 @@ class WebGPUHostImplementation {
|
|
|
1410
1420
|
this.imageDirectory.set(candidate.image, candidate.entry.bucket);
|
|
1411
1421
|
// Pin the complete hit set before touching order or entering any native call.
|
|
1412
1422
|
for (const entry of use.hits.values()) {
|
|
1413
|
-
if (entry.
|
|
1423
|
+
if (entry.validation)
|
|
1424
|
+
(use.producerValidations ??= new Set()).add(entry.validation);
|
|
1425
|
+
if (entry.state === 'ready' && entry.pinCount === 0) {
|
|
1414
1426
|
this.resourcePinnedBytes += entry.bytes;
|
|
1415
1427
|
this.resourcePinnedEntries++;
|
|
1416
1428
|
}
|
|
@@ -1419,6 +1431,8 @@ class WebGPUHostImplementation {
|
|
|
1419
1431
|
this.sampleResourceImages();
|
|
1420
1432
|
use.pinned = true;
|
|
1421
1433
|
for (const entry of use.hits.values()) {
|
|
1434
|
+
if (entry.state !== 'ready')
|
|
1435
|
+
continue;
|
|
1422
1436
|
this.unlinkImageResidency(entry);
|
|
1423
1437
|
this.appendImageResidency(entry);
|
|
1424
1438
|
}
|
|
@@ -1445,20 +1459,25 @@ class WebGPUHostImplementation {
|
|
|
1445
1459
|
}
|
|
1446
1460
|
const candidate = use.candidates.get(viewIndex), projection = record.projectionPlan.views[viewIndex];
|
|
1447
1461
|
const owned = this.ownedTexture(projection, record, gate, candidate);
|
|
1462
|
+
// A page with smaller copies carries each level's bytes after the one before it.
|
|
1463
|
+
const chain = record.projections[viewIndex], levels = sharedPageLevelLayout2D(projection.region.width, projection.region.height, projection.levels ?? 1);
|
|
1448
1464
|
if (record.stage) {
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1465
|
+
for (const [mipLevel, { width, height, offset }] of levels.entries())
|
|
1466
|
+
record.stage.writes.push({
|
|
1467
|
+
kind: 'texture',
|
|
1468
|
+
texture: owned.texture,
|
|
1469
|
+
data: chain.subarray(offset, offset + 4 * width * height),
|
|
1470
|
+
width,
|
|
1471
|
+
height,
|
|
1472
|
+
offset: 0,
|
|
1473
|
+
mipLevel
|
|
1474
|
+
});
|
|
1457
1475
|
return owned;
|
|
1458
1476
|
}
|
|
1459
1477
|
// Attempted queue writes retain the original fence obligation, including throws.
|
|
1460
1478
|
use.touchedQueue = true;
|
|
1461
|
-
|
|
1479
|
+
for (const [mipLevel, { width, height, offset }] of levels.entries())
|
|
1480
|
+
(record.owner?.native.writeTexture ?? this.writeTexture)({ texture: owned.texture, mipLevel, origin: { x: 0, y: 0, z: 0 }, aspect: 'all' }, chain.subarray(offset, offset + 4 * width * height), { offset: 0, bytesPerRow: 4 * width, rowsPerImage: height }, { width, height, depthOrArrayLayers: 1 });
|
|
1462
1481
|
if (record.shared)
|
|
1463
1482
|
this.resourcePageWrite(record.projections[viewIndex].byteLength);
|
|
1464
1483
|
gate();
|
|
@@ -1491,6 +1510,11 @@ class WebGPUHostImplementation {
|
|
|
1491
1510
|
if (!use || use.finished)
|
|
1492
1511
|
return;
|
|
1493
1512
|
use.finished = true;
|
|
1513
|
+
const failed = (cause) => {
|
|
1514
|
+
const failure = this.fail('WEBGPU_RENDER_FAILED', cause, 'cleanup', record.serial, true);
|
|
1515
|
+
record.unsafe = true;
|
|
1516
|
+
record.failure ??= failure;
|
|
1517
|
+
};
|
|
1494
1518
|
if (use.pinned) {
|
|
1495
1519
|
use.pinned = false;
|
|
1496
1520
|
for (const entry of use.hits.values()) {
|
|
@@ -1499,24 +1523,33 @@ class WebGPUHostImplementation {
|
|
|
1499
1523
|
this.resourcePinnedEntries--;
|
|
1500
1524
|
}
|
|
1501
1525
|
entry.pinCount--;
|
|
1526
|
+
if (entry.state === 'detached' && entry.pinCount === 0) {
|
|
1527
|
+
try {
|
|
1528
|
+
this.destroyReadyImage(entry);
|
|
1529
|
+
}
|
|
1530
|
+
catch (cause) {
|
|
1531
|
+
failed(cause);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1502
1534
|
}
|
|
1503
1535
|
this.sampleResourceImages();
|
|
1504
1536
|
}
|
|
1505
|
-
const failed = (cause) => {
|
|
1506
|
-
const failure = this.fail('WEBGPU_RENDER_FAILED', cause, 'cleanup', record.serial, true);
|
|
1507
|
-
record.unsafe = true;
|
|
1508
|
-
record.failure ??= failure;
|
|
1509
|
-
};
|
|
1510
1537
|
for (const candidate of use.candidates.values()) {
|
|
1511
1538
|
const entry = candidate.entry, resource = entry.resource;
|
|
1512
1539
|
if (!resource || candidate.transferred)
|
|
1513
1540
|
continue;
|
|
1541
|
+
if (entry.state === 'submitted') {
|
|
1542
|
+
entry.bucket.delete(entry.cropKey);
|
|
1543
|
+
delete entry.validation;
|
|
1544
|
+
entry.state = 'cold';
|
|
1545
|
+
}
|
|
1514
1546
|
// Re-read qualification, winner and slot after every earlier cleanup callback.
|
|
1515
1547
|
if (allowPromotion &&
|
|
1516
1548
|
this.isImagePromotionEligible(record) &&
|
|
1517
1549
|
entry.epoch === this.imageEpoch &&
|
|
1518
1550
|
!entry.bucket.has(entry.cropKey) &&
|
|
1519
|
-
this.readyCount < 256
|
|
1551
|
+
this.readyCount < 256 &&
|
|
1552
|
+
this.resourceReadyBytes + entry.bytes <= (SHARED_OPTIONS.get(this)?.maxReadyPageBytes ?? 33554432)) {
|
|
1520
1553
|
try {
|
|
1521
1554
|
const revision = {};
|
|
1522
1555
|
entry.bucket.set(entry.cropKey, entry);
|
|
@@ -1524,6 +1557,10 @@ class WebGPUHostImplementation {
|
|
|
1524
1557
|
entry.state = 'ready';
|
|
1525
1558
|
this.readyCount++;
|
|
1526
1559
|
this.resourceReadyBytes += entry.bytes;
|
|
1560
|
+
if (entry.pinCount > 0) {
|
|
1561
|
+
this.resourcePinnedBytes += entry.bytes;
|
|
1562
|
+
this.resourcePinnedEntries++;
|
|
1563
|
+
}
|
|
1527
1564
|
this.sampleResourceImages();
|
|
1528
1565
|
candidate.transferred = true;
|
|
1529
1566
|
record.textures.splice(record.textures.indexOf(resource), 1);
|
|
@@ -1537,6 +1574,10 @@ class WebGPUHostImplementation {
|
|
|
1537
1574
|
this.unlinkImageResidency(entry);
|
|
1538
1575
|
this.readyCount--;
|
|
1539
1576
|
this.resourceReadyBytes -= entry.bytes;
|
|
1577
|
+
if (entry.pinCount > 0) {
|
|
1578
|
+
this.resourcePinnedBytes -= entry.bytes;
|
|
1579
|
+
this.resourcePinnedEntries--;
|
|
1580
|
+
}
|
|
1540
1581
|
entry.state = 'cold';
|
|
1541
1582
|
this.sampleResourceImages();
|
|
1542
1583
|
}
|
|
@@ -1544,6 +1585,14 @@ class WebGPUHostImplementation {
|
|
|
1544
1585
|
failed(cause);
|
|
1545
1586
|
}
|
|
1546
1587
|
}
|
|
1588
|
+
// A later draw can still be using a page whose producer cannot enter READY (close, loss or capacity).
|
|
1589
|
+
// Transfer cleanup to the Host until that last borrower retires.
|
|
1590
|
+
if (!candidate.transferred && entry.pinCount > 0) {
|
|
1591
|
+
this.imageCleanup.add(entry);
|
|
1592
|
+
entry.state = 'detached';
|
|
1593
|
+
candidate.transferred = true;
|
|
1594
|
+
record.textures.splice(record.textures.indexOf(resource), 1);
|
|
1595
|
+
}
|
|
1547
1596
|
if (!candidate.transferred && !resource.cleaned) {
|
|
1548
1597
|
const failures = cleanupWebGPUTexture(resource);
|
|
1549
1598
|
if (failures.length) {
|
|
@@ -1711,7 +1760,8 @@ class WebGPUHostImplementation {
|
|
|
1711
1760
|
throw cause;
|
|
1712
1761
|
}
|
|
1713
1762
|
}
|
|
1714
|
-
if (frame
|
|
1763
|
+
if (sharedBlendSpace2D(frame) !== options.blendSpace ||
|
|
1764
|
+
frame.outputAlpha !== options.outputAlpha ||
|
|
1715
1765
|
frame.outputRepresentation !==
|
|
1716
1766
|
(options.outputAlpha === 'opaque' ? 'egret.srgb-opaque-unorm8/1' : 'egret.srgb-premultiplied-unorm8/1'))
|
|
1717
1767
|
refuse('WEBGPU_FRAME_PROFILE_UNSUPPORTED');
|
|
@@ -1748,7 +1798,7 @@ class WebGPUHostImplementation {
|
|
|
1748
1798
|
for (const group of prepared.effects.groups)
|
|
1749
1799
|
if (group.maskPageIndex !== undefined)
|
|
1750
1800
|
demands.push({ kind: 'image', packed: { vertexCount: 3 }, viewIndex: group.maskPageIndex });
|
|
1751
|
-
const imagePlan = this.planImageResidency(storage.projectionPlan, demands,
|
|
1801
|
+
const imagePlan = this.planImageResidency(storage.projectionPlan, demands, !staging);
|
|
1752
1802
|
const pages = materializeSharedPages2D(storage, new Set(imagePlan.use.candidates.keys()), this.sharedOwnerSnapshot(), this.resourceCpu);
|
|
1753
1803
|
materialized = pages.canonicalBytes;
|
|
1754
1804
|
this.active();
|
|
@@ -2134,7 +2184,12 @@ class WebGPUHostImplementation {
|
|
|
2134
2184
|
}
|
|
2135
2185
|
else {
|
|
2136
2186
|
const row = write.width * 4, rows = count / row;
|
|
2137
|
-
record.owner.native.writeTexture({
|
|
2187
|
+
record.owner.native.writeTexture({
|
|
2188
|
+
texture: write.texture,
|
|
2189
|
+
mipLevel: write.mipLevel,
|
|
2190
|
+
origin: { x: 0, y: write.offset / row, z: 0 },
|
|
2191
|
+
aspect: 'all'
|
|
2192
|
+
}, write.data, { offset: write.offset, bytesPerRow: row, rowsPerImage: rows }, { width: write.width, height: rows, depthOrArrayLayers: 1 });
|
|
2138
2193
|
this.resourcePageWrite(count);
|
|
2139
2194
|
}
|
|
2140
2195
|
write.offset += count;
|
|
@@ -2383,18 +2438,21 @@ class WebGPUHostImplementation {
|
|
|
2383
2438
|
for (const group of prepared.effects.groups)
|
|
2384
2439
|
buffer('uniform', 72, group.uniform.byteLength);
|
|
2385
2440
|
const colorId = requests.length;
|
|
2441
|
+
// Working targets hold light, encoded by the format on store, or the codes of a space that mixes them.
|
|
2442
|
+
const target = SHARED_OPTIONS.get(this).blendSpace === 'srgb'
|
|
2443
|
+
? { format: 'rgba8unorm', recipe: 'egret.encoded-srgb-pma8-target/1' }
|
|
2444
|
+
: { format: 'rgba8unorm-srgb', recipe: 'egret.srgb-pma8-target/1' };
|
|
2386
2445
|
requests.push({
|
|
2387
2446
|
kind: 'color',
|
|
2388
2447
|
id: colorId,
|
|
2389
2448
|
width,
|
|
2390
2449
|
height,
|
|
2391
|
-
|
|
2450
|
+
...target,
|
|
2392
2451
|
usage: 20,
|
|
2393
2452
|
byteLength: storage.colorBytes,
|
|
2394
2453
|
sampleCount: 1,
|
|
2395
2454
|
mipLevelCount: 1,
|
|
2396
|
-
depthOrArrayLayers: 1
|
|
2397
|
-
recipe: 'egret.srgb-pma8-target/1'
|
|
2455
|
+
depthOrArrayLayers: 1
|
|
2398
2456
|
});
|
|
2399
2457
|
for (let i = 0; i < prepared.effects.targetCount; i++)
|
|
2400
2458
|
requests.push({
|
|
@@ -2402,13 +2460,12 @@ class WebGPUHostImplementation {
|
|
|
2402
2460
|
id: requests.length,
|
|
2403
2461
|
width,
|
|
2404
2462
|
height,
|
|
2405
|
-
|
|
2463
|
+
...target,
|
|
2406
2464
|
usage: 20,
|
|
2407
2465
|
byteLength: storage.colorBytes,
|
|
2408
2466
|
sampleCount: 1,
|
|
2409
2467
|
mipLevelCount: 1,
|
|
2410
|
-
depthOrArrayLayers: 1
|
|
2411
|
-
recipe: 'egret.srgb-pma8-target/1'
|
|
2468
|
+
depthOrArrayLayers: 1
|
|
2412
2469
|
});
|
|
2413
2470
|
const bufferPlan = this.bufferPool.plan(requests), bufferLeases = new Array(requests.length).fill(undefined);
|
|
2414
2471
|
for (const lease of bufferPlan.leases)
|
|
@@ -2686,6 +2743,7 @@ class WebGPUHostImplementation {
|
|
|
2686
2743
|
return { vertices, bindings, regionBindings, color, resolveBinding, effectTargets, effects };
|
|
2687
2744
|
}
|
|
2688
2745
|
drawSharedGPU(record, p, recipe, staging, ticket, gate) {
|
|
2746
|
+
this.frameDrawCalls = 0;
|
|
2689
2747
|
const { storage, batch } = p, { frame, width, height } = storage.prepared, serial = record.serial;
|
|
2690
2748
|
const { vertices, bindings, color, resolveBinding } = recipe;
|
|
2691
2749
|
const texture = record.owner.native.currentTexture();
|
|
@@ -2695,15 +2753,16 @@ class WebGPUHostImplementation {
|
|
|
2695
2753
|
const encoder = record.owner.native.encoder();
|
|
2696
2754
|
gate();
|
|
2697
2755
|
const begin = this.method(encoder, 'beginRenderPass', gate), finish = this.method(encoder, 'finish', gate), copy = ticket ? this.method(encoder, 'copyTextureToBuffer', gate) : undefined;
|
|
2698
|
-
|
|
2756
|
+
// The clear colour as the target holds it: light, or the codes of a target that mixes them.
|
|
2757
|
+
const c = frame.clearColor, a = frame.clearAlpha, space = SHARED_OPTIONS.get(this).blendSpace;
|
|
2699
2758
|
const attachment = {
|
|
2700
2759
|
view: color.view,
|
|
2701
2760
|
loadOp: 'clear',
|
|
2702
2761
|
storeOp: 'store',
|
|
2703
2762
|
clearValue: {
|
|
2704
|
-
r: a *
|
|
2705
|
-
g: a *
|
|
2706
|
-
b: a *
|
|
2763
|
+
r: a * sharedTargetChannel2D(space, c >>> 16),
|
|
2764
|
+
g: a * sharedTargetChannel2D(space, c >>> 8),
|
|
2765
|
+
b: a * sharedTargetChannel2D(space, c),
|
|
2707
2766
|
a
|
|
2708
2767
|
}
|
|
2709
2768
|
};
|
|
@@ -2749,6 +2808,7 @@ class WebGPUHostImplementation {
|
|
|
2749
2808
|
if (draw.regionWindow >= 0)
|
|
2750
2809
|
active.pass.setBindGroup(1, recipe.regionBindings.get(draw));
|
|
2751
2810
|
active.pass.draw(draw.vertexCount);
|
|
2811
|
+
this.frameDrawCalls++;
|
|
2752
2812
|
};
|
|
2753
2813
|
if (storage.prepared.effects.groups.length === 0) {
|
|
2754
2814
|
for (const draw of batch.draws)
|
|
@@ -2764,6 +2824,7 @@ class WebGPUHostImplementation {
|
|
|
2764
2824
|
run.pass.setScissorRect(0, 0, width, height);
|
|
2765
2825
|
run.pass.setBindGroup(0, recipe.effects.get(group).get(mode));
|
|
2766
2826
|
run.pass.draw(3);
|
|
2827
|
+
this.frameDrawCalls++;
|
|
2767
2828
|
run.end();
|
|
2768
2829
|
gate();
|
|
2769
2830
|
};
|
|
@@ -2809,6 +2870,7 @@ class WebGPUHostImplementation {
|
|
|
2809
2870
|
resolve.setScissorRect(0, 0, width, height);
|
|
2810
2871
|
resolve.setBindGroup(0, resolveBinding);
|
|
2811
2872
|
resolve.draw(3);
|
|
2873
|
+
this.frameDrawCalls++;
|
|
2812
2874
|
endResolve();
|
|
2813
2875
|
gate();
|
|
2814
2876
|
if (staging) {
|
|
@@ -2829,6 +2891,14 @@ class WebGPUHostImplementation {
|
|
|
2829
2891
|
finishSubmission(record, ticket, done, outcomes, touchedQueue, synchronous, submitted, staging, frameId, width, height, rowPitch, output) {
|
|
2830
2892
|
const serial = record.serial;
|
|
2831
2893
|
let result;
|
|
2894
|
+
const use = record.imageUse;
|
|
2895
|
+
if (use?.producerValidations)
|
|
2896
|
+
outcomes.push(...use.producerValidations);
|
|
2897
|
+
// Queue order makes the completed writes visible to the next direct draw. Its own completion must
|
|
2898
|
+
// also observe producer validation errors, even when the consumer's fence is reported first.
|
|
2899
|
+
const pageValidation = !record.stage && submitted && !synchronous && use?.candidates.size
|
|
2900
|
+
? observed(Promise.all(outcomes).then(() => undefined))
|
|
2901
|
+
: undefined;
|
|
2832
2902
|
const nativeOutcomes = [...outcomes], nativeFailure = synchronous;
|
|
2833
2903
|
if (submitted && staging && !synchronous) {
|
|
2834
2904
|
try {
|
|
@@ -2907,6 +2977,16 @@ class WebGPUHostImplementation {
|
|
|
2907
2977
|
(this.firstFailure.serial === null || this.firstFailure.serial <= serial))
|
|
2908
2978
|
throw error(this.firstFailure.code, this.firstFailure.cause);
|
|
2909
2979
|
}));
|
|
2980
|
+
if (pageValidation && use && this.isImagePromotionEligible(record)) {
|
|
2981
|
+
for (const { entry } of use.candidates.values()) {
|
|
2982
|
+
if (!entry.resource || !entry.view || entry.bucket.has(entry.cropKey))
|
|
2983
|
+
continue;
|
|
2984
|
+
entry.state = 'submitted';
|
|
2985
|
+
entry.validation = pageValidation;
|
|
2986
|
+
entry.bucket.set(entry.cropKey, entry);
|
|
2987
|
+
}
|
|
2988
|
+
this.imageRevision = {};
|
|
2989
|
+
}
|
|
2910
2990
|
if (synchronous)
|
|
2911
2991
|
throw synchronous;
|
|
2912
2992
|
return undefined;
|
|
@@ -3343,6 +3423,7 @@ class WebGPUHostImplementation {
|
|
|
3343
3423
|
};
|
|
3344
3424
|
}
|
|
3345
3425
|
}
|
|
3426
|
+
/** A host that draws shared frames with WebGPU on a canvas. */
|
|
3346
3427
|
export function createSharedWebGPUHost(options) {
|
|
3347
3428
|
return new WebGPUHostImplementation(options);
|
|
3348
3429
|
}
|
package/dist/web/audio.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createBrowserAudio } from './BrowserAudio.js';
|
|
2
|
-
export type { BrowserAudio, BrowserAudioOptions } from './BrowserAudio.js';
|
|
1
|
+
export { createBrowserAudio, createWebAudioBackend } from './BrowserAudio.js';
|
|
2
|
+
export type { BrowserAudio, BrowserAudioOptions, WebAudioBackend, WebAudioBackendOptions } from './BrowserAudio.js';
|
|
3
3
|
//# sourceMappingURL=audio.d.ts.map
|
package/dist/web/audio.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Optional browser sound entry keeps Web Audio out of the default Engine graph.
|
|
3
|
-
export { createBrowserAudio } from './BrowserAudio.js';
|
|
3
|
+
export { createBrowserAudio, createWebAudioBackend } from './BrowserAudio.js';
|
|
4
4
|
//# sourceMappingURL=audio.js.map
|
|
@@ -2,9 +2,11 @@ import type { Scope } from '@egret/runtime';
|
|
|
2
2
|
import type { FontContentLoader } from '@egret/engine/resources';
|
|
3
3
|
import type { Engine } from '@egret/engine';
|
|
4
4
|
import type { ParagraphFontSet } from './CanvasKitFontSetProvider.js';
|
|
5
|
+
/** Loads the paragraph fonts a text editor uses. */
|
|
5
6
|
export interface EditorParagraphFontLoader {
|
|
6
7
|
load(scope: Scope, loader: FontContentLoader, roots: readonly string[]): Promise<ParagraphFontSet>;
|
|
7
8
|
}
|
|
9
|
+
/** An editor font provider to make: its engine and scope, its paragraph provider and deadline. */
|
|
8
10
|
export interface BrowserEditorFontProviderOptions {
|
|
9
11
|
readonly engine: Engine;
|
|
10
12
|
readonly scope: Scope;
|
|
@@ -12,6 +14,7 @@ export interface BrowserEditorFontProviderOptions {
|
|
|
12
14
|
readonly deadlineMs?: number;
|
|
13
15
|
}
|
|
14
16
|
declare const fontSetBrand: unique symbol;
|
|
17
|
+
/** Fonts loaded for a text editor: its key, families and identities; dispose of it when done. */
|
|
15
18
|
export interface BrowserEditorFontSet {
|
|
16
19
|
readonly [fontSetBrand]: true;
|
|
17
20
|
/** The same key is consumed by the existing paragraph provider. */
|
|
@@ -22,6 +25,7 @@ export interface BrowserEditorFontSet {
|
|
|
22
25
|
readonly closed: Promise<void>;
|
|
23
26
|
dispose(): void;
|
|
24
27
|
}
|
|
28
|
+
/** Loads font sets for browser text editors. */
|
|
25
29
|
export interface BrowserEditorFontProvider {
|
|
26
30
|
load(scope: Scope, loader: FontContentLoader, roots: readonly string[]): Promise<BrowserEditorFontSet>;
|
|
27
31
|
getStatus(): Readonly<{
|
package/dist/web/game.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createBrowserGame } from './BrowserGame.js';
|
|
2
|
-
export type { BrowserGame, BrowserGameBackend, BrowserGameFit, BrowserGameLabel, BrowserGameLabelOptions, BrowserGameOptions } from './BrowserGame.js';
|
|
2
|
+
export type { BrowserGame, BrowserGameBackend, BrowserGameFit, BrowserGameLabel, BrowserGameLabelCreateOptions, BrowserGameLabelOptions, BrowserGameOptions } from './BrowserGame.js';
|
|
3
3
|
export { createBrowserStatsPanel } from './BrowserStatsPanel.js';
|
|
4
4
|
export type { BrowserStatsPanel, BrowserStatsPanelOptions, BrowserStatsSample, BrowserStatsSnapshot } from './BrowserStatsPanel.js';
|
|
5
5
|
//# sourceMappingURL=game.d.ts.map
|
|
@@ -4,6 +4,8 @@ export interface ProjectionView2D {
|
|
|
4
4
|
readonly image: ImageData2D;
|
|
5
5
|
readonly region: TextureRegion2D;
|
|
6
6
|
readonly byteLength: number;
|
|
7
|
+
/** Levels uploaded: 1, or the page and each smaller copy of it. `byteLength` counts them all. Absent is 1. */
|
|
8
|
+
readonly levels?: number;
|
|
7
9
|
}
|
|
8
10
|
export interface ProjectionPlan2D {
|
|
9
11
|
readonly views: readonly ProjectionView2D[];
|
package/dist/web/kit.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export { openBrowserAssetBundle } from './BrowserAssetBundle.js';
|
|
|
7
7
|
export type { BrowserAssetBundle, BrowserAssetBundleOptions } from './BrowserAssetBundle.js';
|
|
8
8
|
export { openBrowserBundleCache, openIndexedDBSaveStorage } from './BrowserStorage.js';
|
|
9
9
|
export type { BundleCache, IndexedDBSaveStorage, IndexedDBSaveStorageOptions } from './BrowserStorage.js';
|
|
10
|
+
export { browserLanguages, prefersReducedMotion, watchReducedMotion } from './BrowserPreferences.js';
|
|
10
11
|
//# sourceMappingURL=kit.d.ts.map
|
package/dist/web/kit.js
CHANGED
|
@@ -4,4 +4,5 @@ export { createBrowserImageTextureProvider, decodeBrowserImage, fitBrowserImageS
|
|
|
4
4
|
export { bindBrowserInputActions, browserSaveStorage, createTouchButton, createTouchStick } from './BrowserInputActions.js';
|
|
5
5
|
export { openBrowserAssetBundle } from './BrowserAssetBundle.js';
|
|
6
6
|
export { openBrowserBundleCache, openIndexedDBSaveStorage } from './BrowserStorage.js';
|
|
7
|
+
export { browserLanguages, prefersReducedMotion, watchReducedMotion } from './BrowserPreferences.js';
|
|
7
8
|
//# sourceMappingURL=kit.js.map
|
package/dist/web/play.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export { play, PlayText } from './BrowserPlay.js';
|
|
2
|
-
export type { PlayBurstOptions, PlayButton, PlayButtonOptions, PlayGame, PlayKeys, PlayMotion, PlayOptions, PlayPointer, PlaySfx, PlayTextOptions } from './BrowserPlay.js';
|
|
2
|
+
export type { PlayBurstOptions, PlayButton, PlayButtonOptions, PlayGame, PlayImageOptions, PlayKeys, PlayMusic, PlayMotion, PlayOptions, PlayPointer, PlaySfx, PlayTextOptions, PlayTiles, PlayTilesOptions } from './BrowserPlay.js';
|
|
3
|
+
export { PlayBar, wrapPlayWords } from './playWidgets.js';
|
|
4
|
+
export type { PlayBarOptions, PlayMenuOptions, PlaySayOptions, PlayToastOptions } from './playWidgets.js';
|
|
3
5
|
export { SFX_PRESETS, isSfxRecipe, synthesizeSfx } from './playSfx.js';
|
|
6
|
+
export { MUSIC_MOODS, MUSIC_PARTS, composeMusic, musicMix } from './playMusic.js';
|
|
7
|
+
export type { MusicMood, MusicOptions, MusicPart, MusicPiece } from './playMusic.js';
|
|
8
|
+
export type { PlayStickOptions, PlayTouchButtonOptions } from './playTouch.js';
|
|
4
9
|
export type { SfxRecipe, SfxTone, SfxWave } from './playSfx.js';
|
|
5
10
|
//# sourceMappingURL=play.d.ts.map
|
package/dist/web/play.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Optional entry for a whole small game from one call: the canvas, the loop, keys and a pointer to ask each frame,
|
|
3
|
-
// sound effects made in code, overlap tests, timers, text, tweens
|
|
3
|
+
// sound effects made in code, overlap tests, timers, text, tweens, the small effects of a hit, and bars, notices,
|
|
4
|
+
// boxes of words and menus.
|
|
4
5
|
export { play, PlayText } from './BrowserPlay.js';
|
|
6
|
+
export { PlayBar, wrapPlayWords } from './playWidgets.js';
|
|
5
7
|
export { SFX_PRESETS, isSfxRecipe, synthesizeSfx } from './playSfx.js';
|
|
8
|
+
export { MUSIC_MOODS, MUSIC_PARTS, composeMusic, musicMix } from './playMusic.js';
|
|
6
9
|
//# sourceMappingURL=play.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** The moods there are. Each has its own key, harmony, tempo and parts. */
|
|
2
|
+
export type MusicMood = 'calm' | 'mystery' | 'tense' | 'battle' | 'triumph';
|
|
3
|
+
/** The moods play music can be made in. */
|
|
4
|
+
export declare const MUSIC_MOODS: readonly MusicMood[];
|
|
5
|
+
/** The parts of a piece, from the quietest moment to the most intense. */
|
|
6
|
+
export declare const MUSIC_PARTS: readonly ["pad", "bass", "drums", "tune"];
|
|
7
|
+
/** One part of a piece of play music. */
|
|
8
|
+
export type MusicPart = (typeof MUSIC_PARTS)[number];
|
|
9
|
+
/** Music to make: its mood, seed, tempo and length in bars. */
|
|
10
|
+
export interface MusicOptions {
|
|
11
|
+
readonly mood?: MusicMood;
|
|
12
|
+
/** The same seed writes the same piece. */
|
|
13
|
+
readonly seed?: number | string;
|
|
14
|
+
/** Beats a minute; the mood's own unless given, from 50 to 200. */
|
|
15
|
+
readonly tempo?: number;
|
|
16
|
+
/** Bars of four beats before the piece repeats: 4 or 8; 8 unless given. */
|
|
17
|
+
readonly bars?: 4 | 8;
|
|
18
|
+
}
|
|
19
|
+
/** A piece of music made from a seed: its mood, tempo, length and parts. */
|
|
20
|
+
export interface MusicPiece {
|
|
21
|
+
readonly mood: MusicMood;
|
|
22
|
+
readonly tempo: number;
|
|
23
|
+
readonly bars: number;
|
|
24
|
+
readonly rate: number;
|
|
25
|
+
readonly seconds: number;
|
|
26
|
+
/** Each part as samples from -1 to 1, all of one length, each joining itself where it repeats. */
|
|
27
|
+
readonly parts: Readonly<Record<MusicPart, Float32Array>>;
|
|
28
|
+
}
|
|
29
|
+
/** Writes a piece. Every call with the same options gives the same samples. */
|
|
30
|
+
export declare function composeMusic(options?: MusicOptions, rate?: number): MusicPiece;
|
|
31
|
+
/** How loud each part is at an intensity from 0 to 1: the pad always, then the bass, the drums and the tune. */
|
|
32
|
+
export declare function musicMix(intensity: number): Record<MusicPart, number>;
|
|
33
|
+
//# sourceMappingURL=playMusic.d.ts.map
|