@forgeax/engine-rhi-debug 0.0.0-dev.8d955ade1c79
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/LICENSE +202 -0
- package/README.md +178 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/bootstrap-integration.test.d.ts +2 -0
- package/dist/__tests__/bootstrap-integration.test.d.ts.map +1 -0
- package/dist/__tests__/consumer-inventory.unit.test.d.ts +2 -0
- package/dist/__tests__/consumer-inventory.unit.test.d.ts.map +1 -0
- package/dist/__tests__/copy-src-usage-validity.dawn.test.d.ts +15 -0
- package/dist/__tests__/copy-src-usage-validity.dawn.test.d.ts.map +1 -0
- package/dist/__tests__/coverage-invariant.test-d.d.ts +2 -0
- package/dist/__tests__/coverage-invariant.test-d.d.ts.map +1 -0
- package/dist/__tests__/coverage-invariant.unit.test.d.ts +2 -0
- package/dist/__tests__/coverage-invariant.unit.test.d.ts.map +1 -0
- package/dist/__tests__/e2e.browser.test.d.ts +2 -0
- package/dist/__tests__/e2e.browser.test.d.ts.map +1 -0
- package/dist/__tests__/error-code-narrowing.test-d.d.ts +2 -0
- package/dist/__tests__/error-code-narrowing.test-d.d.ts.map +1 -0
- package/dist/__tests__/errors-v7.test-d.d.ts +2 -0
- package/dist/__tests__/errors-v7.test-d.d.ts.map +1 -0
- package/dist/__tests__/errors-v7.unit.test.d.ts +2 -0
- package/dist/__tests__/errors-v7.unit.test.d.ts.map +1 -0
- package/dist/__tests__/errors.unit.test.d.ts +2 -0
- package/dist/__tests__/errors.unit.test.d.ts.map +1 -0
- package/dist/__tests__/event-semantics-coverage.unit.test.d.ts +2 -0
- package/dist/__tests__/event-semantics-coverage.unit.test.d.ts.map +1 -0
- package/dist/__tests__/format-info.unit.test.d.ts +2 -0
- package/dist/__tests__/format-info.unit.test.d.ts.map +1 -0
- package/dist/__tests__/frame-model-parity.test-d.d.ts +2 -0
- package/dist/__tests__/frame-model-parity.test-d.d.ts.map +1 -0
- package/dist/__tests__/frame-model-parity.unit.test.d.ts +2 -0
- package/dist/__tests__/frame-model-parity.unit.test.d.ts.map +1 -0
- package/dist/__tests__/guard-gates.test.d.ts +2 -0
- package/dist/__tests__/guard-gates.test.d.ts.map +1 -0
- package/dist/__tests__/public-surface.integration.test.d.ts +2 -0
- package/dist/__tests__/public-surface.integration.test.d.ts.map +1 -0
- package/dist/__tests__/readback-fault-cleanup.unit.test.d.ts +2 -0
- package/dist/__tests__/readback-fault-cleanup.unit.test.d.ts.map +1 -0
- package/dist/__tests__/readback-format-matrix.dawn.test.d.ts +2 -0
- package/dist/__tests__/readback-format-matrix.dawn.test.d.ts.map +1 -0
- package/dist/__tests__/readback-format-matrix.unit.test.d.ts +2 -0
- package/dist/__tests__/readback-format-matrix.unit.test.d.ts.map +1 -0
- package/dist/__tests__/readback-matrix-fixture.d.ts +32 -0
- package/dist/__tests__/readback-matrix-fixture.d.ts.map +1 -0
- package/dist/__tests__/recorder-bootstrap.unit.test.d.ts +2 -0
- package/dist/__tests__/recorder-bootstrap.unit.test.d.ts.map +1 -0
- package/dist/__tests__/recorder-budget.unit.test.d.ts +2 -0
- package/dist/__tests__/recorder-budget.unit.test.d.ts.map +1 -0
- package/dist/__tests__/recorder-fail-fast.unit.test.d.ts +2 -0
- package/dist/__tests__/recorder-fail-fast.unit.test.d.ts.map +1 -0
- package/dist/__tests__/recorder-lifecycle.unit.test.d.ts +2 -0
- package/dist/__tests__/recorder-lifecycle.unit.test.d.ts.map +1 -0
- package/dist/__tests__/recorder-push-event.unit.test.d.ts +2 -0
- package/dist/__tests__/recorder-push-event.unit.test.d.ts.map +1 -0
- package/dist/__tests__/recorder-session.integration.test.d.ts +2 -0
- package/dist/__tests__/recorder-session.integration.test.d.ts.map +1 -0
- package/dist/__tests__/recorder-session.unit.test.d.ts +2 -0
- package/dist/__tests__/recorder-session.unit.test.d.ts.map +1 -0
- package/dist/__tests__/recorder-steady-frame.dawn.test.d.ts +2 -0
- package/dist/__tests__/recorder-steady-frame.dawn.test.d.ts.map +1 -0
- package/dist/__tests__/replay-fail-fast.unit.test.d.ts +2 -0
- package/dist/__tests__/replay-fail-fast.unit.test.d.ts.map +1 -0
- package/dist/__tests__/replay-session.dawn.test.d.ts +2 -0
- package/dist/__tests__/replay-session.dawn.test.d.ts.map +1 -0
- package/dist/__tests__/replay-session.test-d.d.ts +2 -0
- package/dist/__tests__/replay-session.test-d.d.ts.map +1 -0
- package/dist/__tests__/replay-session.unit.test.d.ts +2 -0
- package/dist/__tests__/replay-session.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resolve-texture-descriptor.unit.test.d.ts +2 -0
- package/dist/__tests__/resolve-texture-descriptor.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resource-lifecycle.unit.test.d.ts +2 -0
- package/dist/__tests__/resource-lifecycle.unit.test.d.ts.map +1 -0
- package/dist/__tests__/rhi-debug-fresh-replay.dawn.test.d.ts +2 -0
- package/dist/__tests__/rhi-debug-fresh-replay.dawn.test.d.ts.map +1 -0
- package/dist/__tests__/tape-index.unit.test.d.ts +2 -0
- package/dist/__tests__/tape-index.unit.test.d.ts.map +1 -0
- package/dist/__tests__/tape-v7-invalid.unit.test.d.ts +2 -0
- package/dist/__tests__/tape-v7-invalid.unit.test.d.ts.map +1 -0
- package/dist/__tests__/tape-v7-roundtrip.unit.test.d.ts +2 -0
- package/dist/__tests__/tape-v7-roundtrip.unit.test.d.ts.map +1 -0
- package/dist/__tests__/tape-v7-version.unit.test.d.ts +2 -0
- package/dist/__tests__/tape-v7-version.unit.test.d.ts.map +1 -0
- package/dist/__tests__/tree-shake.unit.test.d.ts +2 -0
- package/dist/__tests__/tree-shake.unit.test.d.ts.map +1 -0
- package/dist/__tests__/types.test.d.ts +2 -0
- package/dist/__tests__/types.test.d.ts.map +1 -0
- package/dist/browser.d.ts +45 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.mjs +83 -0
- package/dist/browser.mjs.map +1 -0
- package/dist/errors.d.ts +85 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/frame-model.d.ts +158 -0
- package/dist/frame-model.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +10415 -0
- package/dist/index.mjs.map +1 -0
- package/dist/protocol/codec.d.ts +6 -0
- package/dist/protocol/codec.d.ts.map +1 -0
- package/dist/protocol/event-semantics.d.ts +15 -0
- package/dist/protocol/event-semantics.d.ts.map +1 -0
- package/dist/protocol/tape-index.d.ts +30 -0
- package/dist/protocol/tape-index.d.ts.map +1 -0
- package/dist/protocol/types.d.ts +44 -0
- package/dist/protocol/types.d.ts.map +1 -0
- package/dist/protocol/validation.d.ts +7 -0
- package/dist/protocol/validation.d.ts.map +1 -0
- package/dist/readback.d.ts +156 -0
- package/dist/readback.d.ts.map +1 -0
- package/dist/recorder/assemble.d.ts +11 -0
- package/dist/recorder/assemble.d.ts.map +1 -0
- package/dist/recorder/closure.d.ts +39 -0
- package/dist/recorder/closure.d.ts.map +1 -0
- package/dist/recorder/core.d.ts +296 -0
- package/dist/recorder/core.d.ts.map +1 -0
- package/dist/recorder/device.d.ts +4 -0
- package/dist/recorder/device.d.ts.map +1 -0
- package/dist/recorder/encoder.d.ts +5 -0
- package/dist/recorder/encoder.d.ts.map +1 -0
- package/dist/recorder/lifecycle.d.ts +20 -0
- package/dist/recorder/lifecycle.d.ts.map +1 -0
- package/dist/recorder/pass.d.ts +6 -0
- package/dist/recorder/pass.d.ts.map +1 -0
- package/dist/recorder/proxy.d.ts +19 -0
- package/dist/recorder/proxy.d.ts.map +1 -0
- package/dist/recorder/queue.d.ts +4 -0
- package/dist/recorder/queue.d.ts.map +1 -0
- package/dist/recorder/resource-registry.d.ts +15 -0
- package/dist/recorder/resource-registry.d.ts.map +1 -0
- package/dist/recorder/session.d.ts +25 -0
- package/dist/recorder/session.d.ts.map +1 -0
- package/dist/recorder/shader.d.ts +3 -0
- package/dist/recorder/shader.d.ts.map +1 -0
- package/dist/recorder/snapshot.d.ts +10 -0
- package/dist/recorder/snapshot.d.ts.map +1 -0
- package/dist/recorder/wrap.d.ts +4 -0
- package/dist/recorder/wrap.d.ts.map +1 -0
- package/dist/recorder.d.ts +7 -0
- package/dist/recorder.d.ts.map +1 -0
- package/dist/replay/device-request.d.ts +8 -0
- package/dist/replay/device-request.d.ts.map +1 -0
- package/dist/replay/execute-support.d.ts +33 -0
- package/dist/replay/execute-support.d.ts.map +1 -0
- package/dist/replay/execute.d.ts +18 -0
- package/dist/replay/execute.d.ts.map +1 -0
- package/dist/replay/readback.d.ts +32 -0
- package/dist/replay/readback.d.ts.map +1 -0
- package/dist/replay/resources.d.ts +57 -0
- package/dist/replay/resources.d.ts.map +1 -0
- package/dist/replay/session.d.ts +49 -0
- package/dist/replay/session.d.ts.map +1 -0
- package/dist/replay/texture-format.d.ts +21 -0
- package/dist/replay/texture-format.d.ts.map +1 -0
- package/dist/texel-decode.d.ts +35 -0
- package/dist/texel-decode.d.ts.map +1 -0
- package/dist/texel-layout.d.ts +76 -0
- package/dist/texel-layout.d.ts.map +1 -0
- package/dist/types.d.ts +722 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +72 -0
- package/src/__tests__/bootstrap-integration.test.ts +268 -0
- package/src/__tests__/consumer-inventory.unit.test.ts +154 -0
- package/src/__tests__/copy-src-usage-validity.dawn.test.ts +117 -0
- package/src/__tests__/coverage-invariant.test-d.ts +115 -0
- package/src/__tests__/coverage-invariant.unit.test.ts +45 -0
- package/src/__tests__/e2e.browser.test.ts +239 -0
- package/src/__tests__/error-code-narrowing.test-d.ts +32 -0
- package/src/__tests__/errors-v7.test-d.ts +19 -0
- package/src/__tests__/errors-v7.unit.test.ts +15 -0
- package/src/__tests__/errors.unit.test.ts +83 -0
- package/src/__tests__/event-semantics-coverage.unit.test.ts +22 -0
- package/src/__tests__/format-info.unit.test.ts +85 -0
- package/src/__tests__/frame-model-parity.test-d.ts +20 -0
- package/src/__tests__/frame-model-parity.unit.test.ts +285 -0
- package/src/__tests__/guard-gates.test.ts +317 -0
- package/src/__tests__/public-surface.integration.test.ts +38 -0
- package/src/__tests__/readback-fault-cleanup.unit.test.ts +66 -0
- package/src/__tests__/readback-format-matrix.dawn.test.ts +378 -0
- package/src/__tests__/readback-format-matrix.unit.test.ts +120 -0
- package/src/__tests__/readback-matrix-fixture.ts +20 -0
- package/src/__tests__/recorder-bootstrap.unit.test.ts +302 -0
- package/src/__tests__/recorder-budget.unit.test.ts +42 -0
- package/src/__tests__/recorder-fail-fast.unit.test.ts +434 -0
- package/src/__tests__/recorder-lifecycle.unit.test.ts +42 -0
- package/src/__tests__/recorder-push-event.unit.test.ts +573 -0
- package/src/__tests__/recorder-session.integration.test.ts +32 -0
- package/src/__tests__/recorder-session.unit.test.ts +63 -0
- package/src/__tests__/recorder-steady-frame.dawn.test.ts +52 -0
- package/src/__tests__/replay-fail-fast.unit.test.ts +155 -0
- package/src/__tests__/replay-session.dawn.test.ts +220 -0
- package/src/__tests__/replay-session.test-d.ts +27 -0
- package/src/__tests__/replay-session.unit.test.ts +171 -0
- package/src/__tests__/resolve-texture-descriptor.unit.test.ts +144 -0
- package/src/__tests__/resource-lifecycle.unit.test.ts +114 -0
- package/src/__tests__/rhi-debug-fresh-replay.dawn.test.ts +178 -0
- package/src/__tests__/tape-index.unit.test.ts +56 -0
- package/src/__tests__/tape-v7-invalid.unit.test.ts +45 -0
- package/src/__tests__/tape-v7-roundtrip.unit.test.ts +66 -0
- package/src/__tests__/tape-v7-version.unit.test.ts +13 -0
- package/src/__tests__/tree-shake.unit.test.ts +151 -0
- package/src/__tests__/types.test.ts +257 -0
- package/src/browser.ts +146 -0
- package/src/errors.ts +173 -0
- package/src/frame-model.ts +753 -0
- package/src/index.ts +92 -0
- package/src/pako.d.ts +8 -0
- package/src/protocol/codec.ts +220 -0
- package/src/protocol/event-semantics.ts +180 -0
- package/src/protocol/tape-index.ts +120 -0
- package/src/protocol/types.ts +60 -0
- package/src/protocol/validation.ts +173 -0
- package/src/readback.ts +804 -0
- package/src/recorder/assemble.ts +192 -0
- package/src/recorder/closure.ts +408 -0
- package/src/recorder/core.ts +587 -0
- package/src/recorder/device.ts +474 -0
- package/src/recorder/encoder.ts +251 -0
- package/src/recorder/lifecycle.ts +847 -0
- package/src/recorder/pass.ts +241 -0
- package/src/recorder/proxy.ts +59 -0
- package/src/recorder/queue.ts +109 -0
- package/src/recorder/resource-registry.ts +53 -0
- package/src/recorder/session.ts +152 -0
- package/src/recorder/shader.ts +47 -0
- package/src/recorder/snapshot.ts +38 -0
- package/src/recorder/wrap.ts +157 -0
- package/src/recorder.ts +15 -0
- package/src/replay/device-request.ts +38 -0
- package/src/replay/execute-support.ts +243 -0
- package/src/replay/execute.ts +870 -0
- package/src/replay/readback.ts +671 -0
- package/src/replay/resources.ts +154 -0
- package/src/replay/session.ts +509 -0
- package/src/replay/texture-format.ts +99 -0
- package/src/texel-decode.ts +289 -0
- package/src/texel-layout.ts +324 -0
- package/src/types.ts +888 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unique identifier for a recorded RHI handle within a tape.
|
|
3
|
+
*
|
|
4
|
+
* Encodes the type tag and raw numeric handle value into a single string
|
|
5
|
+
* (e.g. "buffer:3", "texture:7"). forgeax Handle<T> brand types do not
|
|
6
|
+
* collide across kinds (research F-1), so a single-level string key suffices.
|
|
7
|
+
*/
|
|
8
|
+
export type HandleId = string;
|
|
9
|
+
/**
|
|
10
|
+
* Subset of RhiCaps recorded alongside each tape for cross-device replay
|
|
11
|
+
* capability matching. Only the caps that affect rendering output are
|
|
12
|
+
* included (not backendKind, compute, indirectDrawing, etc. — those do
|
|
13
|
+
* not change the pixel output of a given RHI call sequence).
|
|
14
|
+
*
|
|
15
|
+
* Canvas format is included because it determines swap-chain format,
|
|
16
|
+
* which affects color-attachment pixel encoding.
|
|
17
|
+
*/
|
|
18
|
+
export interface RhiCapsRecorded {
|
|
19
|
+
readonly canvasFormat: GPUTextureFormat;
|
|
20
|
+
readonly rgba16floatRenderable: boolean;
|
|
21
|
+
readonly float32Filterable: boolean;
|
|
22
|
+
readonly textureCompressionBc: boolean;
|
|
23
|
+
readonly textureCompressionEtc2: boolean;
|
|
24
|
+
readonly textureCompressionAstc: boolean;
|
|
25
|
+
readonly storageBuffer: boolean;
|
|
26
|
+
readonly timestampQuery: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Marker event inserted at frame boundaries. Appears after all RHI calls
|
|
30
|
+
* within frame N, before calls in frame N+1.
|
|
31
|
+
*
|
|
32
|
+
* Bootstrap-period calls (before the first frameMark) are assigned to frameIdx=0,
|
|
33
|
+
* appearing before the `frameMark { frameIdx: 0 }` event (per AC-08 / Q&A q14).
|
|
34
|
+
*/
|
|
35
|
+
export interface RhiCallEventFrameMark {
|
|
36
|
+
readonly kind: 'frameMark';
|
|
37
|
+
readonly frameIdx: number;
|
|
38
|
+
}
|
|
39
|
+
export interface RhiCallEventCreateBuffer {
|
|
40
|
+
readonly kind: 'createBuffer';
|
|
41
|
+
readonly handleId: HandleId;
|
|
42
|
+
readonly desc: {
|
|
43
|
+
readonly size: GPUSize64;
|
|
44
|
+
readonly usage: GPUBufferUsageFlags;
|
|
45
|
+
readonly mappedAtCreation?: boolean | undefined;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface RhiCallEventCreateTexture {
|
|
49
|
+
readonly kind: 'createTexture';
|
|
50
|
+
readonly handleId: HandleId;
|
|
51
|
+
/** Present only for a canvas swapchain texture synthesized from getCurrentTexture. */
|
|
52
|
+
readonly origin?: 'swapchain' | undefined;
|
|
53
|
+
readonly desc: {
|
|
54
|
+
readonly size: GPUExtent3DStrict;
|
|
55
|
+
readonly mipLevelCount?: number | undefined;
|
|
56
|
+
readonly sampleCount?: number | undefined;
|
|
57
|
+
readonly dimension?: GPUTextureDimension | undefined;
|
|
58
|
+
readonly format: GPUTextureFormat;
|
|
59
|
+
readonly usage: GPUTextureUsageFlags;
|
|
60
|
+
readonly viewFormats?: Iterable<GPUTextureFormat> | undefined;
|
|
61
|
+
readonly textureBindingViewDimension?: GPUTextureViewDimension | undefined;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** A successful GPUBuffer.destroy call observed while recording. */
|
|
65
|
+
export interface RhiCallEventDestroyBuffer {
|
|
66
|
+
readonly kind: 'destroyBuffer';
|
|
67
|
+
readonly handleId: HandleId;
|
|
68
|
+
}
|
|
69
|
+
/** A successful GPUTexture.destroy call observed while recording. */
|
|
70
|
+
export interface RhiCallEventDestroyTexture {
|
|
71
|
+
readonly kind: 'destroyTexture';
|
|
72
|
+
readonly handleId: HandleId;
|
|
73
|
+
}
|
|
74
|
+
export interface RhiCallEventCreateTextureView {
|
|
75
|
+
readonly kind: 'createTextureView';
|
|
76
|
+
readonly sourceHandleId: HandleId;
|
|
77
|
+
readonly resultHandleId: HandleId;
|
|
78
|
+
readonly desc: {
|
|
79
|
+
readonly format?: GPUTextureFormat | undefined;
|
|
80
|
+
readonly dimension?: GPUTextureViewDimension | undefined;
|
|
81
|
+
readonly usage?: number | undefined;
|
|
82
|
+
readonly aspect?: GPUTextureAspect | undefined;
|
|
83
|
+
readonly baseMipLevel?: number | undefined;
|
|
84
|
+
readonly mipLevelCount?: number | undefined;
|
|
85
|
+
readonly baseArrayLayer?: number | undefined;
|
|
86
|
+
readonly arrayLayerCount?: number | undefined;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export interface RhiCallEventCreateSampler {
|
|
90
|
+
readonly kind: 'createSampler';
|
|
91
|
+
readonly handleId: HandleId;
|
|
92
|
+
readonly desc?: Partial<GPUSamplerDescriptor> | undefined;
|
|
93
|
+
}
|
|
94
|
+
export interface RhiCallEventCreateBindGroupLayout {
|
|
95
|
+
readonly kind: 'createBindGroupLayout';
|
|
96
|
+
readonly handleId: HandleId;
|
|
97
|
+
readonly desc: {
|
|
98
|
+
readonly label?: string | undefined;
|
|
99
|
+
readonly entries: Iterable<GPUBindGroupLayoutEntry>;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Resource kind discriminator stored alongside each createBindGroup
|
|
104
|
+
* entry. Mirrors the closed RHI BindResource union (`sampler` /
|
|
105
|
+
* `buffer` / `textureView` / `externalTexture`) so the inspector can
|
|
106
|
+
* report the binding's true type without re-reading the BindGroupLayout
|
|
107
|
+
* (I-8 fix, round 1 implement-review). Texture-view entries cover
|
|
108
|
+
* cubemaps, 2D, 3D, and array textures — InspectBindingEntry.kind
|
|
109
|
+
* narrows further into 'texture' (cubemap or otherwise) on the inspect
|
|
110
|
+
* report side.
|
|
111
|
+
*/
|
|
112
|
+
export type RhiBindResourceKind = 'sampler' | 'buffer' | 'textureView' | 'externalTexture';
|
|
113
|
+
export interface RhiCallEventCreateBindGroup {
|
|
114
|
+
readonly kind: 'createBindGroup';
|
|
115
|
+
readonly handleId: HandleId;
|
|
116
|
+
readonly layoutHandleId: HandleId;
|
|
117
|
+
readonly entries: readonly {
|
|
118
|
+
readonly binding: GPUBindGroupEntry['binding'];
|
|
119
|
+
readonly resourceKind: RhiBindResourceKind;
|
|
120
|
+
readonly bufferOffset?: number;
|
|
121
|
+
readonly bufferSize?: number;
|
|
122
|
+
}[];
|
|
123
|
+
readonly resourceHandleIds: readonly HandleId[];
|
|
124
|
+
}
|
|
125
|
+
export interface RhiCallEventCreatePipelineLayout {
|
|
126
|
+
readonly kind: 'createPipelineLayout';
|
|
127
|
+
readonly handleId: HandleId;
|
|
128
|
+
readonly bglHandleIds: readonly HandleId[];
|
|
129
|
+
}
|
|
130
|
+
export interface RhiCallEventCreateRenderPipeline {
|
|
131
|
+
readonly kind: 'createRenderPipeline';
|
|
132
|
+
readonly handleId: HandleId;
|
|
133
|
+
readonly desc: {
|
|
134
|
+
/** Serialized stage omits opaque shader module; the handle id is authoritative. */
|
|
135
|
+
readonly vertex?: {
|
|
136
|
+
readonly entryPoint?: string | undefined;
|
|
137
|
+
readonly buffers: Iterable<GPUVertexBufferLayout | null | undefined>;
|
|
138
|
+
readonly constants?: Record<string, number> | undefined;
|
|
139
|
+
};
|
|
140
|
+
readonly primitive?: GPUPrimitiveState | undefined;
|
|
141
|
+
readonly depthStencil?: GPUDepthStencilState | undefined;
|
|
142
|
+
readonly multisample?: GPUMultisampleState | undefined;
|
|
143
|
+
/** Serialized stage omits opaque shader module; the handle id is authoritative. */
|
|
144
|
+
readonly fragment?: {
|
|
145
|
+
readonly entryPoint?: string | undefined;
|
|
146
|
+
readonly targets: Iterable<GPUColorTargetState | null | undefined>;
|
|
147
|
+
readonly constants?: Record<string, number> | undefined;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
readonly layoutHandleId: HandleId;
|
|
151
|
+
/** HandleId of the re-created vertex shader module for cross-device binding. */
|
|
152
|
+
readonly vertexShaderModuleHandleId?: HandleId | undefined;
|
|
153
|
+
/** HandleId of the re-created fragment shader module for cross-device binding. */
|
|
154
|
+
readonly fragmentShaderModuleHandleId?: HandleId | undefined;
|
|
155
|
+
}
|
|
156
|
+
export interface RhiCallEventCreateComputePipeline {
|
|
157
|
+
readonly kind: 'createComputePipeline';
|
|
158
|
+
readonly handleId: HandleId;
|
|
159
|
+
readonly desc: {
|
|
160
|
+
readonly compute: GPUProgrammableStage;
|
|
161
|
+
};
|
|
162
|
+
readonly layoutHandleId: HandleId;
|
|
163
|
+
/** HandleId of the re-created compute shader module for cross-device binding. */
|
|
164
|
+
readonly computeShaderModuleHandleId?: HandleId | undefined;
|
|
165
|
+
}
|
|
166
|
+
export interface RhiCallEventCreateShaderModule {
|
|
167
|
+
readonly kind: 'createShaderModule';
|
|
168
|
+
readonly handleId: HandleId;
|
|
169
|
+
readonly wgslCode: string;
|
|
170
|
+
}
|
|
171
|
+
export interface RhiCallEventCreateCommandEncoder {
|
|
172
|
+
readonly kind: 'createCommandEncoder';
|
|
173
|
+
readonly cmdHandleId: HandleId;
|
|
174
|
+
readonly desc?: Partial<GPUCommandEncoderDescriptor> | undefined;
|
|
175
|
+
}
|
|
176
|
+
export interface RhiCallEventWriteBuffer {
|
|
177
|
+
readonly kind: 'writeBuffer';
|
|
178
|
+
readonly handleId: HandleId;
|
|
179
|
+
readonly bufferOffset: number;
|
|
180
|
+
readonly dataHash: string;
|
|
181
|
+
readonly size: number;
|
|
182
|
+
}
|
|
183
|
+
export interface RhiCallEventWriteTexture {
|
|
184
|
+
readonly kind: 'writeTexture';
|
|
185
|
+
readonly destination: {
|
|
186
|
+
readonly textureHandleId: HandleId;
|
|
187
|
+
readonly mipLevel?: number | undefined;
|
|
188
|
+
readonly origin?: GPUOrigin3D | undefined;
|
|
189
|
+
readonly aspect?: GPUTextureAspect | undefined;
|
|
190
|
+
};
|
|
191
|
+
readonly dataHash: string;
|
|
192
|
+
readonly dataLayout: {
|
|
193
|
+
readonly offset?: number | undefined;
|
|
194
|
+
readonly bytesPerRow?: number | undefined;
|
|
195
|
+
readonly rowsPerImage?: number | undefined;
|
|
196
|
+
};
|
|
197
|
+
readonly size: GPUExtent3DStrict;
|
|
198
|
+
}
|
|
199
|
+
export interface RhiCallEventCopyExternalImageToTexture {
|
|
200
|
+
readonly kind: 'copyExternalImageToTexture';
|
|
201
|
+
readonly source: {
|
|
202
|
+
readonly origin?: GPUOrigin2DStrict | undefined;
|
|
203
|
+
readonly flipY?: boolean | undefined;
|
|
204
|
+
};
|
|
205
|
+
readonly destination: {
|
|
206
|
+
readonly textureHandleId: HandleId;
|
|
207
|
+
readonly mipLevel?: number | undefined;
|
|
208
|
+
readonly origin?: GPUOrigin3D | undefined;
|
|
209
|
+
readonly aspect?: GPUTextureAspect | undefined;
|
|
210
|
+
readonly colorSpace?: PredefinedColorSpace | undefined;
|
|
211
|
+
readonly premultipliedAlpha?: boolean | undefined;
|
|
212
|
+
};
|
|
213
|
+
readonly copySize: GPUExtent3DStrict;
|
|
214
|
+
}
|
|
215
|
+
export interface RhiCallEventSubmit {
|
|
216
|
+
readonly kind: 'submit';
|
|
217
|
+
readonly cmdHandleIds: readonly HandleId[];
|
|
218
|
+
}
|
|
219
|
+
export interface RhiCallEventBeginRenderPass {
|
|
220
|
+
readonly kind: 'beginRenderPass';
|
|
221
|
+
readonly cmdHandleId: HandleId;
|
|
222
|
+
readonly passHandleId: HandleId;
|
|
223
|
+
readonly desc: {
|
|
224
|
+
/** Attachment handles are replaced by the parallel HandleId arrays on replay. */
|
|
225
|
+
readonly colorAttachments: Iterable<{
|
|
226
|
+
readonly view: unknown;
|
|
227
|
+
readonly resolveTarget?: unknown;
|
|
228
|
+
readonly [key: string]: unknown;
|
|
229
|
+
} | null | undefined>;
|
|
230
|
+
readonly depthStencilAttachment?: {
|
|
231
|
+
readonly view: unknown;
|
|
232
|
+
readonly [key: string]: unknown;
|
|
233
|
+
} | undefined;
|
|
234
|
+
readonly occlusionQuerySet?: unknown | undefined;
|
|
235
|
+
readonly timestampWrites?: unknown | undefined;
|
|
236
|
+
readonly maxDrawCount?: number | undefined;
|
|
237
|
+
};
|
|
238
|
+
readonly colorAttachmentViewHandleIds: readonly (HandleId | undefined)[];
|
|
239
|
+
/**
|
|
240
|
+
* Fresh-device handle identities for MSAA resolve targets. Optional for
|
|
241
|
+
* backwards compatibility with tapes recorded before resolve capture was
|
|
242
|
+
* added; those tapes retain their serialized descriptor behavior.
|
|
243
|
+
*/
|
|
244
|
+
readonly colorAttachmentResolveTargetHandleIds?: readonly (HandleId | undefined)[];
|
|
245
|
+
readonly depthStencilViewHandleId?: HandleId | undefined;
|
|
246
|
+
}
|
|
247
|
+
export interface RhiCallEventBeginComputePass {
|
|
248
|
+
readonly kind: 'beginComputePass';
|
|
249
|
+
readonly cmdHandleId: HandleId;
|
|
250
|
+
readonly passHandleId: HandleId;
|
|
251
|
+
readonly desc?: Partial<GPUComputePassDescriptor> | undefined;
|
|
252
|
+
}
|
|
253
|
+
export interface RhiCallEventCopyBufferToBuffer {
|
|
254
|
+
readonly kind: 'copyBufferToBuffer';
|
|
255
|
+
readonly cmdHandleId: HandleId;
|
|
256
|
+
readonly sourceHandleId: HandleId;
|
|
257
|
+
readonly sourceOffset: number;
|
|
258
|
+
readonly destinationHandleId: HandleId;
|
|
259
|
+
readonly destinationOffset: number;
|
|
260
|
+
readonly size: number;
|
|
261
|
+
}
|
|
262
|
+
export interface RhiCallEventCopyBufferToTexture {
|
|
263
|
+
readonly kind: 'copyBufferToTexture';
|
|
264
|
+
readonly cmdHandleId: HandleId;
|
|
265
|
+
readonly source: Omit<GPUTexelCopyBufferInfo, 'buffer'> & {
|
|
266
|
+
readonly bufferHandleId: HandleId;
|
|
267
|
+
};
|
|
268
|
+
readonly destination: Omit<GPUTexelCopyTextureInfo, 'texture'> & {
|
|
269
|
+
readonly textureHandleId: HandleId;
|
|
270
|
+
};
|
|
271
|
+
readonly copySize: GPUExtent3DStrict;
|
|
272
|
+
}
|
|
273
|
+
export interface RhiCallEventCopyTextureToBuffer {
|
|
274
|
+
readonly kind: 'copyTextureToBuffer';
|
|
275
|
+
readonly cmdHandleId: HandleId;
|
|
276
|
+
readonly source: Omit<GPUTexelCopyTextureInfo, 'texture'> & {
|
|
277
|
+
readonly textureHandleId: HandleId;
|
|
278
|
+
};
|
|
279
|
+
readonly destination: Omit<GPUTexelCopyBufferInfo, 'buffer'> & {
|
|
280
|
+
readonly bufferHandleId: HandleId;
|
|
281
|
+
};
|
|
282
|
+
readonly copySize: GPUExtent3DStrict;
|
|
283
|
+
}
|
|
284
|
+
export interface RhiCallEventCopyTextureToTexture {
|
|
285
|
+
readonly kind: 'copyTextureToTexture';
|
|
286
|
+
readonly cmdHandleId: HandleId;
|
|
287
|
+
readonly source: Omit<GPUTexelCopyTextureInfo, 'texture'> & {
|
|
288
|
+
readonly textureHandleId: HandleId;
|
|
289
|
+
};
|
|
290
|
+
readonly destination: Omit<GPUTexelCopyTextureInfo, 'texture'> & {
|
|
291
|
+
readonly textureHandleId: HandleId;
|
|
292
|
+
};
|
|
293
|
+
readonly copySize: GPUExtent3DStrict;
|
|
294
|
+
}
|
|
295
|
+
export interface RhiCallEventClearBuffer {
|
|
296
|
+
readonly kind: 'clearBuffer';
|
|
297
|
+
readonly cmdHandleId: HandleId;
|
|
298
|
+
readonly handleId: HandleId;
|
|
299
|
+
readonly offset?: number | undefined;
|
|
300
|
+
readonly size?: number | undefined;
|
|
301
|
+
}
|
|
302
|
+
export interface RhiCallEventPushDebugGroup {
|
|
303
|
+
readonly kind: 'pushDebugGroup';
|
|
304
|
+
readonly cmdHandleId: HandleId;
|
|
305
|
+
readonly groupLabel: string;
|
|
306
|
+
}
|
|
307
|
+
export interface RhiCallEventPopDebugGroup {
|
|
308
|
+
readonly kind: 'popDebugGroup';
|
|
309
|
+
readonly cmdHandleId: HandleId;
|
|
310
|
+
}
|
|
311
|
+
export interface RhiCallEventInsertDebugMarker {
|
|
312
|
+
readonly kind: 'insertDebugMarker';
|
|
313
|
+
readonly cmdHandleId: HandleId;
|
|
314
|
+
readonly markerLabel: string;
|
|
315
|
+
}
|
|
316
|
+
export interface RhiCallEventFinish {
|
|
317
|
+
readonly kind: 'finish';
|
|
318
|
+
readonly cmdHandleId: HandleId;
|
|
319
|
+
}
|
|
320
|
+
export interface RhiCallEventSetPipeline {
|
|
321
|
+
readonly kind: 'setPipeline';
|
|
322
|
+
readonly passHandleId: HandleId;
|
|
323
|
+
readonly pipelineHandleId: HandleId;
|
|
324
|
+
}
|
|
325
|
+
export interface RhiCallEventSetVertexBuffer {
|
|
326
|
+
readonly kind: 'setVertexBuffer';
|
|
327
|
+
readonly passHandleId: HandleId;
|
|
328
|
+
readonly slot: number;
|
|
329
|
+
readonly bufferHandleId: HandleId;
|
|
330
|
+
readonly offset?: number | undefined;
|
|
331
|
+
readonly size?: number | undefined;
|
|
332
|
+
}
|
|
333
|
+
export interface RhiCallEventSetIndexBuffer {
|
|
334
|
+
readonly kind: 'setIndexBuffer';
|
|
335
|
+
readonly passHandleId: HandleId;
|
|
336
|
+
readonly bufferHandleId: HandleId;
|
|
337
|
+
readonly format: 'uint16' | 'uint32';
|
|
338
|
+
readonly offset?: number | undefined;
|
|
339
|
+
readonly size?: number | undefined;
|
|
340
|
+
}
|
|
341
|
+
export interface RhiCallEventSetBindGroup {
|
|
342
|
+
readonly kind: 'setBindGroup';
|
|
343
|
+
readonly passHandleId: HandleId;
|
|
344
|
+
readonly index: number;
|
|
345
|
+
readonly bindGroupHandleId: HandleId;
|
|
346
|
+
readonly dynamicOffsets?: readonly number[] | undefined;
|
|
347
|
+
}
|
|
348
|
+
export interface RhiCallEventDraw {
|
|
349
|
+
readonly kind: 'draw';
|
|
350
|
+
readonly passHandleId: HandleId;
|
|
351
|
+
readonly vertexCount: number;
|
|
352
|
+
readonly instanceCount: number;
|
|
353
|
+
readonly firstVertex: number;
|
|
354
|
+
readonly firstInstance: number;
|
|
355
|
+
}
|
|
356
|
+
export interface RhiCallEventDrawIndexed {
|
|
357
|
+
readonly kind: 'drawIndexed';
|
|
358
|
+
readonly passHandleId: HandleId;
|
|
359
|
+
readonly indexCount: number;
|
|
360
|
+
readonly instanceCount: number;
|
|
361
|
+
readonly firstIndex: number;
|
|
362
|
+
readonly baseVertex: number;
|
|
363
|
+
readonly firstInstance: number;
|
|
364
|
+
}
|
|
365
|
+
export interface RhiCallEventSetViewport {
|
|
366
|
+
readonly kind: 'setViewport';
|
|
367
|
+
readonly passHandleId: HandleId;
|
|
368
|
+
readonly x: number;
|
|
369
|
+
readonly y: number;
|
|
370
|
+
readonly w: number;
|
|
371
|
+
readonly h: number;
|
|
372
|
+
readonly minDepth: number;
|
|
373
|
+
readonly maxDepth: number;
|
|
374
|
+
}
|
|
375
|
+
export interface RhiCallEventSetScissorRect {
|
|
376
|
+
readonly kind: 'setScissorRect';
|
|
377
|
+
readonly passHandleId: HandleId;
|
|
378
|
+
readonly x: number;
|
|
379
|
+
readonly y: number;
|
|
380
|
+
readonly w: number;
|
|
381
|
+
readonly h: number;
|
|
382
|
+
}
|
|
383
|
+
export interface RhiCallEventSetStencilReference {
|
|
384
|
+
readonly kind: 'setStencilReference';
|
|
385
|
+
readonly passHandleId: HandleId;
|
|
386
|
+
readonly reference: number;
|
|
387
|
+
}
|
|
388
|
+
export interface RhiCallEventEndRenderPass {
|
|
389
|
+
readonly kind: 'endRenderPass';
|
|
390
|
+
readonly passHandleId: HandleId;
|
|
391
|
+
}
|
|
392
|
+
export interface RhiCallEventSetBlendConstant {
|
|
393
|
+
readonly kind: 'setBlendConstant';
|
|
394
|
+
readonly passHandleId: HandleId;
|
|
395
|
+
readonly color: GPUColor;
|
|
396
|
+
}
|
|
397
|
+
export interface RhiCallEventDrawIndirect {
|
|
398
|
+
readonly kind: 'drawIndirect';
|
|
399
|
+
readonly passHandleId: HandleId;
|
|
400
|
+
readonly indirectBufferHandleId: HandleId;
|
|
401
|
+
readonly indirectOffset: number;
|
|
402
|
+
}
|
|
403
|
+
export interface RhiCallEventDrawIndexedIndirect {
|
|
404
|
+
readonly kind: 'drawIndexedIndirect';
|
|
405
|
+
readonly passHandleId: HandleId;
|
|
406
|
+
readonly indirectBufferHandleId: HandleId;
|
|
407
|
+
readonly indirectOffset: number;
|
|
408
|
+
}
|
|
409
|
+
export interface RhiCallEventPassPushDebugGroup {
|
|
410
|
+
readonly kind: 'passPushDebugGroup';
|
|
411
|
+
readonly passHandleId: HandleId;
|
|
412
|
+
readonly groupLabel: string;
|
|
413
|
+
}
|
|
414
|
+
export interface RhiCallEventPassPopDebugGroup {
|
|
415
|
+
readonly kind: 'passPopDebugGroup';
|
|
416
|
+
readonly passHandleId: HandleId;
|
|
417
|
+
}
|
|
418
|
+
export interface RhiCallEventPassInsertDebugMarker {
|
|
419
|
+
readonly kind: 'passInsertDebugMarker';
|
|
420
|
+
readonly passHandleId: HandleId;
|
|
421
|
+
readonly markerLabel: string;
|
|
422
|
+
}
|
|
423
|
+
export interface RhiCallEventSetComputePipeline {
|
|
424
|
+
readonly kind: 'setComputePipeline';
|
|
425
|
+
readonly passHandleId: HandleId;
|
|
426
|
+
readonly pipelineHandleId: HandleId;
|
|
427
|
+
}
|
|
428
|
+
export interface RhiCallEventDispatchWorkgroups {
|
|
429
|
+
readonly kind: 'dispatchWorkgroups';
|
|
430
|
+
readonly passHandleId: HandleId;
|
|
431
|
+
readonly x: number;
|
|
432
|
+
readonly y: number;
|
|
433
|
+
readonly z: number;
|
|
434
|
+
}
|
|
435
|
+
export interface RhiCallEventDispatchWorkgroupsIndirect {
|
|
436
|
+
readonly kind: 'dispatchWorkgroupsIndirect';
|
|
437
|
+
readonly passHandleId: HandleId;
|
|
438
|
+
readonly indirectBufferHandleId: HandleId;
|
|
439
|
+
readonly indirectOffset: number;
|
|
440
|
+
}
|
|
441
|
+
export interface RhiCallEventEndComputePass {
|
|
442
|
+
readonly kind: 'endComputePass';
|
|
443
|
+
readonly passHandleId: HandleId;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Initial-data event representing a resource snapshot captured at recording start.
|
|
447
|
+
*
|
|
448
|
+
* handleId points to a resource declared by a prior create* event in the
|
|
449
|
+
* bootstrap prefix. dataHash is a key into the tape's blobPool, where the
|
|
450
|
+
* resource's actual GPU bytes (read back via copyToBuffer/mapAsync) are stored
|
|
451
|
+
* with djb2 hash-dedup (D-1: reuse unified serialization path, no separate pool).
|
|
452
|
+
*
|
|
453
|
+
* The resource kind (buffer vs texture) and its shape are recorded in the
|
|
454
|
+
* descriptor registry (snapshotResource reads it), not duplicated in this event
|
|
455
|
+
* (architecture-principles #1 SSOT — avoid two sources for shape).
|
|
456
|
+
*/
|
|
457
|
+
export interface RhiCallEventInitialData {
|
|
458
|
+
readonly kind: 'initialData';
|
|
459
|
+
readonly handleId: HandleId;
|
|
460
|
+
readonly dataHash: string;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Closed union of all recordable RHI call events.
|
|
464
|
+
*
|
|
465
|
+
* v1 covers: core RHI methods + copyExternalImageToTexture + clearBuffer (IS-11).
|
|
466
|
+
* Excludes: writeTimestamp/resolveQuerySet (OOS-3),
|
|
467
|
+
* executeBundles (OOS-10), beginOcclusionQuery/endOcclusionQuery.
|
|
468
|
+
*
|
|
469
|
+
* Kinds are named 1:1 with RHI method names per plan-strategy §8 naming convention.
|
|
470
|
+
* The frameMark kind is the only non-method event — it marks frame boundaries.
|
|
471
|
+
*/
|
|
472
|
+
export type RhiCallEvent = RhiCallEventFrameMark | RhiCallEventCreateBuffer | RhiCallEventCreateTexture | RhiCallEventDestroyBuffer | RhiCallEventDestroyTexture | RhiCallEventCreateTextureView | RhiCallEventCreateSampler | RhiCallEventCreateBindGroupLayout | RhiCallEventCreateBindGroup | RhiCallEventCreatePipelineLayout | RhiCallEventCreateRenderPipeline | RhiCallEventCreateComputePipeline | RhiCallEventCreateShaderModule | RhiCallEventCreateCommandEncoder | RhiCallEventWriteBuffer | RhiCallEventWriteTexture | RhiCallEventCopyExternalImageToTexture | RhiCallEventSubmit | RhiCallEventBeginRenderPass | RhiCallEventBeginComputePass | RhiCallEventCopyBufferToBuffer | RhiCallEventCopyBufferToTexture | RhiCallEventCopyTextureToBuffer | RhiCallEventCopyTextureToTexture | RhiCallEventClearBuffer | RhiCallEventPushDebugGroup | RhiCallEventPopDebugGroup | RhiCallEventInsertDebugMarker | RhiCallEventFinish | RhiCallEventSetPipeline | RhiCallEventSetVertexBuffer | RhiCallEventSetIndexBuffer | RhiCallEventSetBindGroup | RhiCallEventDraw | RhiCallEventDrawIndexed | RhiCallEventSetViewport | RhiCallEventSetScissorRect | RhiCallEventSetStencilReference | RhiCallEventEndRenderPass | RhiCallEventSetBlendConstant | RhiCallEventDrawIndirect | RhiCallEventDrawIndexedIndirect | RhiCallEventPassPushDebugGroup | RhiCallEventPassPopDebugGroup | RhiCallEventPassInsertDebugMarker | RhiCallEventSetComputePipeline | RhiCallEventDispatchWorkgroups | RhiCallEventDispatchWorkgroupsIndirect | RhiCallEventEndComputePass | RhiCallEventInitialData;
|
|
473
|
+
/**
|
|
474
|
+
* A recorded frame tape.
|
|
475
|
+
*
|
|
476
|
+
* Contains the sequence of RHI calls (events) plus a binary blob pool
|
|
477
|
+
* for buffer data that is hash-deduplicated across events.
|
|
478
|
+
*
|
|
479
|
+
* formatVersion: integer version of the tape format. Mismatch with runtime
|
|
480
|
+
* version causes deserialize to reject with 'tape-format-version-mismatch'.
|
|
481
|
+
* rhiCapsRecorded: the caps of the recording device for cross-device matching.
|
|
482
|
+
* events: the ordered sequence of RHI call events including frameMark boundaries.
|
|
483
|
+
* blobPool: hash-deduplicated binary data (buffer contents, shader source, etc).
|
|
484
|
+
* Keyed by hash string, valued as ArrayBuffer.
|
|
485
|
+
*/
|
|
486
|
+
export interface Tape {
|
|
487
|
+
readonly formatVersion: number;
|
|
488
|
+
readonly rhiCapsRecorded: RhiCapsRecorded;
|
|
489
|
+
readonly events: readonly RhiCallEvent[];
|
|
490
|
+
readonly blobPool: ReadonlyMap<string, ArrayBuffer>;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Information about a GPU binding group entry as seen at inspect time.
|
|
494
|
+
*/
|
|
495
|
+
export interface InspectBindingEntry {
|
|
496
|
+
readonly groupIndex: number;
|
|
497
|
+
readonly entryIndex: number;
|
|
498
|
+
readonly handleId: HandleId;
|
|
499
|
+
readonly kind: 'buffer' | 'texture' | 'sampler' | 'textureView';
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Information about the work item at the inspected workIndex.
|
|
503
|
+
*/
|
|
504
|
+
export interface InspectDrawCall {
|
|
505
|
+
readonly pipelineKind: 'render' | 'compute';
|
|
506
|
+
readonly pipelineHandleId: HandleId;
|
|
507
|
+
readonly vertexCount?: number | undefined;
|
|
508
|
+
readonly instanceCount?: number | undefined;
|
|
509
|
+
readonly indexCount?: number | undefined;
|
|
510
|
+
readonly dispatchX?: number | undefined;
|
|
511
|
+
readonly dispatchY?: number | undefined;
|
|
512
|
+
readonly dispatchZ?: number | undefined;
|
|
513
|
+
/** Present on `draw` — the first vertex offset (raw event field carried through). */
|
|
514
|
+
readonly firstVertex?: number | undefined;
|
|
515
|
+
/** Present on `drawIndexed` — index of the first element of the index buffer to read. */
|
|
516
|
+
readonly firstIndex?: number | undefined;
|
|
517
|
+
/** Present on `draw` and `drawIndexed` — the first instance for instanced rendering. */
|
|
518
|
+
readonly firstInstance?: number | undefined;
|
|
519
|
+
/** Present on `drawIndexed` — vertex offset added before indexing the vertex buffer. */
|
|
520
|
+
readonly baseVertex?: number | undefined;
|
|
521
|
+
/** Present on `drawIndirect` / `drawIndexedIndirect` — handle of the buffer holding the parameters. */
|
|
522
|
+
readonly indirectBufferHandleId?: HandleId | undefined;
|
|
523
|
+
/** Present on `drawIndirect` / `drawIndexedIndirect` — byte offset into the indirect buffer. */
|
|
524
|
+
readonly indirectOffset?: number | undefined;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Pipeline state for a single draw call, extracted from createRenderPipeline +
|
|
528
|
+
* runtime events (pure event analysis, zero GPU). The seven WebGPU pipeline
|
|
529
|
+
* stages the viewer's PipelineState panel renders; attached to InspectReport so
|
|
530
|
+
* an AI `inspect-offline` call sees identical data. SSOT producer:
|
|
531
|
+
* `makePipelineState` in inspect-core.ts; whole-frame producer: buildFrameModel.
|
|
532
|
+
*/
|
|
533
|
+
export interface DrawPipelineState {
|
|
534
|
+
readonly inputAssembly: {
|
|
535
|
+
readonly topology: GPUPrimitiveTopology;
|
|
536
|
+
readonly stripIndexFormat: GPUIndexFormat | undefined;
|
|
537
|
+
};
|
|
538
|
+
readonly vertexInput: {
|
|
539
|
+
readonly buffers: readonly {
|
|
540
|
+
readonly arrayStride: number;
|
|
541
|
+
readonly stepMode: GPUVertexStepMode;
|
|
542
|
+
readonly attributes: readonly {
|
|
543
|
+
readonly format: GPUVertexFormat;
|
|
544
|
+
readonly offset: number;
|
|
545
|
+
readonly shaderLocation: number;
|
|
546
|
+
}[];
|
|
547
|
+
}[];
|
|
548
|
+
};
|
|
549
|
+
readonly shaders: {
|
|
550
|
+
readonly vertexShaderModuleHandleId: HandleId | undefined;
|
|
551
|
+
readonly fragmentShaderModuleHandleId: HandleId | undefined;
|
|
552
|
+
/** Active vertex entry point (a module may bundle several; this is the one this draw runs). */
|
|
553
|
+
readonly vertexEntryPoint: string | undefined;
|
|
554
|
+
/** Active fragment entry point — disambiguates a multi-entrypoint module (e.g. fs_main vs fs_gbuffer). */
|
|
555
|
+
readonly fragmentEntryPoint: string | undefined;
|
|
556
|
+
};
|
|
557
|
+
readonly rasterizer: {
|
|
558
|
+
readonly cullMode: GPUCullMode;
|
|
559
|
+
readonly frontFace: GPUFrontFace;
|
|
560
|
+
};
|
|
561
|
+
readonly depthStencil: {
|
|
562
|
+
readonly format: GPUTextureFormat;
|
|
563
|
+
readonly depthWriteEnabled: boolean;
|
|
564
|
+
readonly depthCompare: GPUCompareFunction;
|
|
565
|
+
readonly stencilFront: NonNullable<GPUDepthStencilState['stencilFront']>;
|
|
566
|
+
readonly stencilBack: NonNullable<GPUDepthStencilState['stencilBack']>;
|
|
567
|
+
readonly stencilReadMask: number;
|
|
568
|
+
readonly stencilWriteMask: number;
|
|
569
|
+
readonly depthBias: number;
|
|
570
|
+
readonly depthBiasSlopeScale: number;
|
|
571
|
+
readonly depthBiasClamp: number;
|
|
572
|
+
readonly stencilReference: number;
|
|
573
|
+
};
|
|
574
|
+
readonly blend: {
|
|
575
|
+
readonly colorTargets: readonly {
|
|
576
|
+
readonly format: GPUTextureFormat;
|
|
577
|
+
readonly color: GPUBlendComponent | undefined;
|
|
578
|
+
readonly alpha: GPUBlendComponent | undefined;
|
|
579
|
+
readonly writeMask: GPUColorWriteFlags;
|
|
580
|
+
}[];
|
|
581
|
+
readonly blendConstant: GPUColor | undefined;
|
|
582
|
+
};
|
|
583
|
+
readonly multisample: {
|
|
584
|
+
readonly count: number;
|
|
585
|
+
readonly mask: number;
|
|
586
|
+
readonly alphaToCoverageEnabled: boolean;
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* A resource descriptor parsed from a create* event, discriminated by kind.
|
|
591
|
+
* Consumed by the viewer's ResourceInspector panel and the cli `summary`
|
|
592
|
+
* subcommand (via the FrameModel.resources map). SSOT producer: `buildResources`
|
|
593
|
+
* in inspect-core.ts.
|
|
594
|
+
*/
|
|
595
|
+
export type CreateDescriptor = {
|
|
596
|
+
readonly kind: 'createBuffer';
|
|
597
|
+
readonly handleId: HandleId;
|
|
598
|
+
readonly size: GPUSize64;
|
|
599
|
+
readonly usage: GPUBufferUsageFlags;
|
|
600
|
+
} | {
|
|
601
|
+
readonly kind: 'createTexture';
|
|
602
|
+
readonly handleId: HandleId;
|
|
603
|
+
readonly format: GPUTextureFormat;
|
|
604
|
+
readonly size: readonly number[];
|
|
605
|
+
readonly mipLevelCount: number;
|
|
606
|
+
readonly sampleCount: number;
|
|
607
|
+
readonly dimension: GPUTextureDimension;
|
|
608
|
+
readonly usage: GPUTextureUsageFlags;
|
|
609
|
+
} | {
|
|
610
|
+
readonly kind: 'createSampler';
|
|
611
|
+
readonly handleId: HandleId;
|
|
612
|
+
readonly desc: Partial<GPUSamplerDescriptor> | undefined;
|
|
613
|
+
} | {
|
|
614
|
+
readonly kind: 'createBindGroupLayout';
|
|
615
|
+
readonly handleId: HandleId;
|
|
616
|
+
readonly entries: readonly GPUBindGroupLayoutEntry[];
|
|
617
|
+
} | {
|
|
618
|
+
readonly kind: 'createPipelineLayout';
|
|
619
|
+
readonly handleId: HandleId;
|
|
620
|
+
readonly bglHandleIds: readonly HandleId[];
|
|
621
|
+
} | {
|
|
622
|
+
readonly kind: 'createRenderPipeline';
|
|
623
|
+
readonly handleId: HandleId;
|
|
624
|
+
readonly vertex: GPUVertexState | undefined;
|
|
625
|
+
readonly primitive: GPUPrimitiveState | undefined;
|
|
626
|
+
readonly depthStencil: GPUDepthStencilState | undefined;
|
|
627
|
+
readonly multisample: GPUMultisampleState | undefined;
|
|
628
|
+
readonly fragment: GPUFragmentState | undefined;
|
|
629
|
+
readonly layoutHandleId: HandleId;
|
|
630
|
+
readonly vertexShaderModuleHandleId: HandleId | undefined;
|
|
631
|
+
readonly fragmentShaderModuleHandleId: HandleId | undefined;
|
|
632
|
+
} | {
|
|
633
|
+
readonly kind: 'createShaderModule';
|
|
634
|
+
readonly handleId: HandleId;
|
|
635
|
+
readonly wgslCode: string;
|
|
636
|
+
};
|
|
637
|
+
/**
|
|
638
|
+
* Decoded RGBA8 pixels of the RT readback at the inspected draw call — the
|
|
639
|
+
* structured RT payload produced by the node-free browser path (L3b
|
|
640
|
+
* `inspectDrawJson`). `format` describes the native replay texels, so callers
|
|
641
|
+
* can decode wide and floating-point attachments correctly. `pixels` are
|
|
642
|
+
* tight-packed with row-alignment padding stripped.
|
|
643
|
+
*/
|
|
644
|
+
export interface InspectRtPixels {
|
|
645
|
+
readonly width: number;
|
|
646
|
+
readonly height: number;
|
|
647
|
+
readonly format: string;
|
|
648
|
+
readonly pixels: Uint8Array;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* The RT readback at the inspected draw call, in one of two genuinely
|
|
652
|
+
* distinct forms keyed by execution environment:
|
|
653
|
+
*
|
|
654
|
+
* - `string` — a PNG **file path** on disk, produced by the DevKit Node shell
|
|
655
|
+
* after `rhi.inspect`, which encodes the readback to a PNG under the
|
|
656
|
+
* inspect/ output dir. Discriminate with `typeof rt === 'string'`.
|
|
657
|
+
* - {@link InspectRtPixels} — the native `{ width, height, format, pixels }` tuple,
|
|
658
|
+
* produced by the node-free browser path (`inspectDrawJson`), which cannot
|
|
659
|
+
* write files and so hands back raw RGBA8 pixels. Discriminate with
|
|
660
|
+
* `typeof rt === 'object'` (or `'pixels' in rt`).
|
|
661
|
+
*
|
|
662
|
+
* AI users branch on `typeof` — the union is the single source of truth for
|
|
663
|
+
* "what an `rt` field may hold", so no untyped-value cast is needed at either
|
|
664
|
+
* producer.
|
|
665
|
+
*/
|
|
666
|
+
export type InspectRtPayload = string | InspectRtPixels;
|
|
667
|
+
/**
|
|
668
|
+
* Structured report produced by inspectWork(replay, workIndex, fields?).
|
|
669
|
+
*
|
|
670
|
+
* frameIdx/workIndex/passIdx are **always present** — they identify the inspected
|
|
671
|
+
* draw and are computed regardless of the `fields` selector.
|
|
672
|
+
*
|
|
673
|
+
* bindings/drawCall/rt are **field-cropped**: each is present only when the
|
|
674
|
+
* `fields` selector includes its name, or when `fields` is undefined (full
|
|
675
|
+
* report). When a field is not requested it is genuinely absent (the key is not
|
|
676
|
+
* set), not assigned `undefined` (AC-12). AI users must narrow before reading
|
|
677
|
+
* (`report.drawCall?.pipelineKind`, `if (report.bindings) …`).
|
|
678
|
+
*
|
|
679
|
+
* frameIdx: the frame index containing this draw call.
|
|
680
|
+
* workIndex: the global work ordinal within the tape.
|
|
681
|
+
* passIdx: the render/compute pass index containing this draw.
|
|
682
|
+
* bindings: the bind group bindings active at this draw call (cropped: present
|
|
683
|
+
* when fields includes 'bindings' or is undefined).
|
|
684
|
+
* drawCall: metadata about the draw/dispatch call itself (cropped: present when
|
|
685
|
+
* fields includes 'drawCall' or is undefined).
|
|
686
|
+
* rt: the RT readback ({@link InspectRtPayload}) — a PNG file path string on
|
|
687
|
+
* the Node CLI path, or a decoded {width,height,pixels} object on the
|
|
688
|
+
* browser path. Cropped: present when fields includes 'rt' or is undefined
|
|
689
|
+
* (full report).
|
|
690
|
+
* pipelineState: the seven WebGPU pipeline stages active at this draw
|
|
691
|
+
* ({@link DrawPipelineState}), derived from pure event analysis. Always
|
|
692
|
+
* present for render draws (never gated by `fields`); the AI sees the same
|
|
693
|
+
* pipeline state the viewer's PipelineState panel renders.
|
|
694
|
+
*/
|
|
695
|
+
export interface InspectReport {
|
|
696
|
+
readonly frameIdx: number;
|
|
697
|
+
readonly workIndex: number;
|
|
698
|
+
readonly passIdx: number;
|
|
699
|
+
readonly bindings?: readonly InspectBindingEntry[] | undefined;
|
|
700
|
+
readonly drawCall?: InspectDrawCall | undefined;
|
|
701
|
+
readonly rt?: InspectRtPayload | undefined;
|
|
702
|
+
readonly pipelineState?: DrawPipelineState | undefined;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Fields selector for inspectWork — controls which data is computed and returned.
|
|
706
|
+
* An empty array means "minimum report" (frameIdx/workIndex/passIdx only).
|
|
707
|
+
* undefined means "full report" (all fields including RT PNG).
|
|
708
|
+
*/
|
|
709
|
+
export type InspectFields = 'bindings' | 'drawCall' | 'rt';
|
|
710
|
+
/**
|
|
711
|
+
* RHI commands that are known to be out-of-scope for current capture.
|
|
712
|
+
*
|
|
713
|
+
* These commands remain silent pass-throughs in the recorder (no pushEvent)
|
|
714
|
+
* but are explicitly listed here so the coverage-invariant test can
|
|
715
|
+
* distinguish "known-exempt" from "forgotten". New commands added to an
|
|
716
|
+
* encoder interface that are not in this set AND have no RhiCallEvent kind
|
|
717
|
+
* will cause the coverage-invariant .test-d.ts to fail at compile time.
|
|
718
|
+
*
|
|
719
|
+
* @internal
|
|
720
|
+
*/
|
|
721
|
+
export declare const DEFERRED_COMMANDS: Set<string>;
|
|
722
|
+
//# sourceMappingURL=types.d.ts.map
|