@playcanvas/inspector 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -4
- package/package.json +2 -2
- package/src/asset-view.js +65 -2
- package/src/camera-view.js +1 -1
- package/src/describe.js +1 -1
- package/src/inspector.js +368 -48
- package/src/layer-view.js +235 -0
- package/src/mcp-tools.js +6 -3
- package/src/memory-view.js +59 -3
- package/src/mesh-view.js +50 -1
- package/src/ref-registry.js +2 -1
- package/src/render-target-view.js +75 -1
- package/src/shader-view.js +32 -1
- package/src/snapshot-view.js +268 -0
- package/src/styles.js +261 -0
- package/src/texture-view.js +1 -1
- package/src/treemap-view.js +837 -0
- package/types/asset-view.d.ts +10 -0
- package/types/inspector.d.ts +147 -2
- package/types/layer-view.d.ts +80 -0
- package/types/memory-view.d.ts +11 -0
- package/types/mesh-view.d.ts +13 -0
- package/types/render-target-view.d.ts +12 -0
- package/types/shader-view.d.ts +12 -0
- package/types/snapshot-view.d.ts +166 -0
- package/types/texture-view.d.ts +12 -1
- package/types/treemap-view.d.ts +379 -0
package/types/asset-view.d.ts
CHANGED
|
@@ -10,6 +10,15 @@ export const ASSET_SORTS: string[][];
|
|
|
10
10
|
* @returns {ListRow[]} The rows.
|
|
11
11
|
*/
|
|
12
12
|
export function assetRows(registry: AssetRegistry | null, sort: string): ListRow[];
|
|
13
|
+
/**
|
|
14
|
+
* What the Assets tab measures in a snapshot: the file of every asset whose size is known, by type.
|
|
15
|
+
* A descriptor from a project manifest gives the size; for a file loaded from a plain url, it is
|
|
16
|
+
* the size the browser timed downloading. The sub-assets of a container are part of its file.
|
|
17
|
+
*
|
|
18
|
+
* @param {AssetRegistry|null} registry - The registry.
|
|
19
|
+
* @returns {SnapshotContent} The files measured.
|
|
20
|
+
*/
|
|
21
|
+
export function assetSnapshot(registry: AssetRegistry | null): SnapshotContent;
|
|
13
22
|
/**
|
|
14
23
|
* The components referencing an asset, found by walking the scene: neither the asset nor the
|
|
15
24
|
* registry tracks who uses it.
|
|
@@ -93,6 +102,7 @@ export function resourceAssets(registry: AssetRegistry | null): Map<object, Asse
|
|
|
93
102
|
export function stateName(asset: Asset): string;
|
|
94
103
|
import type { AssetRegistry } from 'playcanvas';
|
|
95
104
|
import type { ListRow } from './list-view.js';
|
|
105
|
+
import type { SnapshotContent } from './snapshot-view.js';
|
|
96
106
|
import type { AppBase } from 'playcanvas';
|
|
97
107
|
import { Asset } from 'playcanvas';
|
|
98
108
|
import type { Entity } from 'playcanvas';
|
package/types/inspector.d.ts
CHANGED
|
@@ -370,7 +370,9 @@ export class Inspector {
|
|
|
370
370
|
/** @private */
|
|
371
371
|
private _nextPropertyRefresh;
|
|
372
372
|
/**
|
|
373
|
-
*
|
|
373
|
+
* The tab shown: one of the fixed tabs, or a treemap tab, by its id.
|
|
374
|
+
*
|
|
375
|
+
* @type {'hierarchy'|'cameras'|'layers'|'assets'|'passes'|'perf'|'targets'|'textures'|'meshes'|'materials'|'scripts'|'memory'|'shaders'|'physics'|`treemap${number}`}
|
|
374
376
|
* @private
|
|
375
377
|
*/
|
|
376
378
|
private _tab;
|
|
@@ -581,6 +583,70 @@ export class Inspector {
|
|
|
581
583
|
* @private
|
|
582
584
|
*/
|
|
583
585
|
private _cameraList;
|
|
586
|
+
/**
|
|
587
|
+
* @type {ListView}
|
|
588
|
+
* @private
|
|
589
|
+
*/
|
|
590
|
+
private _layerList;
|
|
591
|
+
/**
|
|
592
|
+
* The layers hidden from the Layers tab, each turned off until shown again, reset or the panel
|
|
593
|
+
* closes. A layer the app turns back on itself meanwhile is left to it.
|
|
594
|
+
*
|
|
595
|
+
* @type {Set<Layer>}
|
|
596
|
+
* @private
|
|
597
|
+
*/
|
|
598
|
+
private _hiddenLayers;
|
|
599
|
+
/**
|
|
600
|
+
* The snapshots captured on each tab that takes them, kept here rather than with the panel's
|
|
601
|
+
* elements, which are built again when the panel docks back from its own window.
|
|
602
|
+
*
|
|
603
|
+
* @type {Map<string, SnapshotList>}
|
|
604
|
+
* @private
|
|
605
|
+
*/
|
|
606
|
+
private _snapshots;
|
|
607
|
+
/**
|
|
608
|
+
* The snapshots section of each tab that takes them, by tab.
|
|
609
|
+
*
|
|
610
|
+
* @type {Record<string, SnapshotPanel>}
|
|
611
|
+
* @private
|
|
612
|
+
*/
|
|
613
|
+
private _snapshotPanels;
|
|
614
|
+
/**
|
|
615
|
+
* The treemap tabs open, by id, each showing a snapshot or two compared, with the tab the
|
|
616
|
+
* snapshots came from. Kept here, so the tabs are built again with the panel.
|
|
617
|
+
*
|
|
618
|
+
* @type {Map<string, { source: string, key: string, data: TreemapData, view: TreemapView|null }>}
|
|
619
|
+
* @private
|
|
620
|
+
*/
|
|
621
|
+
private _treemapTabs;
|
|
622
|
+
/**
|
|
623
|
+
* The number the id of the next treemap tab takes.
|
|
624
|
+
*
|
|
625
|
+
* @type {number}
|
|
626
|
+
* @private
|
|
627
|
+
*/
|
|
628
|
+
private _nextTreemap;
|
|
629
|
+
/**
|
|
630
|
+
* The tab bar.
|
|
631
|
+
*
|
|
632
|
+
* @type {HTMLElement}
|
|
633
|
+
* @private
|
|
634
|
+
*/
|
|
635
|
+
private _tabsEl;
|
|
636
|
+
/**
|
|
637
|
+
* The body of the panel: the tabs over the properties.
|
|
638
|
+
*
|
|
639
|
+
* @type {HTMLElement}
|
|
640
|
+
* @private
|
|
641
|
+
*/
|
|
642
|
+
private _bodyEl;
|
|
643
|
+
/**
|
|
644
|
+
* The button on the Layers tab that shows the hidden layers again.
|
|
645
|
+
*
|
|
646
|
+
* @type {HTMLButtonElement}
|
|
647
|
+
* @private
|
|
648
|
+
*/
|
|
649
|
+
private _showLayersBtn;
|
|
584
650
|
/**
|
|
585
651
|
* The render mode applied from the Cameras tab.
|
|
586
652
|
*
|
|
@@ -764,6 +830,14 @@ export class Inspector {
|
|
|
764
830
|
* @private
|
|
765
831
|
*/
|
|
766
832
|
private _cameraModel;
|
|
833
|
+
/**
|
|
834
|
+
* Model builder for the property view when a layer is selected.
|
|
835
|
+
*
|
|
836
|
+
* @param {Layer} layer - The layer.
|
|
837
|
+
* @returns {PropertySection[]} The sections.
|
|
838
|
+
* @private
|
|
839
|
+
*/
|
|
840
|
+
private _layerModel;
|
|
767
841
|
/**
|
|
768
842
|
* Model builder for the property view when a script class is selected.
|
|
769
843
|
*
|
|
@@ -1347,6 +1421,42 @@ export class Inspector {
|
|
|
1347
1421
|
* @private
|
|
1348
1422
|
*/
|
|
1349
1423
|
private _updateFilterHint;
|
|
1424
|
+
/**
|
|
1425
|
+
* Builds the snapshots section of a tab, over the snapshots the tab already has.
|
|
1426
|
+
*
|
|
1427
|
+
* @param {string} tab - The tab.
|
|
1428
|
+
* @param {string} title - Its name.
|
|
1429
|
+
* @param {() => SnapshotContent} measure - Measures what the tab shows, now.
|
|
1430
|
+
* @returns {HTMLElement} The section.
|
|
1431
|
+
* @private
|
|
1432
|
+
*/
|
|
1433
|
+
private _snapshotSection;
|
|
1434
|
+
/**
|
|
1435
|
+
* Shows a treemap of snapshots in a tab of its own, added at the end of the tab bar, or switches
|
|
1436
|
+
* to the tab already showing them. Several can be open at once.
|
|
1437
|
+
*
|
|
1438
|
+
* @param {string} source - The tab the snapshots were captured on.
|
|
1439
|
+
* @param {TreemapData} data - The snapshots.
|
|
1440
|
+
* @returns {string} The id of the treemap's tab.
|
|
1441
|
+
* @private
|
|
1442
|
+
*/
|
|
1443
|
+
private _showTreemap;
|
|
1444
|
+
/**
|
|
1445
|
+
* Builds the button and the panel of a treemap tab. The button's cross closes the tab, as does
|
|
1446
|
+
* a middle click on it.
|
|
1447
|
+
*
|
|
1448
|
+
* @param {string} id - The tab's id.
|
|
1449
|
+
* @param {{ data: TreemapData, view: TreemapView|null }} tab - The tab.
|
|
1450
|
+
* @private
|
|
1451
|
+
*/
|
|
1452
|
+
private _addTreemapTab;
|
|
1453
|
+
/**
|
|
1454
|
+
* Closes a treemap tab, going back to the tab its snapshots came from when it was shown.
|
|
1455
|
+
*
|
|
1456
|
+
* @param {string} id - The tab's id.
|
|
1457
|
+
* @private
|
|
1458
|
+
*/
|
|
1459
|
+
private _closeTreemap;
|
|
1350
1460
|
/**
|
|
1351
1461
|
* @param {HTMLElement} parent - The bar to add the toggle to.
|
|
1352
1462
|
* @param {string} label - The label.
|
|
@@ -1415,7 +1525,7 @@ export class Inspector {
|
|
|
1415
1525
|
/**
|
|
1416
1526
|
* Switches the list tab and points the property view at that tab's selection.
|
|
1417
1527
|
*
|
|
1418
|
-
* @param {'hierarchy'|'cameras'|'assets'|'passes'|'perf'|'targets'|'textures'|'meshes'|'materials'|'scripts'|'memory'|'shaders'|'physics'} tab - The tab.
|
|
1528
|
+
* @param {'hierarchy'|'cameras'|'layers'|'assets'|'passes'|'perf'|'targets'|'textures'|'meshes'|'materials'|'scripts'|'memory'|'shaders'|'physics'|`treemap${number}`} tab - The tab.
|
|
1419
1529
|
* @private
|
|
1420
1530
|
*/
|
|
1421
1531
|
private _setTab;
|
|
@@ -1547,11 +1657,20 @@ export class Inspector {
|
|
|
1547
1657
|
* @private
|
|
1548
1658
|
*/
|
|
1549
1659
|
private _showPass;
|
|
1660
|
+
/**
|
|
1661
|
+
* @param {*} target - An object.
|
|
1662
|
+
* @returns {'hierarchy'|'targets'|'passes'|'textures'|'shaders'|'assets'|'scripts'|'layers'|'materials'|'meshes'|'memory'|null}
|
|
1663
|
+
* The tab that lists objects of its kind, or null when none does.
|
|
1664
|
+
* @private
|
|
1665
|
+
*/
|
|
1666
|
+
private _tabOf;
|
|
1550
1667
|
/**
|
|
1551
1668
|
* Reveals a linked object in the tab that lists it: nodes in the hierarchy, passes in the frame
|
|
1552
1669
|
* graph, render targets in their list.
|
|
1553
1670
|
*
|
|
1554
1671
|
* @param {*} target - The object.
|
|
1672
|
+
* @returns {boolean} Whether the tab lists it, as one listing what is on the device does not
|
|
1673
|
+
* once the object is destroyed.
|
|
1555
1674
|
* @private
|
|
1556
1675
|
*/
|
|
1557
1676
|
private _selectAny;
|
|
@@ -1671,6 +1790,32 @@ export class Inspector {
|
|
|
1671
1790
|
* @private
|
|
1672
1791
|
*/
|
|
1673
1792
|
private _endViewportModes;
|
|
1793
|
+
/**
|
|
1794
|
+
* Hides a layer from the view by turning it off, or turns a layer hidden here back on. Only a
|
|
1795
|
+
* layer the app has on can be hidden, so showing it again restores what the app had.
|
|
1796
|
+
*
|
|
1797
|
+
* @param {Layer} layer - The layer.
|
|
1798
|
+
* @param {boolean} hidden - Whether to hide it.
|
|
1799
|
+
* @private
|
|
1800
|
+
*/
|
|
1801
|
+
private _hideLayer;
|
|
1802
|
+
/**
|
|
1803
|
+
* Turns every layer hidden here back on.
|
|
1804
|
+
*
|
|
1805
|
+
* @private
|
|
1806
|
+
*/
|
|
1807
|
+
private _showHiddenLayers;
|
|
1808
|
+
/**
|
|
1809
|
+
* Forgets the hidden layers the app has turned back on itself, or taken out of the composition,
|
|
1810
|
+
* so the panel never turns on a layer it no longer hides.
|
|
1811
|
+
*
|
|
1812
|
+
* @private
|
|
1813
|
+
*/
|
|
1814
|
+
private _pruneHiddenLayers;
|
|
1815
|
+
/**
|
|
1816
|
+
* @private
|
|
1817
|
+
*/
|
|
1818
|
+
private _afterLayersChanged;
|
|
1674
1819
|
/**
|
|
1675
1820
|
* Puts back the shader pass each camera had before the panel changed it, and turns wireframe
|
|
1676
1821
|
* off.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One entry of the composition: a layer's opaque or transparent half, which the composition orders
|
|
3
|
+
* on its own, so a layer's halves can render far apart.
|
|
4
|
+
*/
|
|
5
|
+
export type SubLayer = {
|
|
6
|
+
/**
|
|
7
|
+
* - The layer.
|
|
8
|
+
*/
|
|
9
|
+
layer: Layer;
|
|
10
|
+
/**
|
|
11
|
+
* - Whether it is the transparent half.
|
|
12
|
+
*/
|
|
13
|
+
transparent: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* - Whether the composition renders it: the layer and the half enabled.
|
|
16
|
+
*/
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* - Its place in the composition.
|
|
20
|
+
*/
|
|
21
|
+
index: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* What the Layers tab offers on a layer, supplied by the inspector.
|
|
25
|
+
*/
|
|
26
|
+
export type LayerActions = {
|
|
27
|
+
/**
|
|
28
|
+
* - Hides the layer from the view, or shows
|
|
29
|
+
* it again.
|
|
30
|
+
*/
|
|
31
|
+
hide: (layer: Layer, hidden: boolean) => void;
|
|
32
|
+
/**
|
|
33
|
+
* - Whether the inspector hides the layer.
|
|
34
|
+
*/
|
|
35
|
+
hidden: (layer: Layer) => boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Everything the property view shows for a layer: where its halves render in the composition, how
|
|
39
|
+
* each sorts, the cameras rendering it with what each drew of it last frame, its lights and its mesh
|
|
40
|
+
* instances, and a way to hide it from the view.
|
|
41
|
+
*
|
|
42
|
+
* @param {Layer} layer - The layer.
|
|
43
|
+
* @param {{ app: AppBase, layerActions: LayerActions }} ctx - The app, and what the tab offers.
|
|
44
|
+
* @returns {PropertySection[]} The sections.
|
|
45
|
+
*/
|
|
46
|
+
export function buildLayerModel(layer: Layer, ctx: {
|
|
47
|
+
app: AppBase;
|
|
48
|
+
layerActions: LayerActions;
|
|
49
|
+
}): PropertySection[];
|
|
50
|
+
/**
|
|
51
|
+
* One entry of the composition: a layer's opaque or transparent half, which the composition orders
|
|
52
|
+
* on its own, so a layer's halves can render far apart.
|
|
53
|
+
*
|
|
54
|
+
* @typedef {object} SubLayer
|
|
55
|
+
* @property {Layer} layer - The layer.
|
|
56
|
+
* @property {boolean} transparent - Whether it is the transparent half.
|
|
57
|
+
* @property {boolean} enabled - Whether the composition renders it: the layer and the half enabled.
|
|
58
|
+
* @property {number} index - Its place in the composition.
|
|
59
|
+
* @ignore
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* The entries of the composition, in the order it renders them.
|
|
63
|
+
*
|
|
64
|
+
* @param {LayerComposition|null|undefined} composition - The scene's composition.
|
|
65
|
+
* @returns {SubLayer[]} The entries.
|
|
66
|
+
*/
|
|
67
|
+
export function collectSubLayers(composition: LayerComposition | null | undefined): SubLayer[];
|
|
68
|
+
/**
|
|
69
|
+
* One row per entry of the composition, in render order, dimmed when it does not render.
|
|
70
|
+
*
|
|
71
|
+
* @param {AppBase} app - The app.
|
|
72
|
+
* @param {(layer: Layer) => boolean} [hidden] - Whether the inspector hides a layer.
|
|
73
|
+
* @returns {ListRow[]} The rows.
|
|
74
|
+
*/
|
|
75
|
+
export function layerRows(app: AppBase, hidden?: (layer: Layer) => boolean): ListRow[];
|
|
76
|
+
import type { Layer } from 'playcanvas';
|
|
77
|
+
import type { AppBase } from 'playcanvas';
|
|
78
|
+
import type { PropertySection } from './model.js';
|
|
79
|
+
import type { LayerComposition } from 'playcanvas';
|
|
80
|
+
import type { ListRow } from './list-view.js';
|
package/types/memory-view.d.ts
CHANGED
|
@@ -79,6 +79,16 @@ export namespace KIND_NAMES {
|
|
|
79
79
|
* @returns {ListRow[]} The rows.
|
|
80
80
|
*/
|
|
81
81
|
export function memoryRows(device: GraphicsDevice, owners: Map<Buffer, BufferOwner[]>): ListRow[];
|
|
82
|
+
/**
|
|
83
|
+
* What the Memory tab measures in a snapshot: every texture and buffer on the device, a group per
|
|
84
|
+
* kind. Textures are split by whether they are attached to a render target, and each buffer is
|
|
85
|
+
* named after what uses it, as in the list. The per-draw uniform pool counts as one.
|
|
86
|
+
*
|
|
87
|
+
* @param {GraphicsDevice} device - The device.
|
|
88
|
+
* @param {Map<Buffer, BufferOwner[]>} owners - The owners of each buffer.
|
|
89
|
+
* @returns {SnapshotContent} The textures and buffers measured.
|
|
90
|
+
*/
|
|
91
|
+
export function memorySnapshot(device: GraphicsDevice, owners: Map<Buffer, BufferOwner[]>): SnapshotContent;
|
|
82
92
|
/**
|
|
83
93
|
* @param {GraphNode|null} node - The node a mesh instance draws at.
|
|
84
94
|
* @returns {string} Its name, after its parent's when it has one below the root: imported models
|
|
@@ -100,3 +110,4 @@ import type { AppBase } from 'playcanvas';
|
|
|
100
110
|
import type { PropertySection } from './model.js';
|
|
101
111
|
import type { GraphicsDevice } from 'playcanvas';
|
|
102
112
|
import type { ListRow } from './list-view.js';
|
|
113
|
+
import type { SnapshotContent } from './snapshot-view.js';
|
package/types/mesh-view.d.ts
CHANGED
|
@@ -75,6 +75,17 @@ export function meshListRows(survey: MeshSurvey): ListRow[];
|
|
|
75
75
|
* @returns {string} The note, or an empty string when every vertex buffer is accounted for.
|
|
76
76
|
*/
|
|
77
77
|
export function meshNote(survey: MeshSurvey): string;
|
|
78
|
+
/**
|
|
79
|
+
* What the Meshes tab measures in a snapshot: the vertex and index buffers of every mesh found, a
|
|
80
|
+
* group per asset holding the meshes, and for meshes of no asset, a group per way they were found.
|
|
81
|
+
* A model file loads as a container with a render asset per mesh, so meshes are grouped by the
|
|
82
|
+
* container's file rather than by those.
|
|
83
|
+
*
|
|
84
|
+
* @param {MeshSurvey} survey - The meshes found.
|
|
85
|
+
* @param {AssetRegistry|null} registry - The registry, to find the containers.
|
|
86
|
+
* @returns {SnapshotContent} The meshes measured.
|
|
87
|
+
*/
|
|
88
|
+
export function meshSnapshot(survey: MeshSurvey, registry: AssetRegistry | null): SnapshotContent;
|
|
78
89
|
/**
|
|
79
90
|
* Finds the meshes of the app. Nothing keeps a list of them, so they are found through what uses
|
|
80
91
|
* them: the mesh instances of the components and layers, see {@link collectMeshInstances}; the
|
|
@@ -94,3 +105,5 @@ import { Mesh } from 'playcanvas';
|
|
|
94
105
|
import type { AppBase } from 'playcanvas';
|
|
95
106
|
import type { PropertySection } from './model.js';
|
|
96
107
|
import type { ListRow } from './list-view.js';
|
|
108
|
+
import type { AssetRegistry } from 'playcanvas';
|
|
109
|
+
import type { SnapshotContent } from './snapshot-view.js';
|
|
@@ -82,6 +82,17 @@ export function previewSupport(texture: Texture | null, device: GraphicsDevice):
|
|
|
82
82
|
* @returns {ListRow[]} The rows.
|
|
83
83
|
*/
|
|
84
84
|
export function renderTargetRows(device: GraphicsDevice, frame: FrameSnapshot | null): ListRow[];
|
|
85
|
+
/**
|
|
86
|
+
* What the Render targets tab measures in a snapshot: the GPU memory of every target's
|
|
87
|
+
* attachments, a group per target. A texture attached to several targets, such as a depth buffer
|
|
88
|
+
* shared by passes or a target per mip level, is counted once, under the first. Buffers the device
|
|
89
|
+
* keeps for a target without a texture to measure, such as the multisampled buffers it resolves
|
|
90
|
+
* from, an internal depth buffer and the swap chain, are estimated from their dimensions.
|
|
91
|
+
*
|
|
92
|
+
* @param {GraphicsDevice} device - The device.
|
|
93
|
+
* @returns {SnapshotContent} The attachments measured.
|
|
94
|
+
*/
|
|
95
|
+
export function renderTargetSnapshot(device: GraphicsDevice): SnapshotContent;
|
|
85
96
|
/**
|
|
86
97
|
* Whether a texture holds its rows bottom-up, as a render target with the bottom origin stores
|
|
87
98
|
* them, or with the native origin on WebGL2. The texture renderer shows row 0 at the top, so such
|
|
@@ -100,3 +111,4 @@ import type { GraphicsDevice } from 'playcanvas';
|
|
|
100
111
|
import type { FrameSnapshot } from './frame-graph-view.js';
|
|
101
112
|
import type { PropertySection } from './model.js';
|
|
102
113
|
import type { ListRow } from './list-view.js';
|
|
114
|
+
import type { SnapshotContent } from './snapshot-view.js';
|
package/types/shader-view.d.ts
CHANGED
|
@@ -37,6 +37,17 @@ export function formatUniformBuffer(format: UniformBufferFormat): string;
|
|
|
37
37
|
* @returns {ListRow[]} The rows.
|
|
38
38
|
*/
|
|
39
39
|
export function shaderRows(device: GraphicsDevice): ListRow[];
|
|
40
|
+
/**
|
|
41
|
+
* What the Shaders tab measures in a snapshot: the length of every shader's source, as the
|
|
42
|
+
* preprocessor left it, in a group per family. The engine names the variants it generates after
|
|
43
|
+
* their generator, then their pass, such as 'standard-forward-proc', so the family is the name up
|
|
44
|
+
* to its first dash; and the treemap shows how many variants each family made, as well as their
|
|
45
|
+
* size.
|
|
46
|
+
*
|
|
47
|
+
* @param {GraphicsDevice} device - The device.
|
|
48
|
+
* @returns {SnapshotContent} The shaders measured.
|
|
49
|
+
*/
|
|
50
|
+
export function shaderSnapshot(device: GraphicsDevice): SnapshotContent;
|
|
40
51
|
/**
|
|
41
52
|
* @param {Shader} shader - A shader.
|
|
42
53
|
* @returns {string} The compilation state: 'failed', 'ready' or 'compiling'.
|
|
@@ -48,3 +59,4 @@ import type { GraphicsDevice } from 'playcanvas';
|
|
|
48
59
|
import type { BindGroupFormat } from 'playcanvas';
|
|
49
60
|
import type { UniformBufferFormat } from 'playcanvas';
|
|
50
61
|
import type { ListRow } from './list-view.js';
|
|
62
|
+
import type { SnapshotContent } from './snapshot-view.js';
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a tab measures when a snapshot of it is captured.
|
|
3
|
+
*/
|
|
4
|
+
export type SnapshotContent = {
|
|
5
|
+
/**
|
|
6
|
+
* - What the sizes are, in a few words, such as 'GPU memory'.
|
|
7
|
+
*/
|
|
8
|
+
measure: string;
|
|
9
|
+
/**
|
|
10
|
+
* - What was measured.
|
|
11
|
+
*/
|
|
12
|
+
items: SnapshotItem[];
|
|
13
|
+
/**
|
|
14
|
+
* - What the items leave out, such as assets of unknown size.
|
|
15
|
+
*/
|
|
16
|
+
note?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A snapshot of a tab: what it measured at one moment, kept to be drawn as a treemap later.
|
|
20
|
+
*/
|
|
21
|
+
export type Snapshot = {
|
|
22
|
+
/**
|
|
23
|
+
* - Its number among the snapshots of its tab, from 1. Never reused.
|
|
24
|
+
*/
|
|
25
|
+
number: number;
|
|
26
|
+
/**
|
|
27
|
+
* - When it was captured, in milliseconds since the epoch.
|
|
28
|
+
*/
|
|
29
|
+
time: number;
|
|
30
|
+
/**
|
|
31
|
+
* - What the sizes are.
|
|
32
|
+
*/
|
|
33
|
+
measure: string;
|
|
34
|
+
/**
|
|
35
|
+
* - What was measured.
|
|
36
|
+
*/
|
|
37
|
+
items: SnapshotItem[];
|
|
38
|
+
/**
|
|
39
|
+
* - What the items leave out, or an empty string.
|
|
40
|
+
*/
|
|
41
|
+
note: string;
|
|
42
|
+
/**
|
|
43
|
+
* - The sum of the sizes of the items.
|
|
44
|
+
*/
|
|
45
|
+
total: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The snapshots of one tab. The inspector keeps them, so they survive the panel being built
|
|
49
|
+
* again when it docks back from its own window.
|
|
50
|
+
*/
|
|
51
|
+
export type SnapshotList = {
|
|
52
|
+
/**
|
|
53
|
+
* - The snapshots, oldest first.
|
|
54
|
+
*/
|
|
55
|
+
snapshots: Snapshot[];
|
|
56
|
+
/**
|
|
57
|
+
* - The numbers of the snapshots ticked.
|
|
58
|
+
*/
|
|
59
|
+
ticked: Set<number>;
|
|
60
|
+
/**
|
|
61
|
+
* - The number the next snapshot takes.
|
|
62
|
+
*/
|
|
63
|
+
next: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The snapshots section of a tab: a bar to capture, compare and delete snapshots, over the list of
|
|
67
|
+
* them. Each opens as a treemap in a tab of its own; ticking two and comparing opens one treemap
|
|
68
|
+
* marking what changed between them. A snapshot is taken only when asked, rather than on every
|
|
69
|
+
* refresh, so it holds still to be read and compared.
|
|
70
|
+
*
|
|
71
|
+
* @ignore
|
|
72
|
+
*/
|
|
73
|
+
export class SnapshotPanel {
|
|
74
|
+
/**
|
|
75
|
+
* @param {SnapshotList} state - The tab's snapshots.
|
|
76
|
+
* @param {string} title - The name of the tab.
|
|
77
|
+
* @param {() => SnapshotContent} measure - Measures the tab now.
|
|
78
|
+
* @param {(data: TreemapData) => void} show - Shows a treemap, in a tab of its own.
|
|
79
|
+
*/
|
|
80
|
+
constructor(state: SnapshotList, title: string, measure: () => SnapshotContent, show: (data: TreemapData) => void);
|
|
81
|
+
/**
|
|
82
|
+
* The section, placed under the tab's own list.
|
|
83
|
+
*
|
|
84
|
+
* @type {HTMLElement}
|
|
85
|
+
*/
|
|
86
|
+
el: HTMLElement;
|
|
87
|
+
/**
|
|
88
|
+
* The snapshots, kept by the inspector.
|
|
89
|
+
*
|
|
90
|
+
* @type {SnapshotList}
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
private _state;
|
|
94
|
+
/**
|
|
95
|
+
* The name of the tab, such as 'Memory'.
|
|
96
|
+
*
|
|
97
|
+
* @type {string}
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
private _title;
|
|
101
|
+
/**
|
|
102
|
+
* Measures the tab now.
|
|
103
|
+
*
|
|
104
|
+
* @type {() => SnapshotContent}
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
private _measure;
|
|
108
|
+
/**
|
|
109
|
+
* Shows a treemap, in a tab of its own.
|
|
110
|
+
*
|
|
111
|
+
* @type {(data: TreemapData) => void}
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
private _show;
|
|
115
|
+
/**
|
|
116
|
+
* @type {ListView}
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
private _list;
|
|
120
|
+
/**
|
|
121
|
+
* @type {Record<'capture'|'compare'|'delete'|'deleteAll', HTMLButtonElement>}
|
|
122
|
+
* @private
|
|
123
|
+
*/
|
|
124
|
+
private _buttons;
|
|
125
|
+
/**
|
|
126
|
+
* Says what the section is for, while it has no snapshots.
|
|
127
|
+
*
|
|
128
|
+
* @type {HTMLElement}
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
private _hint;
|
|
132
|
+
/**
|
|
133
|
+
* Captures a snapshot of the tab and adds it to the list.
|
|
134
|
+
*
|
|
135
|
+
* @returns {Snapshot} The snapshot.
|
|
136
|
+
*/
|
|
137
|
+
capture(): Snapshot;
|
|
138
|
+
/**
|
|
139
|
+
* Opens the two ticked snapshots as one treemap, the earlier compared against the later.
|
|
140
|
+
*/
|
|
141
|
+
compare(): void;
|
|
142
|
+
/**
|
|
143
|
+
* Opens a snapshot as a treemap in a tab of its own, or two compared.
|
|
144
|
+
*
|
|
145
|
+
* @param {Snapshot} snapshot - The snapshot, or the later of the two compared.
|
|
146
|
+
* @param {Snapshot} [before] - The earlier snapshot to compare it against.
|
|
147
|
+
*/
|
|
148
|
+
open(snapshot: Snapshot, before?: Snapshot): void;
|
|
149
|
+
/**
|
|
150
|
+
* Deletes snapshots.
|
|
151
|
+
*
|
|
152
|
+
* @param {number[]} numbers - The numbers of the snapshots.
|
|
153
|
+
*/
|
|
154
|
+
delete(numbers: number[]): void;
|
|
155
|
+
/**
|
|
156
|
+
* Brings the list and the buttons up to date with the snapshots.
|
|
157
|
+
*/
|
|
158
|
+
refresh(): void;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @returns {SnapshotList} A list with no snapshots yet.
|
|
162
|
+
* @ignore
|
|
163
|
+
*/
|
|
164
|
+
export function createSnapshotList(): SnapshotList;
|
|
165
|
+
import type { SnapshotItem } from './treemap-view.js';
|
|
166
|
+
import type { TreemapData } from './treemap-view.js';
|
package/types/texture-view.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {GraphicsDevice} device - The device.
|
|
3
|
+
* @returns {Map<Texture, RenderTarget[]>} The render targets each attached texture belongs to.
|
|
4
|
+
*/
|
|
5
|
+
export function attachmentTargets(device: GraphicsDevice): Map<Texture, RenderTarget[]>;
|
|
1
6
|
/**
|
|
2
7
|
* Everything the property view shows for a texture: its storage, the render targets it is attached
|
|
3
8
|
* to (linked), and every other public property.
|
|
@@ -19,6 +24,11 @@ export function buildTextureModel(texture: Texture, ctx: {
|
|
|
19
24
|
* @returns {Texture[]} The textures.
|
|
20
25
|
*/
|
|
21
26
|
export function collectTextures(device: GraphicsDevice): Texture[];
|
|
27
|
+
/**
|
|
28
|
+
* @param {Texture} texture - A texture.
|
|
29
|
+
* @returns {string} Its dimensions, with the shape when it is not a plain 2D texture.
|
|
30
|
+
*/
|
|
31
|
+
export function shapeText(texture: Texture): string;
|
|
22
32
|
/**
|
|
23
33
|
* One row per texture on the device, largest first, tagged when it is a render target attachment.
|
|
24
34
|
*
|
|
@@ -26,8 +36,9 @@ export function collectTextures(device: GraphicsDevice): Texture[];
|
|
|
26
36
|
* @returns {ListRow[]} The rows.
|
|
27
37
|
*/
|
|
28
38
|
export function textureRows(device: GraphicsDevice): ListRow[];
|
|
29
|
-
import type { Texture } from 'playcanvas';
|
|
30
39
|
import type { GraphicsDevice } from 'playcanvas';
|
|
40
|
+
import type { Texture } from 'playcanvas';
|
|
41
|
+
import type { RenderTarget } from 'playcanvas';
|
|
31
42
|
import type { AppBase } from 'playcanvas';
|
|
32
43
|
import type { PropertySection } from './model.js';
|
|
33
44
|
import type { ListRow } from './list-view.js';
|