@moku-labs/game 0.15.75 → 0.15.77
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/app/page.d.mts +1 -1
- package/dist/app/system.d.mts +3 -3
- package/dist/app.d.mts +3 -3
- package/dist/app.mjs +1 -1
- package/dist/assets.d.mts +1 -1
- package/dist/{commands-B4_087j0.d.mts → commands-Ye0XXw0Q.d.mts} +6 -6
- package/dist/control.d.mts +4 -4
- package/dist/{define-CVVpFTAJ.d.mts → define-BrGCWhuG.d.mts} +2 -2
- package/dist/{headless-Cgu6ie7C.d.mts → headless-CFlHYKpY.d.mts} +1 -1
- package/dist/{index-PrAYdg9-.d.mts → index-CDOJKnNB.d.mts} +3 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +2 -2
- package/dist/inspect.d.mts +7 -7
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{runtime-CJI4Fdu7.d.mts → runtime-lHRyrkCb.d.mts} +1 -1
- package/dist/{src-DwWNTjMx.mjs → src-BV-Cq8pt.mjs} +677 -167
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +1 -1
- package/dist/{types-B0HZvmZZ.d.mts → types-B9dzviB6.d.mts} +2 -2
- package/dist/{types-UP4-RD_A.d.mts → types-CD25TfIM.d.mts} +4 -4
- package/dist/{types-Bkdjj5Fy.d.mts → types-DvAtKyJ3.d.mts} +1 -1
- package/dist/{types-ZI525f5N.d.mts → types-G9hpd34F.d.mts} +2 -2
- package/dist/{types-BEDkqJKu.d.mts → types-JrYEbbeJ.d.mts} +213 -25
- package/dist/{visual-CJUeSL0M.d.mts → visual-BpKVyJ8w.d.mts} +6 -6
- package/dist/visual.d.mts +1 -1
- package/llms.txt +2 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { r as systemSource, t as memory } from "./memory-CWlqhS7l.mjs";
|
|
|
3
3
|
import { a as finishDrafts, i as enableDraftPatches, n as deepFreeze$1, o as openDrafts, r as dropDrafts } from "./drafts-BawpSaVp.mjs";
|
|
4
4
|
import { _ as compact, c as collectFlows, d as findNode, f as framePath, g as slotNames, h as restlessCapOf, i as servePaused, l as describeGraph, m as isRestCheckpoint, n as captureFrame, o as epochOf, p as graphHash, r as serveCaptures, s as pageNow$1, t as cancelCaptures, v as pushEntry } from "./capture-BtS6_oWr.mjs";
|
|
5
5
|
import { $ as Layer, A as readStyle, B as Display, D as builtInStyles, F as parentOf$1, G as Parent, H as NineSlice, I as poseUnder, J as Transform, K as Shape, L as rootPointOf, M as applyPose, N as isLeaving, P as localPoseOf, Q as Exiting, R as rootPoseInto, T as Text, U as Overlay, V as HudPart, W as OverlayLevel, X as componentsFor, Y as arcDefaults, _ as ScrollState, a as fitScaleOf, at as resource, c as samePose, ct as tag, d as Box, et as Now, f as Covered, g as Scroll, h as LocalWrite, i as fieldsLeftAlone, j as textFor, l as visualOf$1, m as Escapable, n as CONTENT$1, nt as Tree, o as livePatch, ot as system, p as DebugTrigger, q as Sprite, r as drawnRect, rt as component, s as restValueOf, st as systemsFor, tt as Order, u as visualRectOf, v as UI_OWNER, w as Countdown, x as uiFor, y as UiCounters, z as rootPoseOf } from "./visual-B7TxMv1J.mjs";
|
|
6
|
-
import { a as isDev
|
|
6
|
+
import { a as isDev } from "./dev-BNndV-hU.mjs";
|
|
7
7
|
import { n as isComponentDefinition } from "./component-DGg5DqKK.mjs";
|
|
8
8
|
import { n as flatten } from "./flatten-nUX9PpGo.mjs";
|
|
9
9
|
import { envPlugin, logPlugin } from "@moku-labs/common/browser";
|
|
@@ -3422,15 +3422,7 @@ function objectEquals(left, right) {
|
|
|
3422
3422
|
* for an answer that arrived while the gate was closed, and the `guide` narrow.
|
|
3423
3423
|
*/
|
|
3424
3424
|
/**
|
|
3425
|
-
*
|
|
3426
|
-
*
|
|
3427
|
-
* @returns True in a dev build.
|
|
3428
|
-
*/
|
|
3429
|
-
function isDev() {
|
|
3430
|
-
return typeof __MOKU_GAME_DEV__ !== "undefined" && __MOKU_GAME_DEV__;
|
|
3431
|
-
}
|
|
3432
|
-
/**
|
|
3433
|
-
* Logs, in a dev build, an answer a closed gate refused that no gate will take (F122). The payload
|
|
3425
|
+
* Logs, in a dev or agent build, an answer a closed gate refused that no gate will take (F122). The payload
|
|
3434
3426
|
* is built only when the line is written.
|
|
3435
3427
|
*
|
|
3436
3428
|
* @param ctx - Domain context of the flow plugin.
|
|
@@ -3438,7 +3430,7 @@ function isDev() {
|
|
|
3438
3430
|
* @param reason - Why no gate takes it.
|
|
3439
3431
|
*/
|
|
3440
3432
|
function dropped(ctx, answer, reason) {
|
|
3441
|
-
if (!
|
|
3433
|
+
if (!(typeof __MOKU_GAME_DEV__ !== "undefined" && __MOKU_GAME_DEV__ || typeof __MOKU_GAME_AGENT__ !== "undefined" && __MOKU_GAME_AGENT__)) return;
|
|
3442
3434
|
ctx.log.warn("flow:answer-dropped", {
|
|
3443
3435
|
intent: answer.intent,
|
|
3444
3436
|
payload: answer.payload,
|
|
@@ -15045,7 +15037,116 @@ function installRebindingRenderGroupPipe(pixi) {
|
|
|
15045
15037
|
};
|
|
15046
15038
|
}
|
|
15047
15039
|
//#endregion
|
|
15040
|
+
//#region src/plugins/renderer/reasons.ts
|
|
15041
|
+
/**
|
|
15042
|
+
* @file renderer plugin — the reasons a frame is drawn and a canvas pass begins, in ring order: the monitor stores a
|
|
15043
|
+
* reason by its index. A plain module of the plugin root, so the monitor reads the order without importing the demand
|
|
15044
|
+
* module's run-time code (L1), and `host/render-pass.ts` names a begin without importing the monitor; `DemandReason`
|
|
15045
|
+
* in `demand/types.ts` is derived from it.
|
|
15046
|
+
*/
|
|
15047
|
+
/**
|
|
15048
|
+
* Every reason in ring order: the monitor stores the index (spec 11 `FrameColumns.reason`), 255 for a frame without a
|
|
15049
|
+
* decision. New reasons are only ever appended (block 3B: `"overlay"`, `"retake"` after `"none"`), so stored indices
|
|
15050
|
+
* keep their meaning. There is no whole-frame reason for `renderer.invalidate`: it always names an entity
|
|
15051
|
+
* (LEAD-FIXES-4). A root export, so a reader of the ring names a reason without building a record.
|
|
15052
|
+
*
|
|
15053
|
+
* @example
|
|
15054
|
+
* ```ts
|
|
15055
|
+
* // An overlay names why the newest frame of a debug build was drawn: a piece moved, a counted change mark.
|
|
15056
|
+
* const ring = app.renderer.monitor.frames();
|
|
15057
|
+
* DEMAND_REASONS[ring.columns.reason[ring.newest] ?? 255]; // "mark"
|
|
15058
|
+
* ```
|
|
15059
|
+
*/
|
|
15060
|
+
const DEMAND_REASONS = [
|
|
15061
|
+
"always",
|
|
15062
|
+
"first",
|
|
15063
|
+
"resize",
|
|
15064
|
+
"restore",
|
|
15065
|
+
"layers",
|
|
15066
|
+
"debug",
|
|
15067
|
+
"wake",
|
|
15068
|
+
"capture",
|
|
15069
|
+
"request",
|
|
15070
|
+
"mark",
|
|
15071
|
+
"verify",
|
|
15072
|
+
"none",
|
|
15073
|
+
"overlay",
|
|
15074
|
+
"retake"
|
|
15075
|
+
];
|
|
15076
|
+
/**
|
|
15077
|
+
* The reasons a canvas pass began, by their index in the pass ring's `restart` column: new ones are only ever appended.
|
|
15078
|
+
* A root export, so a reader of the ring names a reason without building a record.
|
|
15079
|
+
*
|
|
15080
|
+
* @example
|
|
15081
|
+
* ```ts
|
|
15082
|
+
* // The editor's pass strip says why the newest pass of a debug build began.
|
|
15083
|
+
* const { passes } = app.renderer.monitor.frames();
|
|
15084
|
+
* CANVAS_RESTARTS[passes.restart[passes.newest] ?? 0]; // "filter"
|
|
15085
|
+
* ```
|
|
15086
|
+
*/
|
|
15087
|
+
const CANVAS_RESTARTS = [
|
|
15088
|
+
"none",
|
|
15089
|
+
"first",
|
|
15090
|
+
"filter",
|
|
15091
|
+
"mask",
|
|
15092
|
+
"depth",
|
|
15093
|
+
"empty"
|
|
15094
|
+
];
|
|
15095
|
+
/** The index of each reason in `CANVAS_RESTARTS`: what the lazy canvas pass hands the monitor, no string per pass. */
|
|
15096
|
+
const RESTART = {
|
|
15097
|
+
none: 0,
|
|
15098
|
+
first: 1,
|
|
15099
|
+
filter: 2,
|
|
15100
|
+
mask: 3,
|
|
15101
|
+
depth: 4,
|
|
15102
|
+
empty: 5
|
|
15103
|
+
};
|
|
15104
|
+
//#endregion
|
|
15048
15105
|
//#region src/plugins/renderer/host/render-pass.ts
|
|
15106
|
+
/**
|
|
15107
|
+
* @file renderer/host — the lazy canvas pass of WebGPU (B3 of change 2026-10-18-memory-render). Pixi 8.22 begins the
|
|
15108
|
+
* canvas's render pass when a render starts (`RenderTargetSystem.renderStart` → `GpuRenderTargetAdaptor
|
|
15109
|
+
* .startRenderPass`, a clear and a store). A frame whose first instruction is a filter ends that pass at once with no
|
|
15110
|
+
* draw in it (`FilterSystem` binds its input), and the filter's apply begins it again with a load: on a tiled GPU (the
|
|
15111
|
+
* Mali of a Galaxy A26) the frame pays a store and a reload of the whole canvas for nothing. And every pass Pixi begins
|
|
15112
|
+
* on a target that is not transient stores and loads its depth-stencil attachment, which the canvas has from its
|
|
15113
|
+
* first stencil mask on, so every filter break also stores and reloads stencil and depth that nothing reads.
|
|
15114
|
+
*
|
|
15115
|
+
* Three classes fix both through Pixi's registry, no patch: a subclass of `GpuRenderTargetSystem` whose adaptor (a
|
|
15116
|
+
* subclass of `GpuRenderTargetAdaptor`) defers a pass on the canvas, and a subclass of `PipelineSystem` that begins a
|
|
15117
|
+
* deferred pass when the first draw asks for its pipeline. In Pixi 8.22 every command recorded into a pass is preceded
|
|
15118
|
+
* by a call to the pipeline system: a draw by `getPipeline` (`GpuEncoderSystem.draw`) or `getBufferNamesToBind`
|
|
15119
|
+
* (`setGeometry`, the first call of a batch and of a graphics draw), a stencil reference by `setStencilMode`
|
|
15120
|
+
* (`GpuStencilSystem`), a render bundle by `bundleStateKey`. The encoder itself stays Pixi's, or the counting one of
|
|
15121
|
+
* the monitor, so a pass that never began is never counted.
|
|
15122
|
+
*
|
|
15123
|
+
* The canvas pass. A bind of the canvas with no pass open on it begins nothing: it ends the open pass, as Pixi's begin
|
|
15124
|
+
* would, and keeps the clear it asked for, owed. The pass begins at the first draw, with the owed clear, so a frame
|
|
15125
|
+
* clears its canvas exactly once, in the pass that draws first. A canvas bound with no draw before another target is
|
|
15126
|
+
* bound begins nothing at all; its clear waits for the next bind of the canvas. A read of the canvas (a backdrop
|
|
15127
|
+
* filter's copy) pays the owed clear first. At the end of the frame (`renderEnd`) an owed clear is paid, and a canvas
|
|
15128
|
+
* that saw no pass at all gets one, so a frame that never draws on it still clears and presents it, as Pixi's does. A
|
|
15129
|
+
* canvas with multisampling is left to Pixi (its restore copies the canvas).
|
|
15130
|
+
*
|
|
15131
|
+
* The depth-stencil rule, for the canvas only. Pixi's stencil masks count: a push draws the mask with `increment`
|
|
15132
|
+
* where the stencil equals the depth of the stack, its pop draws the same instructions with `decrement`, so with no
|
|
15133
|
+
* mask open the stencil is 0 everywhere a draw tests it. A canvas pass therefore loads the stencil only while a mask
|
|
15134
|
+
* is open on the canvas (`maskStackIndex > 0`), and clears it to 0 otherwise. It stores the stencil while a mask is
|
|
15135
|
+
* open, or when a mask was pushed on the canvas in this frame or the one before; else it discards it. A mask pushed
|
|
15136
|
+
* into a pass that discards (the first mask after frames without one) begins the pass again first, with the stencil
|
|
15137
|
+
* cleared and stored, so a mask that spans a filter break never loses what it drew. Depth is read only by a pipeline
|
|
15138
|
+
* that tests it and written only by one that writes it; Pixi's 2D pipes draw with `State.for2d()`, which does
|
|
15139
|
+
* neither, so the canvas clears and discards its depth until the first pipeline that tests or writes depth, which
|
|
15140
|
+
* begins the pass again with the depth cleared and stored, and stores it from then on (only `GpuEncoderSystem.draw`
|
|
15141
|
+
* carries such a state, and it asks for the pipeline before it sets anything, so the new pass misses nothing). A copy
|
|
15142
|
+
* of the canvas's depth keeps it too, from then on.
|
|
15143
|
+
*
|
|
15144
|
+
* The target change. A bind that changes the target makes Pixi's stencil system set its mode and its reference, and the
|
|
15145
|
+
* reference is a command of the pass. A render whose root canvas was not the last target bound (the first frame, a
|
|
15146
|
+
* frame after a kept picture was taken) would so begin its canvas pass at once. The render target system marks the
|
|
15147
|
+
* canvas bound before Pixi binds it, so that bind changes nothing, and the adaptor tells the stencil system right
|
|
15148
|
+
* after the pass began; a mask pushed first begins it before the stencil system reads its target.
|
|
15149
|
+
*/
|
|
15049
15150
|
/** Pixi's `CLEAR.NONE`. */
|
|
15050
15151
|
const CLEAR_NONE = 0;
|
|
15051
15152
|
/** Pixi's `CLEAR.ALL`: colour, depth and stencil. */
|
|
@@ -15063,15 +15164,18 @@ function clearBits(clear) {
|
|
|
15063
15164
|
if (clear === false) return CLEAR_NONE;
|
|
15064
15165
|
return clear;
|
|
15065
15166
|
}
|
|
15167
|
+
/** The listener of a stage nobody listens to. */
|
|
15168
|
+
function noListener() {}
|
|
15066
15169
|
/**
|
|
15067
15170
|
* Builds the classes of the lazy canvas pass from the module object, at call time, because the bases arrive with the
|
|
15068
15171
|
* lazily loaded module. Each system keeps its base's `static extension` object as it is, so the registry files it
|
|
15069
15172
|
* under the same type and name. They cost one test of two booleans per pipeline request, and nothing else per draw.
|
|
15070
15173
|
*
|
|
15071
15174
|
* @param pixi - The loaded Pixi module.
|
|
15175
|
+
* @param canvasBegan - Told of every canvas pass that really began, with its reason; the file never imports the monitor.
|
|
15072
15176
|
* @returns The render target system and the pipeline system.
|
|
15073
15177
|
*/
|
|
15074
|
-
function createLazyCanvasClasses(pixi) {
|
|
15178
|
+
function createLazyCanvasClasses(pixi, canvasBegan = noListener) {
|
|
15075
15179
|
/**
|
|
15076
15180
|
* Pixi's WebGPU adaptor, which begins a pass on the canvas at its first draw and sets the canvas's stencil and depth
|
|
15077
15181
|
* operations by the rule of the file. One per renderer.
|
|
@@ -15177,7 +15281,7 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15177
15281
|
const bits = clearBits(clear);
|
|
15178
15282
|
if (this.canvas !== void 0 && this.canvas !== renderTarget) this.settleCanvas();
|
|
15179
15283
|
if (bits === CLEAR_NONE && this.isOpen(renderTarget)) {
|
|
15180
|
-
this.beginCanvas(renderTarget, CLEAR_NONE, void 0, viewport);
|
|
15284
|
+
this.beginCanvas(renderTarget, CLEAR_NONE, void 0, viewport, RESTART.filter);
|
|
15181
15285
|
return;
|
|
15182
15286
|
}
|
|
15183
15287
|
this.finishRenderPass();
|
|
@@ -15234,7 +15338,7 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15234
15338
|
this.canvas = void 0;
|
|
15235
15339
|
this.owed = CLEAR_NONE;
|
|
15236
15340
|
this.owedColorSet = false;
|
|
15237
|
-
this.beginCanvas(target, bits, color, this.view);
|
|
15341
|
+
this.beginCanvas(target, bits, color, this.view, this.acquired ? RESTART.filter : RESTART.first);
|
|
15238
15342
|
}
|
|
15239
15343
|
/**
|
|
15240
15344
|
* A pipeline that tests or writes depth was asked for: the canvas keeps its depth from now on, and an open canvas
|
|
@@ -15243,7 +15347,7 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15243
15347
|
useDepth() {
|
|
15244
15348
|
this.depthUsed = true;
|
|
15245
15349
|
const canvas = this.openCanvas;
|
|
15246
|
-
if (canvas?.depthStencilAttachment !== void 0 && !this.keepDepth && this.passOpen()) this.restart(canvas);
|
|
15350
|
+
if (canvas?.depthStencilAttachment !== void 0 && !this.keepDepth && this.passOpen()) this.restart(canvas, RESTART.depth);
|
|
15247
15351
|
}
|
|
15248
15352
|
/**
|
|
15249
15353
|
* A stencil mask is about to be pushed on the bound target: on the canvas, the stencil is kept from now on.
|
|
@@ -15262,7 +15366,7 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15262
15366
|
*/
|
|
15263
15367
|
maskPushed(target) {
|
|
15264
15368
|
if (this.changeOwed && this.pending && this.canvas === target) this.beginPending();
|
|
15265
|
-
else if (this.openCanvas === target && !this.keepStencil && this.passOpen()) this.restart(target);
|
|
15369
|
+
else if (this.openCanvas === target && !this.keepStencil && this.passOpen()) this.restart(target, RESTART.mask);
|
|
15266
15370
|
}
|
|
15267
15371
|
/**
|
|
15268
15372
|
* The end of a render call: pays the clear the canvas owes, gives a canvas that saw no pass one, so the frame
|
|
@@ -15345,8 +15449,9 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15345
15449
|
* @param bits - The `CLEAR` bits.
|
|
15346
15450
|
* @param color - The clear colour, when one was given.
|
|
15347
15451
|
* @param viewport - The viewport.
|
|
15452
|
+
* @param restart - Why it begins, an index into `CANVAS_RESTARTS`.
|
|
15348
15453
|
*/
|
|
15349
|
-
beginCanvas(target, bits, color, viewport) {
|
|
15454
|
+
beginCanvas(target, bits, color, viewport, restart) {
|
|
15350
15455
|
const gpu = this.gpu;
|
|
15351
15456
|
const targets = this.targets;
|
|
15352
15457
|
if (gpu === void 0 || targets === void 0) return;
|
|
@@ -15355,7 +15460,7 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15355
15460
|
if (viewport !== this.view) this.view.copyFrom(viewport);
|
|
15356
15461
|
super.startRenderPass(target, bits, color, viewport, 0, 0);
|
|
15357
15462
|
this.openCanvas = target;
|
|
15358
|
-
if (gpu.encoder.renderPassEncoder !== before) this.began(target, targets);
|
|
15463
|
+
if (gpu.encoder.renderPassEncoder !== before) this.began(target, targets, restart);
|
|
15359
15464
|
}
|
|
15360
15465
|
/**
|
|
15361
15466
|
* Sets the stencil and depth operations of the rule on the canvas's depth-stencil attachment, made first when
|
|
@@ -15377,13 +15482,16 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15377
15482
|
attachment.depthStoreOp = this.planDepth ? "store" : "discard";
|
|
15378
15483
|
}
|
|
15379
15484
|
/**
|
|
15380
|
-
* Records a canvas pass that really began (Pixi did not reuse the open one),
|
|
15381
|
-
* canvas when the root bind owes it the change, now that there is a pass to set its reference
|
|
15485
|
+
* Records a canvas pass that really began (Pixi did not reuse the open one), tells the listener why, and tells the
|
|
15486
|
+
* stencil system of the canvas when the root bind owes it the change, now that there is a pass to set its reference
|
|
15487
|
+
* on.
|
|
15382
15488
|
*
|
|
15383
15489
|
* @param target - The canvas.
|
|
15384
15490
|
* @param targets - The render target system.
|
|
15491
|
+
* @param restart - Why it began, an index into `CANVAS_RESTARTS`.
|
|
15385
15492
|
*/
|
|
15386
|
-
began(target, targets) {
|
|
15493
|
+
began(target, targets, restart) {
|
|
15494
|
+
canvasBegan(restart);
|
|
15387
15495
|
this.acquired = true;
|
|
15388
15496
|
this.keepStencil = this.planStencil;
|
|
15389
15497
|
this.keepDepth = this.planDepth;
|
|
@@ -15403,7 +15511,7 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15403
15511
|
const color = this.owedColorSet ? this.owedColor : void 0;
|
|
15404
15512
|
this.owed = CLEAR_NONE;
|
|
15405
15513
|
this.owedColorSet = false;
|
|
15406
|
-
this.beginCanvas(target, bits, color, this.view);
|
|
15514
|
+
this.beginCanvas(target, bits, color, this.view, RESTART.empty);
|
|
15407
15515
|
this.finishRenderPass();
|
|
15408
15516
|
}
|
|
15409
15517
|
/**
|
|
@@ -15421,13 +15529,14 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15421
15529
|
* reference again: a new pass starts from 0, and Pixi sets it only when the mode or the target changes.
|
|
15422
15530
|
*
|
|
15423
15531
|
* @param target - The canvas.
|
|
15532
|
+
* @param restart - Why it begins again: `RESTART.mask` or `RESTART.depth`.
|
|
15424
15533
|
*/
|
|
15425
|
-
restart(target) {
|
|
15534
|
+
restart(target, restart) {
|
|
15426
15535
|
const gpu = this.gpu;
|
|
15427
15536
|
const targets = this.targets;
|
|
15428
15537
|
if (gpu === void 0 || targets === void 0) return;
|
|
15429
15538
|
this.finishRenderPass();
|
|
15430
|
-
this.beginCanvas(target, CLEAR_NONE, void 0, this.view);
|
|
15539
|
+
this.beginCanvas(target, CLEAR_NONE, void 0, this.view, restart);
|
|
15431
15540
|
gpu.encoder.setStencilReference(targets.getGpuRenderTarget(target).stencilReference);
|
|
15432
15541
|
}
|
|
15433
15542
|
}
|
|
@@ -15564,11 +15673,12 @@ function createLazyCanvasClasses(pixi) {
|
|
|
15564
15673
|
* Pixi's own classes back, the stencil system again last.
|
|
15565
15674
|
*
|
|
15566
15675
|
* @param pixi - The loaded Pixi module.
|
|
15676
|
+
* @param canvasBegan - Told of every canvas pass that really began, with its reason.
|
|
15567
15677
|
* @returns The remover.
|
|
15568
15678
|
* @throws {TypeError} When the module has none of the classes to subclass.
|
|
15569
15679
|
*/
|
|
15570
|
-
function installLazyCanvasPass(pixi) {
|
|
15571
|
-
const lazy = createLazyCanvasClasses(pixi);
|
|
15680
|
+
function installLazyCanvasPass(pixi, canvasBegan = noListener) {
|
|
15681
|
+
const lazy = createLazyCanvasClasses(pixi, canvasBegan);
|
|
15572
15682
|
pixi.extensions.remove(pixi.GpuRenderTargetSystem, pixi.GpuStencilSystem, pixi.PipelineSystem);
|
|
15573
15683
|
pixi.extensions.add(lazy.targets, pixi.GpuStencilSystem, lazy.pipeline);
|
|
15574
15684
|
return () => {
|
|
@@ -16305,7 +16415,8 @@ function createHostState() {
|
|
|
16305
16415
|
kept: emptyWeakSet$3(),
|
|
16306
16416
|
pixelsFailed: false,
|
|
16307
16417
|
pool: createPoolState(),
|
|
16308
|
-
onTrim: []
|
|
16418
|
+
onTrim: [],
|
|
16419
|
+
onCanvasPass: void 0
|
|
16309
16420
|
};
|
|
16310
16421
|
}
|
|
16311
16422
|
//#endregion
|
|
@@ -16427,7 +16538,9 @@ function installRenderPass(ctx, pixi) {
|
|
|
16427
16538
|
const state = ctx.state.host;
|
|
16428
16539
|
if (state.uninstallRenderPass !== void 0) return;
|
|
16429
16540
|
try {
|
|
16430
|
-
state.uninstallRenderPass = installLazyCanvasPass(pixi)
|
|
16541
|
+
state.uninstallRenderPass = installLazyCanvasPass(pixi, (restart) => {
|
|
16542
|
+
state.onCanvasPass?.(restart);
|
|
16543
|
+
});
|
|
16431
16544
|
} catch (error) {
|
|
16432
16545
|
ctx.log.warn("renderer: the canvas pass begins at render start", { error });
|
|
16433
16546
|
}
|
|
@@ -16549,6 +16662,7 @@ function stopHost(state) {
|
|
|
16549
16662
|
state.onLoss.length = 0;
|
|
16550
16663
|
state.onResolutionChange.length = 0;
|
|
16551
16664
|
state.onTrim.length = 0;
|
|
16665
|
+
state.onCanvasPass = void 0;
|
|
16552
16666
|
state.pool = createPoolState();
|
|
16553
16667
|
state.resolution.pending = void 0;
|
|
16554
16668
|
state.kind = "none";
|
|
@@ -17104,6 +17218,9 @@ function createHostApi(ctx, deps) {
|
|
|
17104
17218
|
onTrim: (fn) => {
|
|
17105
17219
|
state.onTrim.push(fn);
|
|
17106
17220
|
},
|
|
17221
|
+
onCanvasPass: (fn) => {
|
|
17222
|
+
state.onCanvasPass = fn;
|
|
17223
|
+
},
|
|
17107
17224
|
init: async () => {
|
|
17108
17225
|
const mount = resolveMount(ctx);
|
|
17109
17226
|
if (mount === void 0) return;
|
|
@@ -17420,7 +17537,7 @@ function matricesOf(kctx) {
|
|
|
17420
17537
|
* @param top - The view's top.
|
|
17421
17538
|
* @returns The label, `view` when it has none.
|
|
17422
17539
|
*/
|
|
17423
|
-
function labelOf$
|
|
17540
|
+
function labelOf$4(top) {
|
|
17424
17541
|
const label = top.label;
|
|
17425
17542
|
return label === null || label === "" ? "view" : label;
|
|
17426
17543
|
}
|
|
@@ -17599,7 +17716,7 @@ function renderStage1(kctx, pixi, matrices, record) {
|
|
|
17599
17716
|
width: key[KEY.w1] ?? 0,
|
|
17600
17717
|
height: key[KEY.h1] ?? 0,
|
|
17601
17718
|
resolution: rs
|
|
17602
|
-
}, `kept:${labelOf$
|
|
17719
|
+
}, `kept:${labelOf$4(top)}#1`);
|
|
17603
17720
|
record.s1 = s1;
|
|
17604
17721
|
matrices.m1.set(key[KEY.a] ?? 1, key[KEY.b] ?? 0, key[KEY.c] ?? 0, key[KEY.d] ?? 1, (key[KEY.tx] ?? 0) - (key[KEY.X0] ?? 0), (key[KEY.ty] ?? 0) - (key[KEY.Y0] ?? 0));
|
|
17605
17722
|
const group = top.isRenderGroup;
|
|
@@ -17627,7 +17744,7 @@ function standInOf(pixi, record) {
|
|
|
17627
17744
|
const s1 = record.s1 ?? pixi.Texture.EMPTY;
|
|
17628
17745
|
if (record.standIn === void 0 || record.standIn.destroyed) {
|
|
17629
17746
|
record.standIn = new pixi.Sprite(s1);
|
|
17630
|
-
record.standIn.label = `kept:${labelOf$
|
|
17747
|
+
record.standIn.label = `kept:${labelOf$4(record.top)}#3`;
|
|
17631
17748
|
} else if (record.standIn.texture !== s1) record.standIn.texture = s1;
|
|
17632
17749
|
return record.standIn;
|
|
17633
17750
|
}
|
|
@@ -17650,7 +17767,7 @@ function outputOf(kctx, pixi, record, resolution, padding) {
|
|
|
17650
17767
|
width: (key[KEY.w1] ?? 0) + 2 * Ps,
|
|
17651
17768
|
height: (key[KEY.h1] ?? 0) + 2 * Ps,
|
|
17652
17769
|
resolution
|
|
17653
|
-
}, `kept:${labelOf$
|
|
17770
|
+
}, `kept:${labelOf$4(record.top)}#3`);
|
|
17654
17771
|
return record.s3;
|
|
17655
17772
|
}
|
|
17656
17773
|
/**
|
|
@@ -17677,7 +17794,7 @@ function keeperOf(pixi, record, resolution, padding) {
|
|
|
17677
17794
|
const s1 = record.s1 ?? pixi.Texture.EMPTY;
|
|
17678
17795
|
if (record.keeperStandIn === void 0 || record.keeperStandIn.destroyed) {
|
|
17679
17796
|
record.keeperStandIn = new pixi.Sprite(s1);
|
|
17680
|
-
record.keeperStandIn.label = `kept:${labelOf$
|
|
17797
|
+
record.keeperStandIn.label = `kept:${labelOf$4(record.top)}#2`;
|
|
17681
17798
|
record.keeperStandIn.filters = [record.keeper];
|
|
17682
17799
|
} else if (record.keeperStandIn.texture !== s1) record.keeperStandIn.texture = s1;
|
|
17683
17800
|
return record.keeperStandIn;
|
|
@@ -17717,7 +17834,7 @@ function sizeTargets(kctx, pixi, record, scales, padding) {
|
|
|
17717
17834
|
width,
|
|
17718
17835
|
height,
|
|
17719
17836
|
resolution: rs * scale
|
|
17720
|
-
}, `kept:${labelOf$
|
|
17837
|
+
}, `kept:${labelOf$4(record.top)}#2.${index}`);
|
|
17721
17838
|
for (const extra of record.s2.splice(scales.length)) dropTexture(kctx, extra);
|
|
17722
17839
|
}
|
|
17723
17840
|
/**
|
|
@@ -17890,6 +18007,7 @@ function makeRoom(kctx, extra, taking, goLive) {
|
|
|
17890
18007
|
* @param goLive - Draws it live.
|
|
17891
18008
|
*/
|
|
17892
18009
|
function evict$1(kctx, record, goLive) {
|
|
18010
|
+
kctx.state.frameEvicted += 1;
|
|
17893
18011
|
if (record.mode === "kept") goLive(record);
|
|
17894
18012
|
endLoan(record.s2Of);
|
|
17895
18013
|
if (record.s1 !== void 0) dropTexture(kctx, record.s1);
|
|
@@ -18392,6 +18510,13 @@ function createKeptState(config) {
|
|
|
18392
18510
|
takesWindow: 0,
|
|
18393
18511
|
refreshesOpen: 0,
|
|
18394
18512
|
frameTakes: 0,
|
|
18513
|
+
frameEvicted: 0,
|
|
18514
|
+
frameRefused: 0,
|
|
18515
|
+
evictedWindow: 0,
|
|
18516
|
+
refusedWindow: 0,
|
|
18517
|
+
windowStart: 0,
|
|
18518
|
+
windowEnd: -1,
|
|
18519
|
+
windowNext: 0,
|
|
18395
18520
|
drawnPictures: 0,
|
|
18396
18521
|
on: allowed && config.debug.kept !== false,
|
|
18397
18522
|
allowed,
|
|
@@ -18488,6 +18613,13 @@ function stopKept(state) {
|
|
|
18488
18613
|
state.takesWindow = 0;
|
|
18489
18614
|
state.refreshesOpen = 0;
|
|
18490
18615
|
state.frameTakes = 0;
|
|
18616
|
+
state.frameEvicted = 0;
|
|
18617
|
+
state.frameRefused = 0;
|
|
18618
|
+
state.evictedWindow = 0;
|
|
18619
|
+
state.refusedWindow = 0;
|
|
18620
|
+
state.windowStart = 0;
|
|
18621
|
+
state.windowEnd = -1;
|
|
18622
|
+
state.windowNext = 0;
|
|
18491
18623
|
state.flushPasses = 0;
|
|
18492
18624
|
state.drawnPictures = 0;
|
|
18493
18625
|
state.firstTakes = 0;
|
|
@@ -18498,6 +18630,75 @@ function stopKept(state) {
|
|
|
18498
18630
|
state.verifySkipped = 0;
|
|
18499
18631
|
state.bypassed = false;
|
|
18500
18632
|
}
|
|
18633
|
+
//#endregion
|
|
18634
|
+
//#region src/plugins/renderer/kept/types.ts
|
|
18635
|
+
/** The reasons a view is drawn live: a record stores `WHY_LIVE[why - 1]`'s index, 0 while kept. Appended only. */
|
|
18636
|
+
const WHY_LIVE = [
|
|
18637
|
+
"off",
|
|
18638
|
+
"backdrop",
|
|
18639
|
+
"filter-blend",
|
|
18640
|
+
"cache-false",
|
|
18641
|
+
"hidden",
|
|
18642
|
+
"faded-out",
|
|
18643
|
+
"top-blend",
|
|
18644
|
+
"ancestor-tint",
|
|
18645
|
+
"ancestor-blend",
|
|
18646
|
+
"ancestor-hidden",
|
|
18647
|
+
"placed-under-filter",
|
|
18648
|
+
"blend-below",
|
|
18649
|
+
"display",
|
|
18650
|
+
"waiting",
|
|
18651
|
+
"alpha-due",
|
|
18652
|
+
"churn",
|
|
18653
|
+
"budget",
|
|
18654
|
+
"idle"
|
|
18655
|
+
];
|
|
18656
|
+
/** The reasons of a take: a record stores `RETAKE_WHY[retakeWhy - 1]`'s index, 0 before its first. Appended only. */
|
|
18657
|
+
const RETAKE_WHY = [
|
|
18658
|
+
"first",
|
|
18659
|
+
"mark",
|
|
18660
|
+
"inner-first",
|
|
18661
|
+
"resolution",
|
|
18662
|
+
"settle",
|
|
18663
|
+
"scale-limit",
|
|
18664
|
+
"canvas",
|
|
18665
|
+
"filter",
|
|
18666
|
+
"chain",
|
|
18667
|
+
"placed-move"
|
|
18668
|
+
];
|
|
18669
|
+
/** The 1-based index of each reason of `WHY_LIVE` the step writes: a number on the record, no string per frame. */
|
|
18670
|
+
const WHY = {
|
|
18671
|
+
off: 1,
|
|
18672
|
+
backdrop: 2,
|
|
18673
|
+
filterBlend: 3,
|
|
18674
|
+
hidden: 5,
|
|
18675
|
+
fadedOut: 6,
|
|
18676
|
+
topBlend: 7,
|
|
18677
|
+
ancestorTint: 8,
|
|
18678
|
+
ancestorBlend: 9,
|
|
18679
|
+
ancestorHidden: 10,
|
|
18680
|
+
placedUnderFilter: 11,
|
|
18681
|
+
blendBelow: 12,
|
|
18682
|
+
display: 13,
|
|
18683
|
+
waiting: 14,
|
|
18684
|
+
alphaDue: 15,
|
|
18685
|
+
churn: 16,
|
|
18686
|
+
budget: 17,
|
|
18687
|
+
idle: 18
|
|
18688
|
+
};
|
|
18689
|
+
/** The 1-based index of each reason of `RETAKE_WHY`: a number on the record, no string per frame. */
|
|
18690
|
+
const RETAKE = {
|
|
18691
|
+
first: 1,
|
|
18692
|
+
mark: 2,
|
|
18693
|
+
innerFirst: 3,
|
|
18694
|
+
resolution: 4,
|
|
18695
|
+
settle: 5,
|
|
18696
|
+
scaleLimit: 6,
|
|
18697
|
+
canvas: 7,
|
|
18698
|
+
filter: 8,
|
|
18699
|
+
chain: 9,
|
|
18700
|
+
placedMove: 10
|
|
18701
|
+
};
|
|
18501
18702
|
/** The reasons an ancestor may be hidden by and still draw the view: an overlay's range, a kept ancestor's picture. */
|
|
18502
18703
|
const DRAWN_ANYWAY = ["freeze", "kept"];
|
|
18503
18704
|
/** The tint of a container that tints nothing. */
|
|
@@ -18607,19 +18808,20 @@ function refusalHolds(state, record) {
|
|
|
18607
18808
|
return record.refused > 0 && state.bytes - state.poolBytes + record.refused - record.bytes > state.budget;
|
|
18608
18809
|
}
|
|
18609
18810
|
/**
|
|
18610
|
-
* Tells whether a first take waits for the next frame (F114): a stack drawn direct never does; a view drawn
|
|
18611
|
-
* a crowd of them waits only when `CROWD_TAKES` were taken in this frame already (F119); any other waits when
|
|
18612
|
-
*
|
|
18811
|
+
* Tells whether a first take waits for the next frame, and why (F114): a stack drawn direct never does; a view drawn
|
|
18812
|
+
* live while a crowd of them waits only when `CROWD_TAKES` were taken in this frame already (F119); any other waits when
|
|
18813
|
+
* an alpha is due or this frame took one already.
|
|
18613
18814
|
*
|
|
18614
18815
|
* @param state - The kept state.
|
|
18615
18816
|
* @param direct - The stack draws direct.
|
|
18616
18817
|
* @param live - The view is drawn live in this frame.
|
|
18617
|
-
* @returns
|
|
18818
|
+
* @returns The `WHY` it waits for, 0 when it does not.
|
|
18618
18819
|
*/
|
|
18619
18820
|
function heldBack(state, direct, live) {
|
|
18620
|
-
if (direct) return
|
|
18621
|
-
if (live && state.liveWaiting >= 4) return state.firstTakes >= 10;
|
|
18622
|
-
|
|
18821
|
+
if (direct) return 0;
|
|
18822
|
+
if (live && state.liveWaiting >= 4) return state.firstTakes >= 10 ? WHY.waiting : 0;
|
|
18823
|
+
if (state.alphaDue) return WHY.alphaDue;
|
|
18824
|
+
return state.firstTakes > 0 ? WHY.waiting : 0;
|
|
18623
18825
|
}
|
|
18624
18826
|
/**
|
|
18625
18827
|
* Tells whether a view is drawn live in the stage pass of this frame (F119): every ancestor up to the stage is
|
|
@@ -18658,15 +18860,16 @@ function holdsFilters(node) {
|
|
|
18658
18860
|
* Tells whether the filters of a stack draw like a picture: none reads the backdrop, every one blends normally.
|
|
18659
18861
|
*
|
|
18660
18862
|
* @param slots - The record's slots.
|
|
18661
|
-
* @returns
|
|
18863
|
+
* @returns 0 when they do, else the `WHY` of the first that does not.
|
|
18662
18864
|
*/
|
|
18663
|
-
function
|
|
18865
|
+
function filtersWhy(slots) {
|
|
18664
18866
|
for (let index = 0; index < slots.length; index += 1) {
|
|
18665
18867
|
const filter = slots[index]?.filter;
|
|
18666
|
-
if (filter === void 0) continue;
|
|
18667
|
-
if (filter.
|
|
18868
|
+
if (filter === void 0 || !filter.enabled) continue;
|
|
18869
|
+
if (filter.blendRequired) return WHY.backdrop;
|
|
18870
|
+
if (!plainBlend(filter.blendMode)) return WHY.filterBlend;
|
|
18668
18871
|
}
|
|
18669
|
-
return
|
|
18872
|
+
return 0;
|
|
18670
18873
|
}
|
|
18671
18874
|
/**
|
|
18672
18875
|
* The filters `sync` keeps for an entity, as `setFilters` stored them.
|
|
@@ -18692,18 +18895,6 @@ function topDrawn(sync, view) {
|
|
|
18692
18895
|
return !(hiddenBy(view, "empty") && view.wrapper === void 0);
|
|
18693
18896
|
}
|
|
18694
18897
|
/**
|
|
18695
|
-
* Tells whether an ancestor draws what is under it as a picture would: visible, untinted, blending normally. Its alpha
|
|
18696
|
-
* is not read (F113): the quad hangs in the top's parent and Pixi multiplies it by the ancestors' alpha, while stage 1
|
|
18697
|
-
* renders the top as a root without them. A fading ancestor so draws the picture at `A·F(x)`, live draws `F(A·x)`: the
|
|
18698
|
-
* same for an alpha-linear filter, the whole picture faded for one that is not.
|
|
18699
|
-
*
|
|
18700
|
-
* @param node - The ancestor.
|
|
18701
|
-
* @returns True when it does.
|
|
18702
|
-
*/
|
|
18703
|
-
function drawsPlain(node) {
|
|
18704
|
-
return node.visible && node.tint === WHITE$2 && plainBlend(node.blendMode);
|
|
18705
|
-
}
|
|
18706
|
-
/**
|
|
18707
18898
|
* Tells whether an ancestor is drawn: renderable, or hidden only by an overlay's range or a kept ancestor's picture,
|
|
18708
18899
|
* which draw it anyway.
|
|
18709
18900
|
*
|
|
@@ -18727,37 +18918,61 @@ function filtersPlaced(kctx, record, node) {
|
|
|
18727
18918
|
return record.category === "placed" && (holdsFilters(node) || kctx.state.byTop.get(node)?.mode === "kept");
|
|
18728
18919
|
}
|
|
18729
18920
|
/**
|
|
18730
|
-
* Tells whether
|
|
18731
|
-
*
|
|
18732
|
-
*
|
|
18921
|
+
* Tells whether an ancestor draws what is under it as a picture would: visible, untinted, blending normally, drawn (an
|
|
18922
|
+
* overlay's range and a kept ancestor's picture count), and for a placed filter holding no filter (its canvas position
|
|
18923
|
+
* would not be the canvas pixel live). Its alpha is not read (F113): the quad hangs in the top's parent and Pixi
|
|
18924
|
+
* multiplies it by the ancestors' alpha, while stage 1 renders the top as a root without them. A fading ancestor so
|
|
18925
|
+
* draws the picture at `A·F(x)`, live draws `F(A·x)`: the same for an alpha-linear filter, the whole picture faded for
|
|
18926
|
+
* one that is not.
|
|
18927
|
+
*
|
|
18928
|
+
* @param kctx - The kept context.
|
|
18929
|
+
* @param record - The record.
|
|
18930
|
+
* @param node - The ancestor.
|
|
18931
|
+
* @returns 0 when it does, else the `WHY` it does not.
|
|
18932
|
+
*/
|
|
18933
|
+
function ancestorWhy(kctx, record, node) {
|
|
18934
|
+
if (!node.visible) return WHY.ancestorHidden;
|
|
18935
|
+
if (node.tint !== WHITE$2) return WHY.ancestorTint;
|
|
18936
|
+
if (!plainBlend(node.blendMode)) return WHY.ancestorBlend;
|
|
18937
|
+
if (!drawnAnyway(kctx, node)) return WHY.ancestorHidden;
|
|
18938
|
+
return filtersPlaced(kctx, record, node) ? WHY.placedUnderFilter : 0;
|
|
18939
|
+
}
|
|
18940
|
+
/**
|
|
18941
|
+
* Tells whether every ancestor up to the stage draws the view as a picture would (`ancestorWhy`).
|
|
18733
18942
|
*
|
|
18734
18943
|
* @param kctx - The kept context.
|
|
18735
18944
|
* @param record - The record.
|
|
18736
18945
|
* @param stage - The stage of the application.
|
|
18737
|
-
* @returns
|
|
18946
|
+
* @returns 0 when they do, else the `WHY` of the first that does not.
|
|
18738
18947
|
*/
|
|
18739
|
-
function
|
|
18948
|
+
function ancestorsWhy(kctx, record, stage) {
|
|
18740
18949
|
for (let node = record.top.parent; node !== stage; node = node.parent) {
|
|
18741
|
-
if (node === null) return
|
|
18742
|
-
|
|
18950
|
+
if (node === null) return WHY.ancestorHidden;
|
|
18951
|
+
const why = ancestorWhy(kctx, record, node);
|
|
18952
|
+
if (why !== 0) return why;
|
|
18743
18953
|
}
|
|
18744
|
-
return
|
|
18954
|
+
return 0;
|
|
18745
18955
|
}
|
|
18746
18956
|
/**
|
|
18747
|
-
* Whether a record may be kept this frame (P4.1): an enabled filter, filters that draw like a picture, a
|
|
18748
|
-
* visual that blend normally (the visual sits inside the wrapper of a kept bare view, D4), a top that is
|
|
18749
|
-
* ancestors that draw it as a picture would
|
|
18957
|
+
* Whether a record may be kept this frame (P4.1): the switch on, an enabled filter, filters that draw like a picture, a
|
|
18958
|
+
* top and a visual that blend normally (the visual sits inside the wrapper of a kept bare view, D4), a top that is
|
|
18959
|
+
* drawn, ancestors that draw it as a picture would.
|
|
18750
18960
|
*
|
|
18751
18961
|
* @param kctx - The kept context.
|
|
18752
18962
|
* @param record - The record.
|
|
18753
18963
|
* @param view - Its view.
|
|
18754
18964
|
* @param stack - The stack of this frame.
|
|
18755
|
-
* @returns
|
|
18965
|
+
* @returns 0 when it may be kept, else the `WHY` of the first check that failed.
|
|
18756
18966
|
*/
|
|
18757
18967
|
function eligible(kctx, record, view, stack) {
|
|
18758
|
-
const { top } = record;
|
|
18759
18968
|
const stage = kctx.host.stage();
|
|
18760
|
-
|
|
18969
|
+
if (!keepingOn(kctx) || stage === void 0 || stack.enabled === 0) return WHY.off;
|
|
18970
|
+
const filters = filtersWhy(record.slots);
|
|
18971
|
+
if (filters !== 0) return filters;
|
|
18972
|
+
const picture = pictureWhy(record.top, view);
|
|
18973
|
+
if (picture !== 0) return picture;
|
|
18974
|
+
if (!topDrawn(kctx.sync, view)) return WHY.hidden;
|
|
18975
|
+
return ancestorsWhy(kctx, record, stage);
|
|
18761
18976
|
}
|
|
18762
18977
|
/**
|
|
18763
18978
|
* Tells whether the kept cache may keep anything this frame: switched on and not bypassed.
|
|
@@ -18774,10 +18989,11 @@ function keepingOn(kctx) {
|
|
|
18774
18989
|
*
|
|
18775
18990
|
* @param top - The record's top.
|
|
18776
18991
|
* @param view - Its view.
|
|
18777
|
-
* @returns
|
|
18992
|
+
* @returns 0 when they do, else the `WHY` they do not.
|
|
18778
18993
|
*/
|
|
18779
|
-
function
|
|
18780
|
-
|
|
18994
|
+
function pictureWhy(top, view) {
|
|
18995
|
+
if (top.visible && top.alpha > 0) return plainBlend(top.blendMode) && plainBlend(view.object.blendMode) ? 0 : WHY.topBlend;
|
|
18996
|
+
return WHY.fadedOut;
|
|
18781
18997
|
}
|
|
18782
18998
|
/**
|
|
18783
18999
|
* Tells whether a node under a top blends otherwise than normally, at any depth (F68): drawn into a picture, it would
|
|
@@ -18809,7 +19025,7 @@ function blendedBelow(kctx, record) {
|
|
|
18809
19025
|
if (!blendsBelow(record.top)) return false;
|
|
18810
19026
|
record.blended = true;
|
|
18811
19027
|
const { warnedBlend } = kctx.state;
|
|
18812
|
-
const label = labelOf$
|
|
19028
|
+
const label = labelOf$4(record.top);
|
|
18813
19029
|
if (!warnedBlend.has(label)) {
|
|
18814
19030
|
warnedBlend.add(label);
|
|
18815
19031
|
kctx.ctx.log.warn("renderer:kept-blend", { picture: label });
|
|
@@ -18888,7 +19104,14 @@ function createRecord$1(kctx, pixi, entity, view, slots, category) {
|
|
|
18888
19104
|
spared: false,
|
|
18889
19105
|
idle: false,
|
|
18890
19106
|
alphaDue: false,
|
|
18891
|
-
alphaMissed: false
|
|
19107
|
+
alphaMissed: false,
|
|
19108
|
+
idleSeen: false,
|
|
19109
|
+
why: WHY.waiting,
|
|
19110
|
+
calmIn: 2,
|
|
19111
|
+
markBy: 0,
|
|
19112
|
+
retakeWhy: 0,
|
|
19113
|
+
retakeBy: 0,
|
|
19114
|
+
retakeAt: 0
|
|
18892
19115
|
};
|
|
18893
19116
|
const { state } = kctx;
|
|
18894
19117
|
state.records.push(record);
|
|
@@ -19073,6 +19296,7 @@ function writeTakeKeys(record, now, box) {
|
|
|
19073
19296
|
*/
|
|
19074
19297
|
function refuseIdle(record) {
|
|
19075
19298
|
record.idle = true;
|
|
19299
|
+
record.idleSeen = true;
|
|
19076
19300
|
return false;
|
|
19077
19301
|
}
|
|
19078
19302
|
/**
|
|
@@ -19093,7 +19317,8 @@ function refuseIdle(record) {
|
|
|
19093
19317
|
*/
|
|
19094
19318
|
function takePicture(kctx, pixi, matrices, record, view, now, turned = false) {
|
|
19095
19319
|
const { top } = record;
|
|
19096
|
-
|
|
19320
|
+
record.displays = !kctx.ctx.config.onDemand && holdsDisplay(kctx, top);
|
|
19321
|
+
if (record.displays) return refuseIdle(record);
|
|
19097
19322
|
if (blendedBelow(kctx, record)) return false;
|
|
19098
19323
|
const drawn = drawnBounds(pixi, top);
|
|
19099
19324
|
if (!drawn.isValid) return refuseIdle(record);
|
|
@@ -19124,7 +19349,8 @@ function takePicture(kctx, pixi, matrices, record, view, now, turned = false) {
|
|
|
19124
19349
|
});
|
|
19125
19350
|
if (!makeRoom(kctx, needed - record.bytes, record, (kept) => goLive(kctx, kept, kctx.ctx.state.sync.views.get(kept.entity), true))) {
|
|
19126
19351
|
record.refused = needed;
|
|
19127
|
-
|
|
19352
|
+
kctx.state.frameRefused += 1;
|
|
19353
|
+
warnRefused(kctx, labelOf$4(top));
|
|
19128
19354
|
return false;
|
|
19129
19355
|
}
|
|
19130
19356
|
record.refused = 0;
|
|
@@ -19341,7 +19567,7 @@ function placeQuad(sync, pixi, matrices, record, view) {
|
|
|
19341
19567
|
const alpha = (record.direct ? NOW.alpha : 1) * top.alpha;
|
|
19342
19568
|
if (record.quad === void 0 || record.quad.destroyed) {
|
|
19343
19569
|
record.quad = new pixi.Sprite(output);
|
|
19344
|
-
record.quad.label = `kept:${labelOf$
|
|
19570
|
+
record.quad.label = `kept:${labelOf$4(top)}`;
|
|
19345
19571
|
}
|
|
19346
19572
|
const quad = record.quad;
|
|
19347
19573
|
if (quad.texture !== output) quad.texture = output;
|
|
@@ -19383,6 +19609,9 @@ function toKept(kctx, record, view) {
|
|
|
19383
19609
|
record.mode = "kept";
|
|
19384
19610
|
record.calm = false;
|
|
19385
19611
|
record.churn = 0;
|
|
19612
|
+
record.why = 0;
|
|
19613
|
+
record.calmIn = 0;
|
|
19614
|
+
record.idleSeen = false;
|
|
19386
19615
|
kctx.sync.swapHidden(kctx.hidden, view, "kept", true);
|
|
19387
19616
|
}
|
|
19388
19617
|
/**
|
|
@@ -19459,6 +19688,40 @@ function waitOf(record) {
|
|
|
19459
19688
|
return drawsDirect(NOW) ? 0 : 2;
|
|
19460
19689
|
}
|
|
19461
19690
|
/**
|
|
19691
|
+
* Notes why a live record that may be kept is not taken in this frame, from what the policy keeps on it: a `Display`
|
|
19692
|
+
* found under its top, a take that rendered nothing or a cut under a move, a refused take, a glow under the top, else
|
|
19693
|
+
* the still frames it waits for. A move offers a take again but changes neither of the first two: they stand until a
|
|
19694
|
+
* change under the top, so a moving view does not flip to a wait.
|
|
19695
|
+
*
|
|
19696
|
+
* @param state - The kept state.
|
|
19697
|
+
* @param record - The record, live.
|
|
19698
|
+
* @param changed - It changed in this frame.
|
|
19699
|
+
* @param turned - Its linear part moved in this frame.
|
|
19700
|
+
*/
|
|
19701
|
+
function noteHeld(state, record, changed, turned) {
|
|
19702
|
+
record.calmIn = 0;
|
|
19703
|
+
if (record.displays === true) record.why = WHY.display;
|
|
19704
|
+
else if (record.idleSeen || turned && record.cut) record.why = WHY.idle;
|
|
19705
|
+
else if (refusalHolds(state, record)) record.why = WHY.budget;
|
|
19706
|
+
else if (record.blended) record.why = WHY.blendBelow;
|
|
19707
|
+
else {
|
|
19708
|
+
record.why = record.calm ? WHY.churn : WHY.waiting;
|
|
19709
|
+
record.calmIn = Math.max(waitOf(record) - record.still, changed ? 1 : 0);
|
|
19710
|
+
}
|
|
19711
|
+
}
|
|
19712
|
+
/**
|
|
19713
|
+
* Notes what a take was for, in numbers: `why()` names them when it is asked. A mark's reasons keep who marked.
|
|
19714
|
+
*
|
|
19715
|
+
* @param kctx - The kept context.
|
|
19716
|
+
* @param record - The record.
|
|
19717
|
+
* @param why - The `RETAKE` of the take.
|
|
19718
|
+
*/
|
|
19719
|
+
function noteTake(kctx, record, why) {
|
|
19720
|
+
record.retakeWhy = why;
|
|
19721
|
+
record.retakeBy = why === RETAKE.mark || why === RETAKE.innerFirst ? record.markBy : 0;
|
|
19722
|
+
record.retakeAt = kctx.state.frame;
|
|
19723
|
+
}
|
|
19724
|
+
/**
|
|
19462
19725
|
* Marks every kept record above a record that was just first taken: their retake in this flush is not churn (F114),
|
|
19463
19726
|
* so the inner takes spread over frames do not drop the outer picture to live.
|
|
19464
19727
|
*
|
|
@@ -19492,18 +19755,26 @@ function stepLive(kctx, pixi, matrices, record, view) {
|
|
|
19492
19755
|
writeSeen(record, NOW);
|
|
19493
19756
|
record.still = changed ? 0 : record.still + 1;
|
|
19494
19757
|
if (moved) record.idle = false;
|
|
19495
|
-
if (changed || record.still < waitOf(record) || record.idle)
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19758
|
+
if (changed || record.still < waitOf(record) || record.idle || refusalHolds(state, record) || blendedBelow(kctx, record)) {
|
|
19759
|
+
noteHeld(state, record, changed, turned);
|
|
19760
|
+
return;
|
|
19761
|
+
}
|
|
19762
|
+
const held = heldBack(state, drawsDirect(NOW), drawnLive(kctx, record));
|
|
19763
|
+
if (held !== 0) {
|
|
19764
|
+
record.why = held;
|
|
19765
|
+
record.calmIn = 0;
|
|
19766
|
+
return;
|
|
19767
|
+
}
|
|
19499
19768
|
wrapBare(kctx, record, view);
|
|
19500
19769
|
if (!takePicture(kctx, pixi, matrices, record, view, NOW, turned)) {
|
|
19501
19770
|
record.still = 0;
|
|
19771
|
+
noteHeld(state, record, false, turned);
|
|
19502
19772
|
return;
|
|
19503
19773
|
}
|
|
19504
19774
|
state.firstTakes += 1;
|
|
19505
19775
|
record.takenAt = state.frame;
|
|
19506
19776
|
toKept(kctx, record, view);
|
|
19777
|
+
noteTake(kctx, record, RETAKE.first);
|
|
19507
19778
|
spareAbove(kctx, record);
|
|
19508
19779
|
}
|
|
19509
19780
|
/**
|
|
@@ -19514,9 +19785,15 @@ function stepLive(kctx, pixi, matrices, record, view) {
|
|
|
19514
19785
|
* @param matrices - The scratch matrices.
|
|
19515
19786
|
* @param record - The record, kept.
|
|
19516
19787
|
* @param view - Its view.
|
|
19788
|
+
* @param why - The `RETAKE` of the take.
|
|
19517
19789
|
*/
|
|
19518
|
-
function retakeOrGoLive(kctx, pixi, matrices, record, view) {
|
|
19519
|
-
if (
|
|
19790
|
+
function retakeOrGoLive(kctx, pixi, matrices, record, view, why) {
|
|
19791
|
+
if (takePicture(kctx, pixi, matrices, record, view, NOW)) {
|
|
19792
|
+
noteTake(kctx, record, why);
|
|
19793
|
+
return;
|
|
19794
|
+
}
|
|
19795
|
+
goLive(kctx, record, view, true);
|
|
19796
|
+
noteHeld(kctx.state, record, false, false);
|
|
19520
19797
|
}
|
|
19521
19798
|
/**
|
|
19522
19799
|
* A stage-1 change of a kept record (P4.3): retaken, or after three in a row drawn live and calm, so it stands still
|
|
@@ -19527,16 +19804,41 @@ function retakeOrGoLive(kctx, pixi, matrices, record, view) {
|
|
|
19527
19804
|
* @param matrices - The scratch matrices.
|
|
19528
19805
|
* @param record - The record, kept.
|
|
19529
19806
|
* @param view - Its view.
|
|
19807
|
+
* @param why - The `RETAKE` of a retake.
|
|
19530
19808
|
*/
|
|
19531
|
-
function churn(kctx, pixi, matrices, record, view) {
|
|
19809
|
+
function churn(kctx, pixi, matrices, record, view, why) {
|
|
19532
19810
|
record.churn += 1;
|
|
19533
19811
|
if (record.churn < 3) {
|
|
19534
|
-
retakeOrGoLive(kctx, pixi, matrices, record, view);
|
|
19812
|
+
retakeOrGoLive(kctx, pixi, matrices, record, view, why);
|
|
19535
19813
|
return;
|
|
19536
19814
|
}
|
|
19537
19815
|
goLive(kctx, record, view, true);
|
|
19538
19816
|
record.calm = true;
|
|
19539
19817
|
writeSeen(record, NOW);
|
|
19818
|
+
noteHeld(kctx.state, record, false, false);
|
|
19819
|
+
}
|
|
19820
|
+
/**
|
|
19821
|
+
* What a retake of a kept record owes itself to: a new stack resolution, a change under its top, or a linear part it may
|
|
19822
|
+
* not be drawn at.
|
|
19823
|
+
*
|
|
19824
|
+
* @param record - The record, kept, about to be retaken.
|
|
19825
|
+
* @returns The `RETAKE`.
|
|
19826
|
+
*/
|
|
19827
|
+
function retakeWhy(record) {
|
|
19828
|
+
if (record.key[KEY.rs] !== NOW.rs) return RETAKE.resolution;
|
|
19829
|
+
if (record.dirtyS1) return RETAKE.mark;
|
|
19830
|
+
return record.cut || record.category === "placed" ? RETAKE.placedMove : RETAKE.scaleLimit;
|
|
19831
|
+
}
|
|
19832
|
+
/**
|
|
19833
|
+
* What a refresh of a kept record owes itself to, read before the render writes its keys.
|
|
19834
|
+
*
|
|
19835
|
+
* @param record - The record, kept.
|
|
19836
|
+
* @param chain - Stage 2 is redone too.
|
|
19837
|
+
* @returns The `RETAKE`.
|
|
19838
|
+
*/
|
|
19839
|
+
function refreshWhy(record, chain) {
|
|
19840
|
+
if (chain) return RETAKE.chain;
|
|
19841
|
+
return NOW.r === record.key[KEY.r] ? RETAKE.filter : RETAKE.resolution;
|
|
19540
19842
|
}
|
|
19541
19843
|
/**
|
|
19542
19844
|
* Notes a move of a kept record: a quad that left its picture's texel grid owes one settle retake at rest, and asks
|
|
@@ -19579,21 +19881,21 @@ function stepKept$1(kctx, pixi, matrices, record, view) {
|
|
|
19579
19881
|
writeSeen(record, NOW);
|
|
19580
19882
|
const retake = record.dirtyS1 || scaled && !scalable(record);
|
|
19581
19883
|
if (retake && record.spared && !scaled) {
|
|
19582
|
-
retakeOrGoLive(kctx, pixi, matrices, record, view);
|
|
19884
|
+
retakeOrGoLive(kctx, pixi, matrices, record, view, RETAKE.innerFirst);
|
|
19583
19885
|
return;
|
|
19584
19886
|
}
|
|
19585
19887
|
if (retake) {
|
|
19586
|
-
churn(kctx, pixi, matrices, record, view);
|
|
19888
|
+
churn(kctx, pixi, matrices, record, view, retakeWhy(record));
|
|
19587
19889
|
return;
|
|
19588
19890
|
}
|
|
19589
19891
|
const moved = turned || NOW.tx !== key[KEY.lastTx] || NOW.ty !== key[KEY.lastTy];
|
|
19590
19892
|
if (record.cut && (moved || canvasChanged(kctx, key))) {
|
|
19591
|
-
churn(kctx, pixi, matrices, record, view);
|
|
19893
|
+
churn(kctx, pixi, matrices, record, view, RETAKE.canvas);
|
|
19592
19894
|
return;
|
|
19593
19895
|
}
|
|
19594
19896
|
record.churn = 0;
|
|
19595
19897
|
if (!moved && record.settle) {
|
|
19596
|
-
retakeOrGoLive(kctx, pixi, matrices, record, view);
|
|
19898
|
+
retakeOrGoLive(kctx, pixi, matrices, record, view, RETAKE.settle);
|
|
19597
19899
|
return;
|
|
19598
19900
|
}
|
|
19599
19901
|
refresh$1(kctx, pixi, matrices, record);
|
|
@@ -19630,6 +19932,7 @@ function refresh$1(kctx, pixi, matrices, record) {
|
|
|
19630
19932
|
padding: NOW.P
|
|
19631
19933
|
});
|
|
19632
19934
|
if (!stageThreeOwed) return;
|
|
19935
|
+
noteTake(kctx, record, refreshWhy(record, stageTwoOwed));
|
|
19633
19936
|
record.direct = false;
|
|
19634
19937
|
renderStage3(kctx, pixi, matrices, record, NOW);
|
|
19635
19938
|
account(kctx, record);
|
|
@@ -19707,7 +20010,7 @@ function markAlphaDue(kctx, pixi) {
|
|
|
19707
20010
|
if (record === void 0 || view === void 0 || !mayBeDue(kctx, record)) continue;
|
|
19708
20011
|
readStack(record.slots, resolution, pixi.AlphaFilter, DUE);
|
|
19709
20012
|
const direct = drawsDirectAt(DUE, resolution);
|
|
19710
|
-
record.alphaDue = direct && eligible(kctx, record, view, DUE);
|
|
20013
|
+
record.alphaDue = direct && eligible(kctx, record, view, DUE) === 0;
|
|
19711
20014
|
state.alphaDue ||= record.alphaDue;
|
|
19712
20015
|
if (!direct && drawnLive(kctx, record)) state.liveWaiting += 1;
|
|
19713
20016
|
}
|
|
@@ -19740,16 +20043,20 @@ function stepRecord(kctx, pixi, matrices, record, view) {
|
|
|
19740
20043
|
record.blended = false;
|
|
19741
20044
|
record.idle = false;
|
|
19742
20045
|
record.alphaMissed = false;
|
|
20046
|
+
record.displays = void 0;
|
|
20047
|
+
record.idleSeen = false;
|
|
19743
20048
|
}
|
|
19744
20049
|
NOW.r = kctx.host.resolution();
|
|
19745
20050
|
readStack(record.slots, NOW.r, pixi.AlphaFilter, NOW);
|
|
19746
|
-
|
|
19747
|
-
|
|
20051
|
+
const why = eligible(kctx, record, view, NOW);
|
|
20052
|
+
if (why === 0) stepEligible(kctx, pixi, matrices, record, view);
|
|
20053
|
+
else stepIneligible(kctx, record, view, why);
|
|
19748
20054
|
if (drawingChanged(kctx, record, BEFORE)) dirtyAbove(kctx, record);
|
|
19749
20055
|
record.quiet = record.dirtyS1 ? 0 : record.quiet + 1;
|
|
19750
20056
|
record.dirtyS1 = false;
|
|
19751
20057
|
record.dirtyS2 = false;
|
|
19752
20058
|
record.dirtyS3 = false;
|
|
20059
|
+
record.markBy = 0;
|
|
19753
20060
|
record.spared = false;
|
|
19754
20061
|
if (record.alphaDue && record.mode !== "kept") record.alphaMissed = true;
|
|
19755
20062
|
record.alphaDue = false;
|
|
@@ -19784,13 +20091,16 @@ function stepEligible(kctx, pixi, matrices, record, view) {
|
|
|
19784
20091
|
* @param kctx - The kept context.
|
|
19785
20092
|
* @param record - The record.
|
|
19786
20093
|
* @param view - Its view.
|
|
20094
|
+
* @param why - The `WHY` of the check that failed.
|
|
19787
20095
|
*/
|
|
19788
|
-
function stepIneligible(kctx, record, view) {
|
|
20096
|
+
function stepIneligible(kctx, record, view, why) {
|
|
19789
20097
|
if (record.mode === "kept") {
|
|
19790
20098
|
goLive(kctx, record, view, true);
|
|
19791
20099
|
if (kctx.state.frame - record.takenAt <= 1) record.calm = true;
|
|
19792
20100
|
}
|
|
19793
20101
|
record.still = 0;
|
|
20102
|
+
record.why = why;
|
|
20103
|
+
record.calmIn = 0;
|
|
19794
20104
|
}
|
|
19795
20105
|
/**
|
|
19796
20106
|
* Tells whether a range picture draws a node: the node, or a node above it, is one of the range's entries.
|
|
@@ -19813,7 +20123,10 @@ function rangeHolds$1(entries, node) {
|
|
|
19813
20123
|
function dirtyAbove(kctx, record) {
|
|
19814
20124
|
for (let node = record.top.parent; node !== null; node = node.parent) {
|
|
19815
20125
|
const above = kctx.state.byTop.get(node);
|
|
19816
|
-
if (above !== void 0)
|
|
20126
|
+
if (above !== void 0) {
|
|
20127
|
+
above.dirtyS1 = true;
|
|
20128
|
+
above.markBy = record.entity;
|
|
20129
|
+
}
|
|
19817
20130
|
}
|
|
19818
20131
|
for (const range of kctx.state.ranges.values()) if (rangeHolds$1(range.entries, record.top)) range.due = true;
|
|
19819
20132
|
}
|
|
@@ -20000,7 +20313,126 @@ function verifyPictures(kctx, bypass, recover) {
|
|
|
20000
20313
|
kctx.demand.request();
|
|
20001
20314
|
}
|
|
20002
20315
|
//#endregion
|
|
20316
|
+
//#region src/plugins/renderer/kept/why.ts
|
|
20317
|
+
/**
|
|
20318
|
+
* Adds the entities of a subtree to a set, depth first: the order Pixi draws them in.
|
|
20319
|
+
*
|
|
20320
|
+
* @param node - The top of the subtree.
|
|
20321
|
+
* @param entityOf - The entity of each object of a view.
|
|
20322
|
+
* @param order - Where they go, each once.
|
|
20323
|
+
*/
|
|
20324
|
+
function collectDrawOrder(node, entityOf, order) {
|
|
20325
|
+
const entity = entityOf.get(node);
|
|
20326
|
+
if (entity !== void 0) order.add(entity);
|
|
20327
|
+
for (const child of node.children) collectDrawOrder(child, entityOf, order);
|
|
20328
|
+
}
|
|
20329
|
+
/**
|
|
20330
|
+
* The label of an entity's view now.
|
|
20331
|
+
*
|
|
20332
|
+
* @param sync - The sync state.
|
|
20333
|
+
* @param entity - The entity.
|
|
20334
|
+
* @returns The label of its display object, `null` without a view.
|
|
20335
|
+
*/
|
|
20336
|
+
function labelOf$3(sync, entity) {
|
|
20337
|
+
return sync.views.get(entity)?.object.label ?? null;
|
|
20338
|
+
}
|
|
20339
|
+
/**
|
|
20340
|
+
* The last take of a record, while it fell in the last closed window.
|
|
20341
|
+
*
|
|
20342
|
+
* @param kctx - The kept context.
|
|
20343
|
+
* @param record - The record.
|
|
20344
|
+
* @returns The take, or `null`.
|
|
20345
|
+
*/
|
|
20346
|
+
function lastTake(kctx, record) {
|
|
20347
|
+
const { state } = kctx;
|
|
20348
|
+
const why = RETAKE_WHY[record.retakeWhy - 1];
|
|
20349
|
+
if (why === void 0 || record.retakeAt < state.windowStart) return null;
|
|
20350
|
+
if (record.retakeAt > state.windowEnd) return null;
|
|
20351
|
+
return {
|
|
20352
|
+
why,
|
|
20353
|
+
by: labelOf$3(kctx.ctx.state.sync, record.retakeBy)
|
|
20354
|
+
};
|
|
20355
|
+
}
|
|
20356
|
+
/**
|
|
20357
|
+
* The entry of a view with a record. A live record no step told a reason yet, as an evicted one, waits for its next.
|
|
20358
|
+
*
|
|
20359
|
+
* @param kctx - The kept context.
|
|
20360
|
+
* @param record - The record.
|
|
20361
|
+
* @param view - The label of its view.
|
|
20362
|
+
* @returns The entry.
|
|
20363
|
+
*/
|
|
20364
|
+
function recordEntry(kctx, record, view) {
|
|
20365
|
+
const retake = lastTake(kctx, record);
|
|
20366
|
+
if (record.mode === "kept") return {
|
|
20367
|
+
view,
|
|
20368
|
+
mode: record.direct ? "direct" : "kept",
|
|
20369
|
+
reason: null,
|
|
20370
|
+
calmIn: 0,
|
|
20371
|
+
retake
|
|
20372
|
+
};
|
|
20373
|
+
const why = record.why === 0 ? WHY.waiting : record.why;
|
|
20374
|
+
return {
|
|
20375
|
+
view,
|
|
20376
|
+
mode: "live",
|
|
20377
|
+
reason: WHY_LIVE[why - 1] ?? null,
|
|
20378
|
+
calmIn: record.calmIn,
|
|
20379
|
+
retake
|
|
20380
|
+
};
|
|
20381
|
+
}
|
|
20382
|
+
/**
|
|
20383
|
+
* The entry of a view the cache keeps no record of: a slot it may not keep, a filter that reads the backdrop.
|
|
20384
|
+
*
|
|
20385
|
+
* @param slots - The view's slots.
|
|
20386
|
+
* @param view - The label of its view.
|
|
20387
|
+
* @returns The entry.
|
|
20388
|
+
*/
|
|
20389
|
+
function slotsEntry(slots, view) {
|
|
20390
|
+
return {
|
|
20391
|
+
view,
|
|
20392
|
+
mode: "live",
|
|
20393
|
+
reason: slots.some((slot) => slot.filter.enabled && slot.filter.blendRequired) ? "backdrop" : "cache-false",
|
|
20394
|
+
calmIn: 0,
|
|
20395
|
+
retake: null
|
|
20396
|
+
};
|
|
20397
|
+
}
|
|
20398
|
+
/**
|
|
20399
|
+
* The entry of an entity, when it has a view and an enabled filter.
|
|
20400
|
+
*
|
|
20401
|
+
* @param kctx - The kept context.
|
|
20402
|
+
* @param entity - The entity.
|
|
20403
|
+
* @param view - Its view.
|
|
20404
|
+
* @returns The entry, or `undefined`.
|
|
20405
|
+
*/
|
|
20406
|
+
function entryOf$1(kctx, entity, view) {
|
|
20407
|
+
const slots = kctx.ctx.state.sync.filters.get(entity);
|
|
20408
|
+
if (view === void 0 || slots === void 0) return void 0;
|
|
20409
|
+
if (!slots.some((slot) => slot.filter.enabled)) return void 0;
|
|
20410
|
+
const record = kctx.state.byEntity.get(entity);
|
|
20411
|
+
return record === void 0 ? slotsEntry(slots, view.object.label) : recordEntry(kctx, record, view.object.label);
|
|
20412
|
+
}
|
|
20413
|
+
/**
|
|
20414
|
+
* Why every filtered view is drawn as it is, in draw order; a view outside the stage comes after those in it.
|
|
20415
|
+
*
|
|
20416
|
+
* @param kctx - The kept context.
|
|
20417
|
+
* @returns A fresh array, one entry per view with an enabled filter.
|
|
20418
|
+
*/
|
|
20419
|
+
function whyReport(kctx) {
|
|
20420
|
+
const sync = kctx.ctx.state.sync;
|
|
20421
|
+
const stage = kctx.host.stage();
|
|
20422
|
+
const order = /* @__PURE__ */ new Set();
|
|
20423
|
+
const entries = [];
|
|
20424
|
+
if (stage !== void 0) collectDrawOrder(stage, sync.entityOf, order);
|
|
20425
|
+
for (const entity of sync.filters.keys()) order.add(entity);
|
|
20426
|
+
for (const entity of order) {
|
|
20427
|
+
const entry = entryOf$1(kctx, entity, sync.views.get(entity));
|
|
20428
|
+
if (entry !== void 0) entries.push(entry);
|
|
20429
|
+
}
|
|
20430
|
+
return entries;
|
|
20431
|
+
}
|
|
20432
|
+
//#endregion
|
|
20003
20433
|
//#region src/plugins/renderer/kept/api.ts
|
|
20434
|
+
/** What `why()` answers in every build but an agent build. */
|
|
20435
|
+
const NO_WHY = Object.freeze([]);
|
|
20004
20436
|
/**
|
|
20005
20437
|
* The category a slot list lets the cache keep it under: the worst of its slots, `undefined` for an empty list, a
|
|
20006
20438
|
* `"screen"` slot or a slot that names none (a game's own slot is drawn live).
|
|
@@ -20045,6 +20477,16 @@ function renew(kctx, pixi, record) {
|
|
|
20045
20477
|
return true;
|
|
20046
20478
|
}
|
|
20047
20479
|
/**
|
|
20480
|
+
* Notes a change of a record's subtree, and who marked it.
|
|
20481
|
+
*
|
|
20482
|
+
* @param record - The record.
|
|
20483
|
+
* @param entity - The marked entity.
|
|
20484
|
+
*/
|
|
20485
|
+
function changed(record, entity) {
|
|
20486
|
+
record.dirtyS1 = true;
|
|
20487
|
+
record.markBy = entity;
|
|
20488
|
+
}
|
|
20489
|
+
/**
|
|
20048
20490
|
* Steps every record of a drawn frame, in the list's order (inner first): a record whose top changed is renewed, and
|
|
20049
20491
|
* its new record steps later in the same loop.
|
|
20050
20492
|
*
|
|
@@ -20152,15 +20594,15 @@ function createKeptApi(ctx, deps) {
|
|
|
20152
20594
|
const own = state.byTop.get(top);
|
|
20153
20595
|
if (own !== void 0) {
|
|
20154
20596
|
const demand = deps.demand;
|
|
20155
|
-
if (demand.visual().has(entity) || demand.loose().has(entity)) own
|
|
20597
|
+
if (demand.visual().has(entity) || demand.loose().has(entity)) changed(own, entity);
|
|
20156
20598
|
if (demand.published().has(entity)) {
|
|
20157
20599
|
own.dirtyS3 = true;
|
|
20158
|
-
if (view.kind === "Display" || view.kind === "adapter") own
|
|
20600
|
+
if (view.kind === "Display" || view.kind === "adapter") changed(own, entity);
|
|
20159
20601
|
}
|
|
20160
20602
|
}
|
|
20161
20603
|
for (let node = top.parent; node !== null; node = node.parent) {
|
|
20162
20604
|
const above = state.byTop.get(node);
|
|
20163
|
-
if (above !== void 0) above
|
|
20605
|
+
if (above !== void 0) changed(above, entity);
|
|
20164
20606
|
}
|
|
20165
20607
|
};
|
|
20166
20608
|
return {
|
|
@@ -20215,7 +20657,11 @@ function createKeptApi(ctx, deps) {
|
|
|
20215
20657
|
markAlphaDue(kctx, pixi);
|
|
20216
20658
|
stepRecords(kctx, pixi, matrices);
|
|
20217
20659
|
state.calm = false;
|
|
20218
|
-
} else for (const record of state.records)
|
|
20660
|
+
} else for (const record of state.records) {
|
|
20661
|
+
if (record.mode === "kept") live(record);
|
|
20662
|
+
record.why = WHY.off;
|
|
20663
|
+
record.calmIn = 0;
|
|
20664
|
+
}
|
|
20219
20665
|
flushRanges(kctx);
|
|
20220
20666
|
},
|
|
20221
20667
|
after: () => {
|
|
@@ -20237,12 +20683,25 @@ function createKeptApi(ctx, deps) {
|
|
|
20237
20683
|
stats: () => ({
|
|
20238
20684
|
pictures: state.drawnPictures,
|
|
20239
20685
|
mb: roundTo(state.bytes / BYTES_PER_MB$1, 2),
|
|
20240
|
-
retakes: state.takesWindow
|
|
20686
|
+
retakes: state.takesWindow,
|
|
20687
|
+
evicted: state.evictedWindow,
|
|
20688
|
+
refused: state.refusedWindow
|
|
20241
20689
|
}),
|
|
20690
|
+
why: () => {
|
|
20691
|
+
if (typeof __MOKU_GAME_AGENT__ !== "undefined" && __MOKU_GAME_AGENT__) return whyReport(kctx);
|
|
20692
|
+
return NO_WHY;
|
|
20693
|
+
},
|
|
20242
20694
|
drainTakes: () => {
|
|
20243
20695
|
const takes = state.takesOpen;
|
|
20244
20696
|
state.takesWindow = takes;
|
|
20245
20697
|
state.takesOpen = 0;
|
|
20698
|
+
state.evictedWindow = state.frameEvicted;
|
|
20699
|
+
state.frameEvicted = 0;
|
|
20700
|
+
state.refusedWindow = state.frameRefused;
|
|
20701
|
+
state.frameRefused = 0;
|
|
20702
|
+
state.windowStart = state.windowNext;
|
|
20703
|
+
state.windowEnd = state.frame;
|
|
20704
|
+
state.windowNext = state.frame + 1;
|
|
20246
20705
|
return takes;
|
|
20247
20706
|
},
|
|
20248
20707
|
drainRefreshes: () => {
|
|
@@ -20433,42 +20892,6 @@ function stopDemand(state) {
|
|
|
20433
20892
|
state.verify.reference = void 0;
|
|
20434
20893
|
}
|
|
20435
20894
|
//#endregion
|
|
20436
|
-
//#region src/plugins/renderer/reasons.ts
|
|
20437
|
-
/**
|
|
20438
|
-
* @file renderer plugin — the reasons a frame is drawn, in ring order: the monitor stores a reason by its index. A
|
|
20439
|
-
* plain module of the plugin root, so the monitor reads the order without importing the demand module's run-time code
|
|
20440
|
-
* (L1); `DemandReason` in `demand/types.ts` is derived from it.
|
|
20441
|
-
*/
|
|
20442
|
-
/**
|
|
20443
|
-
* Every reason in ring order: the monitor stores the index (spec 11 `FrameColumns.reason`), 255 for a frame without a
|
|
20444
|
-
* decision. New reasons are only ever appended (block 3B: `"overlay"`, `"retake"` after `"none"`), so stored indices
|
|
20445
|
-
* keep their meaning. There is no whole-frame reason for `renderer.invalidate`: it always names an entity
|
|
20446
|
-
* (LEAD-FIXES-4). A root export, so a reader of the ring names a reason without building a record.
|
|
20447
|
-
*
|
|
20448
|
-
* @example
|
|
20449
|
-
* ```ts
|
|
20450
|
-
* // An overlay names why the newest frame of a debug build was drawn: a piece moved, a counted change mark.
|
|
20451
|
-
* const ring = app.renderer.monitor.frames();
|
|
20452
|
-
* DEMAND_REASONS[ring.columns.reason[ring.newest] ?? 255]; // "mark"
|
|
20453
|
-
* ```
|
|
20454
|
-
*/
|
|
20455
|
-
const DEMAND_REASONS = [
|
|
20456
|
-
"always",
|
|
20457
|
-
"first",
|
|
20458
|
-
"resize",
|
|
20459
|
-
"restore",
|
|
20460
|
-
"layers",
|
|
20461
|
-
"debug",
|
|
20462
|
-
"wake",
|
|
20463
|
-
"capture",
|
|
20464
|
-
"request",
|
|
20465
|
-
"mark",
|
|
20466
|
-
"verify",
|
|
20467
|
-
"none",
|
|
20468
|
-
"overlay",
|
|
20469
|
-
"retake"
|
|
20470
|
-
];
|
|
20471
|
-
//#endregion
|
|
20472
20895
|
//#region src/plugins/renderer/monitor/log-types.ts
|
|
20473
20896
|
/**
|
|
20474
20897
|
* The version every line carries as `v`.
|
|
@@ -20646,7 +21069,8 @@ const COUNT = {
|
|
|
20646
21069
|
marks: 7,
|
|
20647
21070
|
rebuilds: 8,
|
|
20648
21071
|
targetsCreated: 9,
|
|
20649
|
-
targetsDestroyed: 10
|
|
21072
|
+
targetsDestroyed: 10,
|
|
21073
|
+
canvas: 11
|
|
20650
21074
|
};
|
|
20651
21075
|
/**
|
|
20652
21076
|
* What this application measures, as bits of `PerfState.measuring`. Not public.
|
|
@@ -21403,7 +21827,8 @@ function createPasses(capacity) {
|
|
|
21403
21827
|
kind2: new Uint8Array(capacity),
|
|
21404
21828
|
drawsAt: new Uint16Array(capacity),
|
|
21405
21829
|
format: Array.from({ length: capacity }).fill(null),
|
|
21406
|
-
resolution: new Float32Array(capacity).fill(NaN)
|
|
21830
|
+
resolution: new Float32Array(capacity).fill(NaN),
|
|
21831
|
+
restart: new Uint8Array(capacity)
|
|
21407
21832
|
};
|
|
21408
21833
|
}
|
|
21409
21834
|
/**
|
|
@@ -21614,6 +22039,7 @@ function writePass(passes, frame, index, kind, stencil, width, height, label) {
|
|
|
21614
22039
|
passes.drawsAt[slot] = 0;
|
|
21615
22040
|
passes.format[slot] = null;
|
|
21616
22041
|
passes.resolution[slot] = NaN;
|
|
22042
|
+
passes.restart[slot] = 0;
|
|
21617
22043
|
passes.newest = slot;
|
|
21618
22044
|
passes.size = Math.min(passes.size + 1, passes.capacity);
|
|
21619
22045
|
passes.written = sequence + 1;
|
|
@@ -21833,7 +22259,7 @@ function splitDraws(found, total) {
|
|
|
21833
22259
|
/**
|
|
21834
22260
|
* The render passes of a frame still in the pass ring, in their order, with their detail: the entity whose filter drew
|
|
21835
22261
|
* each and its view's label, the filter kind, the draws, the target's format and resolution, whether it was a kept
|
|
21836
|
-
* picture's.
|
|
22262
|
+
* picture's, and for a canvas pass why it began.
|
|
21837
22263
|
*
|
|
21838
22264
|
* @param ring - The ring.
|
|
21839
22265
|
* @param frame - The frame number.
|
|
@@ -21853,6 +22279,7 @@ function passesOf$1(ring, frame, total = NaN, viewOf = () => null) {
|
|
|
21853
22279
|
const label = passes.label[slot] ?? null;
|
|
21854
22280
|
const owner = cellU32(passes.owner, slot);
|
|
21855
22281
|
const kind2 = cellU8(passes.kind2, slot);
|
|
22282
|
+
const restart = CANVAS_RESTARTS[cellU8(passes.restart, slot)] ?? "none";
|
|
21856
22283
|
found.unshift({
|
|
21857
22284
|
index: cellU8(passes.index, slot),
|
|
21858
22285
|
kind: PASS_KINDS[cellU8(passes.kind, slot)] ?? "texture",
|
|
@@ -21867,7 +22294,8 @@ function passesOf$1(ring, frame, total = NaN, viewOf = () => null) {
|
|
|
21867
22294
|
draws: cellU16(passes.drawsAt, slot),
|
|
21868
22295
|
format: passes.format[slot] ?? null,
|
|
21869
22296
|
resolution: measured(cellF32(passes.resolution, slot)),
|
|
21870
|
-
kept: label?.startsWith(KEPT_PREFIX) === true
|
|
22297
|
+
kept: label?.startsWith(KEPT_PREFIX) === true,
|
|
22298
|
+
...restart === "none" ? {} : { restart }
|
|
21871
22299
|
});
|
|
21872
22300
|
}
|
|
21873
22301
|
splitDraws(found, total);
|
|
@@ -22495,6 +22923,11 @@ function createMonitorState(config) {
|
|
|
22495
22923
|
open: 0,
|
|
22496
22924
|
max: 0
|
|
22497
22925
|
},
|
|
22926
|
+
canvas: {
|
|
22927
|
+
last: 0,
|
|
22928
|
+
open: 0,
|
|
22929
|
+
max: 0
|
|
22930
|
+
},
|
|
22498
22931
|
passDetach: []
|
|
22499
22932
|
};
|
|
22500
22933
|
}
|
|
@@ -24392,6 +24825,20 @@ function writeDetail(pc, target, kind) {
|
|
|
24392
24825
|
writePassDetail(pc.perf.ring.passes, filter ? sinks.filterOwner : 0, filter ? sinks.filterKind + 1 : 0, sinks.draws.frame, target.colorTexture?.source);
|
|
24393
24826
|
}
|
|
24394
24827
|
/**
|
|
24828
|
+
* Writes why the canvas pass just begun began into its slot of the pass ring: the counting encoder wrote the slot when
|
|
24829
|
+
* the pass began, before the lazy canvas pass told the monitor. Only while the slot was written: with the `passes`
|
|
24830
|
+
* section off the newest slot is an older pass's.
|
|
24831
|
+
*
|
|
24832
|
+
* @param pc - The perf context.
|
|
24833
|
+
* @param restart - The reason, an index into `CANVAS_RESTARTS`.
|
|
24834
|
+
*/
|
|
24835
|
+
function noteRestart(pc, restart) {
|
|
24836
|
+
const { sinks } = pc;
|
|
24837
|
+
if (sinks.passes === void 0 || (sinks.sections & SECTION.passes) === 0) return;
|
|
24838
|
+
const { passes } = pc.perf.ring;
|
|
24839
|
+
passes.restart[passes.newest] = restart;
|
|
24840
|
+
}
|
|
24841
|
+
/**
|
|
24395
24842
|
* Creates the WebGPU pass sink the counting encoder calls: each pass of a frame goes into the pass ring, with the
|
|
24396
24843
|
* frame number and its index in the frame, while the `passes` section is on, and gets the timer's timestamp writes
|
|
24397
24844
|
* when there is a timer and the `gpu` section is on (a pass the ring does not keep has the number -1).
|
|
@@ -24419,8 +24866,9 @@ function createPassSink(pc, timer, canvas) {
|
|
|
24419
24866
|
/**
|
|
24420
24867
|
* Counts the WebGL passes of every frame on Pixi's public runners: a target change emitted by `bind` is one pass; at
|
|
24421
24868
|
* `renderStart` (added after Pixi's systems, so the root is bound by then) the root is one pass when `bind` emitted
|
|
24422
|
-
* nothing, because the previous render call ended on the root.
|
|
24423
|
-
* also writes each pass into the ring of an agent build. Stencil is
|
|
24869
|
+
* nothing, because the previous render call ended on the root. A pass on the canvas counts as a canvas pass too. Only
|
|
24870
|
+
* inside a frame. Every build counts (F8); `record` also writes each pass into the ring of an agent build. Stencil is
|
|
24871
|
+
* not measured on WebGL.
|
|
24424
24872
|
*
|
|
24425
24873
|
* @param renderer - Pixi's WebGL renderer.
|
|
24426
24874
|
* @param sinks - The sinks the count goes into.
|
|
@@ -24438,6 +24886,7 @@ function countGlPasses(renderer, sinks, record) {
|
|
|
24438
24886
|
const { counts } = sinks;
|
|
24439
24887
|
const index = cellF64(counts, COUNT.passes);
|
|
24440
24888
|
counts[COUNT.passes] = index + 1;
|
|
24889
|
+
if (target.isRoot) counts[COUNT.canvas] = cellF64(counts, COUNT.canvas) + 1;
|
|
24441
24890
|
record?.(target, index);
|
|
24442
24891
|
};
|
|
24443
24892
|
const prerender = {
|
|
@@ -25200,7 +25649,7 @@ function openWindow(state) {
|
|
|
25200
25649
|
}
|
|
25201
25650
|
/**
|
|
25202
25651
|
* Turns the open window into the reported numbers and opens the next one: the most passes of a
|
|
25203
|
-
* frame in it become `renderPassesMax`.
|
|
25652
|
+
* frame in it become `renderPassesMax`, the most canvas passes `canvasPassesMax`.
|
|
25204
25653
|
*
|
|
25205
25654
|
* @param state - The monitor branch of the plugin state.
|
|
25206
25655
|
*/
|
|
@@ -25212,6 +25661,8 @@ function closeWindow(state) {
|
|
|
25212
25661
|
state.rebuilds = state.rebuildsOpen * WINDOW_MS / state.windowMs;
|
|
25213
25662
|
state.passes.max = state.passes.open;
|
|
25214
25663
|
state.passes.open = 0;
|
|
25664
|
+
state.canvas.max = state.canvas.open;
|
|
25665
|
+
state.canvas.open = 0;
|
|
25215
25666
|
openWindow(state);
|
|
25216
25667
|
}
|
|
25217
25668
|
/**
|
|
@@ -25275,6 +25726,9 @@ function resetWindow(state) {
|
|
|
25275
25726
|
state.passes.last = 0;
|
|
25276
25727
|
state.passes.open = 0;
|
|
25277
25728
|
state.passes.max = 0;
|
|
25729
|
+
state.canvas.last = 0;
|
|
25730
|
+
state.canvas.open = 0;
|
|
25731
|
+
state.canvas.max = 0;
|
|
25278
25732
|
}
|
|
25279
25733
|
//#endregion
|
|
25280
25734
|
//#region src/plugins/renderer/monitor/api.ts
|
|
@@ -25328,7 +25782,7 @@ function takesResolution(value) {
|
|
|
25328
25782
|
function createMonitorApi(ctx, deps) {
|
|
25329
25783
|
const state = ctx.state.monitor;
|
|
25330
25784
|
const clock = ctx.deps.clock;
|
|
25331
|
-
const { passes, sinks } = state;
|
|
25785
|
+
const { canvas, passes, sinks } = state;
|
|
25332
25786
|
const mctx = {
|
|
25333
25787
|
ctx,
|
|
25334
25788
|
deps
|
|
@@ -25347,18 +25801,42 @@ function createMonitorApi(ctx, deps) {
|
|
|
25347
25801
|
*/
|
|
25348
25802
|
const measured = (counted) => sinks.measuring && counted > 0 ? counted : deps.sync.renderPasses();
|
|
25349
25803
|
/**
|
|
25350
|
-
*
|
|
25351
|
-
*
|
|
25352
|
-
*
|
|
25804
|
+
* A measured canvas pass number, or the estimate of the filter slots where nothing counted one: headless, a test
|
|
25805
|
+
* stage, a canvas with multisampling, which Pixi begins itself.
|
|
25806
|
+
*
|
|
25807
|
+
* @param counted - The measured number; 0 before a counter saw one.
|
|
25808
|
+
* @returns The number `stats()` reports.
|
|
25809
|
+
*/
|
|
25810
|
+
const measuredCanvas = (counted) => counted > 0 ? counted : deps.sync.canvasPasses();
|
|
25811
|
+
/**
|
|
25812
|
+
* Hears a canvas pass that really began on WebGPU, in every build: one increment inside a frame, and in an agent
|
|
25813
|
+
* build its reason in the pass ring. Made once: `host/render-pass.ts` calls it through the host's state.
|
|
25814
|
+
*
|
|
25815
|
+
* @param restart - The reason, an index into `CANVAS_RESTARTS`.
|
|
25816
|
+
*/
|
|
25817
|
+
const canvasBegan = (restart) => {
|
|
25818
|
+
if (!sinks.inFrame) return;
|
|
25819
|
+
sinks.counts[COUNT.canvas] = cellF64(sinks.counts, COUNT.canvas) + 1;
|
|
25820
|
+
if (typeof __MOKU_GAME_AGENT__ !== "undefined" && __MOKU_GAME_AGENT__ && pc !== void 0) noteRestart(pc, restart);
|
|
25821
|
+
};
|
|
25822
|
+
/**
|
|
25823
|
+
* Closes the pass counts of a frame: a drawn frame whose passes a counter saw is the new `renderPasses` and
|
|
25824
|
+
* `canvasPasses`; a skipped frame keeps the numbers. The frame closes here, except in an agent build, whose commit
|
|
25825
|
+
* closes it after the record is written.
|
|
25353
25826
|
*
|
|
25354
25827
|
* @param drawn - True when the render phase drew the frame.
|
|
25355
25828
|
*/
|
|
25356
25829
|
const notePasses = (drawn) => {
|
|
25357
25830
|
const count = cellF64(sinks.counts, COUNT.passes);
|
|
25831
|
+
const canvasCount = cellF64(sinks.counts, COUNT.canvas);
|
|
25358
25832
|
if (drawn && count > 0) {
|
|
25359
25833
|
passes.last = count;
|
|
25360
25834
|
passes.open = Math.max(passes.open, count);
|
|
25361
25835
|
}
|
|
25836
|
+
if (drawn && canvasCount > 0) {
|
|
25837
|
+
canvas.last = canvasCount;
|
|
25838
|
+
canvas.open = Math.max(canvas.open, canvasCount);
|
|
25839
|
+
}
|
|
25362
25840
|
if (pc === void 0) sinks.inFrame = false;
|
|
25363
25841
|
};
|
|
25364
25842
|
/**
|
|
@@ -25392,6 +25870,8 @@ function createMonitorApi(ctx, deps) {
|
|
|
25392
25870
|
pooled: counts.pooled,
|
|
25393
25871
|
renderPasses: measured(passes.last),
|
|
25394
25872
|
renderPassesMax: measured(passes.max),
|
|
25873
|
+
canvasPasses: measuredCanvas(canvas.last),
|
|
25874
|
+
canvasPassesMax: measuredCanvas(canvas.max),
|
|
25395
25875
|
kept: deps.kept.stats()
|
|
25396
25876
|
};
|
|
25397
25877
|
if ((typeof __MOKU_GAME_DEV__ === "undefined" || !__MOKU_GAME_DEV__) && (typeof __MOKU_GAME_AGENT__ === "undefined" || !__MOKU_GAME_AGENT__)) return stats;
|
|
@@ -25448,6 +25928,7 @@ function createMonitorApi(ctx, deps) {
|
|
|
25448
25928
|
if (beginStaged(state)) deps.kept.drainTakes();
|
|
25449
25929
|
state.draws.frame = 0;
|
|
25450
25930
|
sinks.counts[COUNT.passes] = 0;
|
|
25931
|
+
sinks.counts[COUNT.canvas] = 0;
|
|
25451
25932
|
sinks.inFrame = true;
|
|
25452
25933
|
if (typeof __MOKU_GAME_AGENT__ !== "undefined" && __MOKU_GAME_AGENT__ && pc !== void 0) openFrame(pc.sinks);
|
|
25453
25934
|
},
|
|
@@ -25473,6 +25954,7 @@ function createMonitorApi(ctx, deps) {
|
|
|
25473
25954
|
}
|
|
25474
25955
|
},
|
|
25475
25956
|
attachPasses: () => {
|
|
25957
|
+
deps.host.onCanvasPass(canvasBegan);
|
|
25476
25958
|
if (typeof __MOKU_GAME_AGENT__ !== "undefined" && __MOKU_GAME_AGENT__) return;
|
|
25477
25959
|
for (const off of state.passDetach) off();
|
|
25478
25960
|
state.passDetach.length = 0;
|
|
@@ -26352,6 +26834,39 @@ function countFiltered(state, kept) {
|
|
|
26352
26834
|
walk.kept = void 0;
|
|
26353
26835
|
for (let index = cache.count; index < before; index += 1) cache.filters[index] = void 0;
|
|
26354
26836
|
}
|
|
26837
|
+
/** What the count of the views drawn live reads while it walks the filters: set before the walk, one at a time. */
|
|
26838
|
+
const breaks = {
|
|
26839
|
+
sync: void 0,
|
|
26840
|
+
count: 0
|
|
26841
|
+
};
|
|
26842
|
+
/**
|
|
26843
|
+
* Adds a view drawn live with an enabled filter to the walk's count: it breaks the canvas pass once. A view drawn from
|
|
26844
|
+
* its kept picture is hidden for the stage pass, and so is what hangs inside it: neither is drawn.
|
|
26845
|
+
*
|
|
26846
|
+
* @param slots - The filters of the view.
|
|
26847
|
+
* @param entity - The entity.
|
|
26848
|
+
*/
|
|
26849
|
+
function addBreak(slots, entity) {
|
|
26850
|
+
const { sync } = breaks;
|
|
26851
|
+
if (sync?.root === void 0) return;
|
|
26852
|
+
if (isDrawn(sync.views.get(entity), sync.root) && passesOf(slots) > 0) breaks.count += 1;
|
|
26853
|
+
}
|
|
26854
|
+
/**
|
|
26855
|
+
* The canvas passes of a frame where nothing counts them: 1 for the frame, plus one break for every view drawn live
|
|
26856
|
+
* under the root with an enabled filter, by the walk of `renderPassesOf`. Counted at every call, not through the cache
|
|
26857
|
+
* of `renderPassesOf`, which a take does not move: `stats()` reads it, never a frame.
|
|
26858
|
+
*
|
|
26859
|
+
* @param state - The sync branch of the plugin state.
|
|
26860
|
+
* @returns The canvas passes; 0 while inert.
|
|
26861
|
+
*/
|
|
26862
|
+
function canvasPassesOf(state) {
|
|
26863
|
+
if (state.root === void 0) return 0;
|
|
26864
|
+
breaks.sync = state;
|
|
26865
|
+
breaks.count = 0;
|
|
26866
|
+
state.filters.forEach(addBreak);
|
|
26867
|
+
breaks.sync = void 0;
|
|
26868
|
+
return 1 + breaks.count;
|
|
26869
|
+
}
|
|
26355
26870
|
/**
|
|
26356
26871
|
* Tells whether a filter of the count was switched on or off since, by its field alone.
|
|
26357
26872
|
*
|
|
@@ -34220,6 +34735,7 @@ function createSyncApi(ctx, deps) {
|
|
|
34220
34735
|
}
|
|
34221
34736
|
},
|
|
34222
34737
|
overlays: () => overlayReports(sctx),
|
|
34738
|
+
why: () => deps.kept.why(),
|
|
34223
34739
|
state: () => ({
|
|
34224
34740
|
...state.debug,
|
|
34225
34741
|
verifyFrames: deps.demand.verifying(),
|
|
@@ -34237,6 +34753,7 @@ function createSyncApi(ctx, deps) {
|
|
|
34237
34753
|
drop: () => dropLeave(sctx)
|
|
34238
34754
|
},
|
|
34239
34755
|
renderPasses: () => renderPassesOf(state, ctx.state.kept),
|
|
34756
|
+
canvasPasses: () => canvasPassesOf(state),
|
|
34240
34757
|
root: () => state.root,
|
|
34241
34758
|
layerContainer: (name) => layerContainer(state, name),
|
|
34242
34759
|
layerOf: (entity) => layerOf$1(sctx, entity),
|
|
@@ -49957,7 +50474,7 @@ function bake(ectx, id) {
|
|
|
49957
50474
|
}
|
|
49958
50475
|
textures.push(texture);
|
|
49959
50476
|
}
|
|
49960
|
-
const baked = bakeEmitter(definition, isDev
|
|
50477
|
+
const baked = bakeEmitter(definition, isDev() ? firstSource(ectx, id, keys, textures) : textures);
|
|
49961
50478
|
state.baked.set(id, baked);
|
|
49962
50479
|
return baked;
|
|
49963
50480
|
}
|
|
@@ -51830,14 +52347,6 @@ const Pointer = /*#__PURE__*/ resource("Pointer", pointerDefaults);
|
|
|
51830
52347
|
//#endregion
|
|
51831
52348
|
//#region src/plugins/input/lost.ts
|
|
51832
52349
|
/**
|
|
51833
|
-
* Tells whether the dev log is on: a dev build, `__MOKU_GAME_DEV__` defined true.
|
|
51834
|
-
*
|
|
51835
|
-
* @returns True in a dev build.
|
|
51836
|
-
*/
|
|
51837
|
-
function dev() {
|
|
51838
|
-
return typeof __MOKU_GAME_DEV__ !== "undefined" && __MOKU_GAME_DEV__;
|
|
51839
|
-
}
|
|
51840
|
-
/**
|
|
51841
52350
|
* Logs a press that wore the press look of a button and will not be a tap. Only a pressed view
|
|
51842
52351
|
* that carries `Tappable` (or left the world during the press) is told; a press caught by a
|
|
51843
52352
|
* scroll was the scroll's from its start, and a view without a tap has nothing to lose.
|
|
@@ -51846,7 +52355,7 @@ function dev() {
|
|
|
51846
52355
|
* @param reason - Why the press is lost.
|
|
51847
52356
|
*/
|
|
51848
52357
|
function lostPress(ctx, reason) {
|
|
51849
|
-
if (!
|
|
52358
|
+
if (!(typeof __MOKU_GAME_DEV__ !== "undefined" && __MOKU_GAME_DEV__ || typeof __MOKU_GAME_AGENT__ !== "undefined" && __MOKU_GAME_AGENT__)) return;
|
|
51850
52359
|
const { entity, caught, key } = ctx.state;
|
|
51851
52360
|
if (entity === void 0 || caught) return;
|
|
51852
52361
|
if (reason !== "view-gone" && !ctx.deps.world.ecs.has(entity, Tappable)) return;
|
|
@@ -51857,9 +52366,10 @@ function lostPress(ctx, reason) {
|
|
|
51857
52366
|
}
|
|
51858
52367
|
/**
|
|
51859
52368
|
* Logs an answer the gate did not take. A closed gate holds it for the next gate, so that is told
|
|
51860
|
-
* at debug level only
|
|
51861
|
-
* the gate said: `no-edge`, the resting node does not list the
|
|
51862
|
-
* dropped it and names no `blocked`; `blocked`, it answered the
|
|
52369
|
+
* at debug level only; `flow` warns `flow:answer-dropped` when no gate takes the held answer.
|
|
52370
|
+
* Otherwise the line says what the gate said: `no-edge`, the resting node does not list the
|
|
52371
|
+
* intent; `refused`, a guide's narrow dropped it and names no `blocked`; `blocked`, it answered the
|
|
52372
|
+
* guide's `blocked` in its place.
|
|
51863
52373
|
*
|
|
51864
52374
|
* @param ctx - Domain context of the input plugin.
|
|
51865
52375
|
* @param entity - The view the answer came from.
|
|
@@ -51870,7 +52380,7 @@ function lostPress(ctx, reason) {
|
|
|
51870
52380
|
* @param blocked - Whether the guide's `blocked` was taken in the answer's place.
|
|
51871
52381
|
*/
|
|
51872
52382
|
function lostAnswer(ctx, entity, answer, gate, blocked) {
|
|
51873
|
-
if (!
|
|
52383
|
+
if (!(typeof __MOKU_GAME_DEV__ !== "undefined" && __MOKU_GAME_DEV__ || typeof __MOKU_GAME_AGENT__ !== "undefined" && __MOKU_GAME_AGENT__)) return;
|
|
51874
52384
|
const view = ctx.deps.world.projection.keyOf(entity) ?? entity;
|
|
51875
52385
|
if (!gate.open && !blocked) {
|
|
51876
52386
|
ctx.log.debug("input: counted, the gate is closed: held for the next gate", {
|
|
@@ -52027,8 +52537,8 @@ function notifyTap(ctx, entity) {
|
|
|
52027
52537
|
* A press the narrow of a guide drops — another intent, or the allowed intent with another
|
|
52028
52538
|
* payload (a drop on the wrong cell) — answers the guide's `blocked` instead, once, when the gate
|
|
52029
52539
|
* is open and the guide names one. A closed gate holds the press as it is and converts nothing.
|
|
52030
|
-
* The gate's state is read only for a refused answer, never for an accepted one. A dev
|
|
52031
|
-
* the refusal with the view and what the gate said (F122).
|
|
52540
|
+
* The gate's state is read only for a refused answer, never for an accepted one. A dev or agent
|
|
52541
|
+
* build logs the refusal with the view and what the gate said (F122).
|
|
52032
52542
|
*
|
|
52033
52543
|
* @param ctx - Domain context of the input plugin.
|
|
52034
52544
|
* @param entity - The view the answer came from, for the warning.
|
|
@@ -54820,7 +55330,7 @@ function playHaptic(ctx, provider, kind) {
|
|
|
54820
55330
|
safely(ctx.log, "haptic", () => provider.haptic(kind));
|
|
54821
55331
|
return;
|
|
54822
55332
|
}
|
|
54823
|
-
if (!isDev
|
|
55333
|
+
if (!isDev() || ctx.state.warned.has(kind)) return;
|
|
54824
55334
|
ctx.state.warned.add(kind);
|
|
54825
55335
|
ctx.log.warn("platform: unknown haptic kind", { kind });
|
|
54826
55336
|
}
|
|
@@ -70975,4 +71485,4 @@ const screen = [
|
|
|
70975
71485
|
uiPlugin
|
|
70976
71486
|
];
|
|
70977
71487
|
//#endregion
|
|
70978
|
-
export { sfx as $,
|
|
71488
|
+
export { sfx as $, worldPlugin as $t, types_exports$10 as A, Glow as At, defineMotion as B, Animation as Bt, types_exports$3 as C, messageDuration as Ct, types_exports$7 as D, Blur as Dt, types_exports$6 as E, Alpha as Et, types_exports$15 as F, audioPlugin as Ft, external as G, MONITOR_SECTIONS as Gt, platformPlugin as H, rendererPlugin as Ht, types_exports$16 as I, scenesPlugin as It, mark as J, PERF_LOG_VERSION as Jt, frames as K, PERF_CAUSES as Kt, types_exports$17 as L, assetsPlugin as Lt, types_exports$12 as M, Outline as Mt, types_exports$13 as N, defineFilter as Nt, types_exports$8 as O, ColorMatrix as Ot, types_exports$14 as P, debugPlugin as Pt, set as Q, DEMAND_REASONS as Qt, uiPlugin as R, animPlugin as Rt, types_exports$2 as S, messageArgument as St, types_exports$5 as T, Emitter as Tt, HAPTIC_KINDS as U, PASS_KINDS as Ut, textPlugin as V, Frames as Vt, defineAnimation as W, frameAt as Wt, play$1 as X, SHADER_WHATS as Xt, parallel as Y, PROBLEM_RULES as Yt, sequence as Z, CANVAS_RESTARTS as Zt, defineBundles as _, Tappable as _t, cubicBezier as a, to as an, use as at, types_exports as b, Traced as bt, hint as c, SaveUnreadableError as cn, Draggable as ct, defineScene as d, clockPlugin as dn, Hovered as dt, flowPlugin as en, spawn as et, tr as f, Pointer as ft, music as g, Swipeable as gt, defineEmitter as h, Pressed as ht, screen as i, slot as in, tween as it, types_exports$11 as j, Noise as jt, types_exports$9 as k, Displacement as kt, schedule as l, lifecyclePlugin as ln, DropTarget as lt, flattenFeatures as m, Pressable as mt, createPlugin as n, contribution as nn, stagger as nt, defineEffect as o, type as on, wait as ot, defineFeature as p, PointerOver as pt, haptic as q, PERF_GAP_BUCKETS as qt, defineGame as r, exit as rn, stopSfx as rt, guide as s, modelPlugin as sn, inputPlugin as st, createApp as t, refuseStart as tn, spawned as tt, projection as u, timePlugin as un, Held as ut, load as v, Touchable as vt, types_exports$4 as w, effectsPlugin as wt, types_exports$1 as x, i18nPlugin as xt, ready as y, Traceable as yt, resolve as z, AnimPlayer as zt };
|