@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.
Files changed (237) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +178 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/__tests__/bootstrap-integration.test.d.ts +2 -0
  5. package/dist/__tests__/bootstrap-integration.test.d.ts.map +1 -0
  6. package/dist/__tests__/consumer-inventory.unit.test.d.ts +2 -0
  7. package/dist/__tests__/consumer-inventory.unit.test.d.ts.map +1 -0
  8. package/dist/__tests__/copy-src-usage-validity.dawn.test.d.ts +15 -0
  9. package/dist/__tests__/copy-src-usage-validity.dawn.test.d.ts.map +1 -0
  10. package/dist/__tests__/coverage-invariant.test-d.d.ts +2 -0
  11. package/dist/__tests__/coverage-invariant.test-d.d.ts.map +1 -0
  12. package/dist/__tests__/coverage-invariant.unit.test.d.ts +2 -0
  13. package/dist/__tests__/coverage-invariant.unit.test.d.ts.map +1 -0
  14. package/dist/__tests__/e2e.browser.test.d.ts +2 -0
  15. package/dist/__tests__/e2e.browser.test.d.ts.map +1 -0
  16. package/dist/__tests__/error-code-narrowing.test-d.d.ts +2 -0
  17. package/dist/__tests__/error-code-narrowing.test-d.d.ts.map +1 -0
  18. package/dist/__tests__/errors-v7.test-d.d.ts +2 -0
  19. package/dist/__tests__/errors-v7.test-d.d.ts.map +1 -0
  20. package/dist/__tests__/errors-v7.unit.test.d.ts +2 -0
  21. package/dist/__tests__/errors-v7.unit.test.d.ts.map +1 -0
  22. package/dist/__tests__/errors.unit.test.d.ts +2 -0
  23. package/dist/__tests__/errors.unit.test.d.ts.map +1 -0
  24. package/dist/__tests__/event-semantics-coverage.unit.test.d.ts +2 -0
  25. package/dist/__tests__/event-semantics-coverage.unit.test.d.ts.map +1 -0
  26. package/dist/__tests__/format-info.unit.test.d.ts +2 -0
  27. package/dist/__tests__/format-info.unit.test.d.ts.map +1 -0
  28. package/dist/__tests__/frame-model-parity.test-d.d.ts +2 -0
  29. package/dist/__tests__/frame-model-parity.test-d.d.ts.map +1 -0
  30. package/dist/__tests__/frame-model-parity.unit.test.d.ts +2 -0
  31. package/dist/__tests__/frame-model-parity.unit.test.d.ts.map +1 -0
  32. package/dist/__tests__/guard-gates.test.d.ts +2 -0
  33. package/dist/__tests__/guard-gates.test.d.ts.map +1 -0
  34. package/dist/__tests__/public-surface.integration.test.d.ts +2 -0
  35. package/dist/__tests__/public-surface.integration.test.d.ts.map +1 -0
  36. package/dist/__tests__/readback-fault-cleanup.unit.test.d.ts +2 -0
  37. package/dist/__tests__/readback-fault-cleanup.unit.test.d.ts.map +1 -0
  38. package/dist/__tests__/readback-format-matrix.dawn.test.d.ts +2 -0
  39. package/dist/__tests__/readback-format-matrix.dawn.test.d.ts.map +1 -0
  40. package/dist/__tests__/readback-format-matrix.unit.test.d.ts +2 -0
  41. package/dist/__tests__/readback-format-matrix.unit.test.d.ts.map +1 -0
  42. package/dist/__tests__/readback-matrix-fixture.d.ts +32 -0
  43. package/dist/__tests__/readback-matrix-fixture.d.ts.map +1 -0
  44. package/dist/__tests__/recorder-bootstrap.unit.test.d.ts +2 -0
  45. package/dist/__tests__/recorder-bootstrap.unit.test.d.ts.map +1 -0
  46. package/dist/__tests__/recorder-budget.unit.test.d.ts +2 -0
  47. package/dist/__tests__/recorder-budget.unit.test.d.ts.map +1 -0
  48. package/dist/__tests__/recorder-fail-fast.unit.test.d.ts +2 -0
  49. package/dist/__tests__/recorder-fail-fast.unit.test.d.ts.map +1 -0
  50. package/dist/__tests__/recorder-lifecycle.unit.test.d.ts +2 -0
  51. package/dist/__tests__/recorder-lifecycle.unit.test.d.ts.map +1 -0
  52. package/dist/__tests__/recorder-push-event.unit.test.d.ts +2 -0
  53. package/dist/__tests__/recorder-push-event.unit.test.d.ts.map +1 -0
  54. package/dist/__tests__/recorder-session.integration.test.d.ts +2 -0
  55. package/dist/__tests__/recorder-session.integration.test.d.ts.map +1 -0
  56. package/dist/__tests__/recorder-session.unit.test.d.ts +2 -0
  57. package/dist/__tests__/recorder-session.unit.test.d.ts.map +1 -0
  58. package/dist/__tests__/recorder-steady-frame.dawn.test.d.ts +2 -0
  59. package/dist/__tests__/recorder-steady-frame.dawn.test.d.ts.map +1 -0
  60. package/dist/__tests__/replay-fail-fast.unit.test.d.ts +2 -0
  61. package/dist/__tests__/replay-fail-fast.unit.test.d.ts.map +1 -0
  62. package/dist/__tests__/replay-session.dawn.test.d.ts +2 -0
  63. package/dist/__tests__/replay-session.dawn.test.d.ts.map +1 -0
  64. package/dist/__tests__/replay-session.test-d.d.ts +2 -0
  65. package/dist/__tests__/replay-session.test-d.d.ts.map +1 -0
  66. package/dist/__tests__/replay-session.unit.test.d.ts +2 -0
  67. package/dist/__tests__/replay-session.unit.test.d.ts.map +1 -0
  68. package/dist/__tests__/resolve-texture-descriptor.unit.test.d.ts +2 -0
  69. package/dist/__tests__/resolve-texture-descriptor.unit.test.d.ts.map +1 -0
  70. package/dist/__tests__/resource-lifecycle.unit.test.d.ts +2 -0
  71. package/dist/__tests__/resource-lifecycle.unit.test.d.ts.map +1 -0
  72. package/dist/__tests__/rhi-debug-fresh-replay.dawn.test.d.ts +2 -0
  73. package/dist/__tests__/rhi-debug-fresh-replay.dawn.test.d.ts.map +1 -0
  74. package/dist/__tests__/tape-index.unit.test.d.ts +2 -0
  75. package/dist/__tests__/tape-index.unit.test.d.ts.map +1 -0
  76. package/dist/__tests__/tape-v7-invalid.unit.test.d.ts +2 -0
  77. package/dist/__tests__/tape-v7-invalid.unit.test.d.ts.map +1 -0
  78. package/dist/__tests__/tape-v7-roundtrip.unit.test.d.ts +2 -0
  79. package/dist/__tests__/tape-v7-roundtrip.unit.test.d.ts.map +1 -0
  80. package/dist/__tests__/tape-v7-version.unit.test.d.ts +2 -0
  81. package/dist/__tests__/tape-v7-version.unit.test.d.ts.map +1 -0
  82. package/dist/__tests__/tree-shake.unit.test.d.ts +2 -0
  83. package/dist/__tests__/tree-shake.unit.test.d.ts.map +1 -0
  84. package/dist/__tests__/types.test.d.ts +2 -0
  85. package/dist/__tests__/types.test.d.ts.map +1 -0
  86. package/dist/browser.d.ts +45 -0
  87. package/dist/browser.d.ts.map +1 -0
  88. package/dist/browser.mjs +83 -0
  89. package/dist/browser.mjs.map +1 -0
  90. package/dist/errors.d.ts +85 -0
  91. package/dist/errors.d.ts.map +1 -0
  92. package/dist/frame-model.d.ts +158 -0
  93. package/dist/frame-model.d.ts.map +1 -0
  94. package/dist/index.d.ts +17 -0
  95. package/dist/index.d.ts.map +1 -0
  96. package/dist/index.mjs +10415 -0
  97. package/dist/index.mjs.map +1 -0
  98. package/dist/protocol/codec.d.ts +6 -0
  99. package/dist/protocol/codec.d.ts.map +1 -0
  100. package/dist/protocol/event-semantics.d.ts +15 -0
  101. package/dist/protocol/event-semantics.d.ts.map +1 -0
  102. package/dist/protocol/tape-index.d.ts +30 -0
  103. package/dist/protocol/tape-index.d.ts.map +1 -0
  104. package/dist/protocol/types.d.ts +44 -0
  105. package/dist/protocol/types.d.ts.map +1 -0
  106. package/dist/protocol/validation.d.ts +7 -0
  107. package/dist/protocol/validation.d.ts.map +1 -0
  108. package/dist/readback.d.ts +156 -0
  109. package/dist/readback.d.ts.map +1 -0
  110. package/dist/recorder/assemble.d.ts +11 -0
  111. package/dist/recorder/assemble.d.ts.map +1 -0
  112. package/dist/recorder/closure.d.ts +39 -0
  113. package/dist/recorder/closure.d.ts.map +1 -0
  114. package/dist/recorder/core.d.ts +296 -0
  115. package/dist/recorder/core.d.ts.map +1 -0
  116. package/dist/recorder/device.d.ts +4 -0
  117. package/dist/recorder/device.d.ts.map +1 -0
  118. package/dist/recorder/encoder.d.ts +5 -0
  119. package/dist/recorder/encoder.d.ts.map +1 -0
  120. package/dist/recorder/lifecycle.d.ts +20 -0
  121. package/dist/recorder/lifecycle.d.ts.map +1 -0
  122. package/dist/recorder/pass.d.ts +6 -0
  123. package/dist/recorder/pass.d.ts.map +1 -0
  124. package/dist/recorder/proxy.d.ts +19 -0
  125. package/dist/recorder/proxy.d.ts.map +1 -0
  126. package/dist/recorder/queue.d.ts +4 -0
  127. package/dist/recorder/queue.d.ts.map +1 -0
  128. package/dist/recorder/resource-registry.d.ts +15 -0
  129. package/dist/recorder/resource-registry.d.ts.map +1 -0
  130. package/dist/recorder/session.d.ts +25 -0
  131. package/dist/recorder/session.d.ts.map +1 -0
  132. package/dist/recorder/shader.d.ts +3 -0
  133. package/dist/recorder/shader.d.ts.map +1 -0
  134. package/dist/recorder/snapshot.d.ts +10 -0
  135. package/dist/recorder/snapshot.d.ts.map +1 -0
  136. package/dist/recorder/wrap.d.ts +4 -0
  137. package/dist/recorder/wrap.d.ts.map +1 -0
  138. package/dist/recorder.d.ts +7 -0
  139. package/dist/recorder.d.ts.map +1 -0
  140. package/dist/replay/device-request.d.ts +8 -0
  141. package/dist/replay/device-request.d.ts.map +1 -0
  142. package/dist/replay/execute-support.d.ts +33 -0
  143. package/dist/replay/execute-support.d.ts.map +1 -0
  144. package/dist/replay/execute.d.ts +18 -0
  145. package/dist/replay/execute.d.ts.map +1 -0
  146. package/dist/replay/readback.d.ts +32 -0
  147. package/dist/replay/readback.d.ts.map +1 -0
  148. package/dist/replay/resources.d.ts +57 -0
  149. package/dist/replay/resources.d.ts.map +1 -0
  150. package/dist/replay/session.d.ts +49 -0
  151. package/dist/replay/session.d.ts.map +1 -0
  152. package/dist/replay/texture-format.d.ts +21 -0
  153. package/dist/replay/texture-format.d.ts.map +1 -0
  154. package/dist/texel-decode.d.ts +35 -0
  155. package/dist/texel-decode.d.ts.map +1 -0
  156. package/dist/texel-layout.d.ts +76 -0
  157. package/dist/texel-layout.d.ts.map +1 -0
  158. package/dist/types.d.ts +722 -0
  159. package/dist/types.d.ts.map +1 -0
  160. package/package.json +72 -0
  161. package/src/__tests__/bootstrap-integration.test.ts +268 -0
  162. package/src/__tests__/consumer-inventory.unit.test.ts +154 -0
  163. package/src/__tests__/copy-src-usage-validity.dawn.test.ts +117 -0
  164. package/src/__tests__/coverage-invariant.test-d.ts +115 -0
  165. package/src/__tests__/coverage-invariant.unit.test.ts +45 -0
  166. package/src/__tests__/e2e.browser.test.ts +239 -0
  167. package/src/__tests__/error-code-narrowing.test-d.ts +32 -0
  168. package/src/__tests__/errors-v7.test-d.ts +19 -0
  169. package/src/__tests__/errors-v7.unit.test.ts +15 -0
  170. package/src/__tests__/errors.unit.test.ts +83 -0
  171. package/src/__tests__/event-semantics-coverage.unit.test.ts +22 -0
  172. package/src/__tests__/format-info.unit.test.ts +85 -0
  173. package/src/__tests__/frame-model-parity.test-d.ts +20 -0
  174. package/src/__tests__/frame-model-parity.unit.test.ts +285 -0
  175. package/src/__tests__/guard-gates.test.ts +317 -0
  176. package/src/__tests__/public-surface.integration.test.ts +38 -0
  177. package/src/__tests__/readback-fault-cleanup.unit.test.ts +66 -0
  178. package/src/__tests__/readback-format-matrix.dawn.test.ts +378 -0
  179. package/src/__tests__/readback-format-matrix.unit.test.ts +120 -0
  180. package/src/__tests__/readback-matrix-fixture.ts +20 -0
  181. package/src/__tests__/recorder-bootstrap.unit.test.ts +302 -0
  182. package/src/__tests__/recorder-budget.unit.test.ts +42 -0
  183. package/src/__tests__/recorder-fail-fast.unit.test.ts +434 -0
  184. package/src/__tests__/recorder-lifecycle.unit.test.ts +42 -0
  185. package/src/__tests__/recorder-push-event.unit.test.ts +573 -0
  186. package/src/__tests__/recorder-session.integration.test.ts +32 -0
  187. package/src/__tests__/recorder-session.unit.test.ts +63 -0
  188. package/src/__tests__/recorder-steady-frame.dawn.test.ts +52 -0
  189. package/src/__tests__/replay-fail-fast.unit.test.ts +155 -0
  190. package/src/__tests__/replay-session.dawn.test.ts +220 -0
  191. package/src/__tests__/replay-session.test-d.ts +27 -0
  192. package/src/__tests__/replay-session.unit.test.ts +171 -0
  193. package/src/__tests__/resolve-texture-descriptor.unit.test.ts +144 -0
  194. package/src/__tests__/resource-lifecycle.unit.test.ts +114 -0
  195. package/src/__tests__/rhi-debug-fresh-replay.dawn.test.ts +178 -0
  196. package/src/__tests__/tape-index.unit.test.ts +56 -0
  197. package/src/__tests__/tape-v7-invalid.unit.test.ts +45 -0
  198. package/src/__tests__/tape-v7-roundtrip.unit.test.ts +66 -0
  199. package/src/__tests__/tape-v7-version.unit.test.ts +13 -0
  200. package/src/__tests__/tree-shake.unit.test.ts +151 -0
  201. package/src/__tests__/types.test.ts +257 -0
  202. package/src/browser.ts +146 -0
  203. package/src/errors.ts +173 -0
  204. package/src/frame-model.ts +753 -0
  205. package/src/index.ts +92 -0
  206. package/src/pako.d.ts +8 -0
  207. package/src/protocol/codec.ts +220 -0
  208. package/src/protocol/event-semantics.ts +180 -0
  209. package/src/protocol/tape-index.ts +120 -0
  210. package/src/protocol/types.ts +60 -0
  211. package/src/protocol/validation.ts +173 -0
  212. package/src/readback.ts +804 -0
  213. package/src/recorder/assemble.ts +192 -0
  214. package/src/recorder/closure.ts +408 -0
  215. package/src/recorder/core.ts +587 -0
  216. package/src/recorder/device.ts +474 -0
  217. package/src/recorder/encoder.ts +251 -0
  218. package/src/recorder/lifecycle.ts +847 -0
  219. package/src/recorder/pass.ts +241 -0
  220. package/src/recorder/proxy.ts +59 -0
  221. package/src/recorder/queue.ts +109 -0
  222. package/src/recorder/resource-registry.ts +53 -0
  223. package/src/recorder/session.ts +152 -0
  224. package/src/recorder/shader.ts +47 -0
  225. package/src/recorder/snapshot.ts +38 -0
  226. package/src/recorder/wrap.ts +157 -0
  227. package/src/recorder.ts +15 -0
  228. package/src/replay/device-request.ts +38 -0
  229. package/src/replay/execute-support.ts +243 -0
  230. package/src/replay/execute.ts +870 -0
  231. package/src/replay/readback.ts +671 -0
  232. package/src/replay/resources.ts +154 -0
  233. package/src/replay/session.ts +509 -0
  234. package/src/replay/texture-format.ts +99 -0
  235. package/src/texel-decode.ts +289 -0
  236. package/src/texel-layout.ts +324 -0
  237. package/src/types.ts +888 -0
@@ -0,0 +1,296 @@
1
+ import type { Result, RhiDevice, RhiInstance, ShaderModule, TextureView } from '@forgeax/engine-rhi';
2
+ import { type RhiDebugError } from '../errors';
3
+ import type { HandleId, RhiCallEvent, RhiCapsRecorded, Tape } from '../types';
4
+ declare const SNAPSHOT_TIMEOUT_MS = 30000;
5
+ export declare const PER_EVENT_OVERHEAD: 192;
6
+ declare const TEXTURE_USAGE_COPY_SRC = 1;
7
+ declare const TEXTURE_USAGE_COPY_DST = 2;
8
+ declare const TEXTURE_USAGE_BINDING = 4;
9
+ /** Bound staging allocation, command submission, and map concurrency per batch. */
10
+ export declare const SNAPSHOT_RESOURCE_BATCH_SIZE = 32;
11
+ /**
12
+ * True for each depth / stencil texture format. Their content is render-pass
13
+ * output (shadow maps, z-buffers), never an uploaded byte payload, and
14
+ * queue.writeTexture rejects them (no CopyDst), so the frame-header snapshot
15
+ * loop skips them rather than emitting an un-seedable initialData event.
16
+ */
17
+ declare function isDepthOrStencilFormat(format: GPUTextureFormat | undefined): boolean;
18
+ /**
19
+ * True for a texture the frame-header snapshot can read back AND re-seed
20
+ * faithfully: each color format with a known texel-block footprint, at each
21
+ * array-layer count and each mip count. The readback + seed path
22
+ * (readbackTexturePixels + computeTextureLayout + replayInitialData) walks
23
+ * every (layer, mip) subresource with block-aware bytesPerRow, so ordinary
24
+ * texels and BC/ETC/ASTC compressed assets share one round-trip contract.
25
+ *
26
+ * Still skipped (no faithful path today, Fail Fast rather than corrupt seed):
27
+ * - depth/stencil formats: queue.writeTexture rejects them (no CopyDst seed).
28
+ * - multisample (sampleCount > 1): writeTexture rejects an MSAA target. MSAA
29
+ * attachments are transient (resolved into a single-sample texture that IS
30
+ * snapshottable), so skipping loses no seed.
31
+ */
32
+ declare function isSnapshottableColorTexture(format: GPUTextureFormat | undefined, _size: number | GPUExtent3DStrict | undefined, sampleCount?: number): boolean;
33
+ /** Add COPY_SRC to a buffer usage unless it is a mappable (MAP_READ/WRITE) buffer. */
34
+ declare function promoteBufferUsage(usage: number): number;
35
+ /**
36
+ * True for a mappable (MAP_READ / MAP_WRITE) buffer. These are staging buffers
37
+ * (e.g. shadow-probe-staging): promoteBufferUsage deliberately does NOT add
38
+ * COPY_SRC to them (MAP_READ|COPY_SRC is an invalid WebGPU usage combo), so they
39
+ * cannot be a copyBufferToBuffer source. The frame-header snapshot loop must skip
40
+ * them — driving readbackBufferBytes on one throws "usage doesn't include
41
+ * CopySrc". Their bytes are transient readback scratch, never seed payload, so
42
+ * losing them is correct (mirrors promoteBufferUsage's own exclusion).
43
+ */
44
+ declare function isMappableBuffer(usage: number): boolean;
45
+ export { TAPE_FORMAT_VERSION } from '../protocol/types';
46
+ declare enum RecorderState {
47
+ Idle = "idle",
48
+ Armed = "armed",
49
+ Snapshotting = "snapshotting",
50
+ Recording = "recording",
51
+ Finalizing = "finalizing",
52
+ Error = "error"
53
+ }
54
+ declare function allocHandleId(kind: string): HandleId;
55
+ declare function fastHash(data: ArrayBuffer): string;
56
+ declare function storeBlob(state: RecorderInternal, data: ArrayBuffer): string;
57
+ /**
58
+ * Narrow a readbackBufferBytes failure to the snapshot stage.
59
+ * readbackBufferBytes already tags `.detail.phase` with 'copy' | 'map'; carry
60
+ * it through so the re-wrapped error preserves the failure point. Falls back to
61
+ * 'copy' when the inner error lacks a snapshot detail.
62
+ */
63
+ declare function snapshotStageOf(error: RhiDebugError): 'copy' | 'map' | 'store';
64
+ type SnapshotProgress = {
65
+ readonly startedAt: number;
66
+ readonly stage: 'queue-drain' | 'resource-readback';
67
+ readonly totalResources: number;
68
+ readonly completedResources: number;
69
+ readonly skippedResources: number;
70
+ readonly currentHandleId: string | null;
71
+ readonly currentKind: 'buffer' | 'texture' | null;
72
+ readonly currentSizeBytes: number | null;
73
+ };
74
+ interface RecorderInternal {
75
+ state: RecorderState;
76
+ requestedFrames: number;
77
+ recordedFrames: number;
78
+ events: RhiCallEvent[];
79
+ blobPool: Map<string, ArrayBuffer>;
80
+ handleMap: WeakMap<object, HandleId>;
81
+ textureViewHandleMap: WeakMap<TextureView, HandleId>;
82
+ /**
83
+ * @internal
84
+ * Bootstrap create-event table. Populated by registerHandle when called
85
+ * with a create event payload — records every create* (buffer, texture,
86
+ * pipeline, bindGroup, shaderModule, …) from the moment wrap() is called,
87
+ * independent of the recorder state machine (Idle / Armed / Recording).
88
+ * Preserved across arm() cycles (SSOT for closure computation in getTape).
89
+ */
90
+ bootstrapCreates: Map<HandleId, RhiCallEvent>;
91
+ /** Handles whose initialData event was emitted by the current capture. */
92
+ snapshotSeededHandles: Set<HandleId>;
93
+ /** Generation token invalidating async snapshot work after timeout/error. */
94
+ snapshotGeneration: number;
95
+ /** Last observable progress of the current/most recent resource snapshot. */
96
+ snapshotProgress: SnapshotProgress | undefined;
97
+ /**
98
+ * @internal
99
+ * Descriptor registry of currently-live resources. Written by createBuffer /
100
+ * createTexture (after registerHandle) and cleared by destroyBuffer /
101
+ * destroyTexture. Distinct from handleMap (WeakMap, handle object -> handleId
102
+ * identity, one-way): descriptorTable carries the descriptor *content* (kind /
103
+ * size / format / usage) AND the resource object keyed by handleId, so
104
+ * snapshotResource can both determine a resource's shape and reach the object
105
+ * for readback at frame-header time without re-scanning the event stream or
106
+ * reverse-walking the WeakMap (which cannot be iterated). destroy* removes the
107
+ * entry so the live-resource set never grows unbounded (AC-09). One registry,
108
+ * one delete on destroy — shape and object share the same lifecycle (SSOT).
109
+ */
110
+ descriptorTable: Map<HandleId, {
111
+ kind: 'buffer' | 'texture';
112
+ size?: number | GPUExtent3DStrict;
113
+ format?: GPUTextureFormat;
114
+ sampleCount?: number;
115
+ mipLevelCount?: number;
116
+ usage: number;
117
+ resource: object;
118
+ }>;
119
+ /** @internal */
120
+ _skipRecord: boolean;
121
+ frameIdx: number;
122
+ bootstrap: boolean;
123
+ recordedCaps: RhiCapsRecorded | undefined;
124
+ onFrameEndUnsubscribe?: (() => void) | undefined;
125
+ /** true when the current recording is valid. */
126
+ valid: boolean;
127
+ /**
128
+ * @internal
129
+ * Most recent live RhiDevice produced by `requestAdapter().requestDevice()`
130
+ * via the recorder proxy chain. Captured so the adapter (I-2 fix) can
131
+ * reach the same device for replay without forcing the host to expose
132
+ * a separate channel.
133
+ */
134
+ capturedDevice: RhiDevice | undefined;
135
+ }
136
+ declare function snapshotTimeoutDetail(progress: SnapshotProgress | undefined, timeoutMs: number): import('../errors').CaptureTimeoutDetail;
137
+ /**
138
+ * @internal
139
+ * True while the recorder is in a state that appends normal RHI events to the
140
+ * tape: Armed / Recording. Snapshotting is deliberately excluded: the async
141
+ * frame-header seed phase must not fold live viewport frames into the capture.
142
+ * This is the SSOT recording predicate —
143
+ * `pushEvent` gates on it, and the proxy fast-path (writeBuffer / writeTexture /
144
+ * createCommandEncoder) short-circuits when it is false so an idle recorder
145
+ * (FORGEAX_ENGINE_RHI_DEBUG=1 but no capture in flight) pays no per-call
146
+ * event-object allocation, no storeBlob hash+copy, and no proxy-encoder wrapping.
147
+ *
148
+ * Deliberately ignores `_skipRecord`: that flag suppresses recorder-internal
149
+ * RHI calls (such as snapshot readback staging) during either capture phase.
150
+ * `shouldRecord` folds it in for the normal pushEvent gate.
151
+ */
152
+ declare function isRecordingActive(s: RecorderInternal): boolean;
153
+ /**
154
+ * A frame-header snapshot is not a normal render-recording phase, but it can
155
+ * already have copied a live resource and still need that resource's create
156
+ * event when it appends `initialData`. Keep bootstrap ownership through that
157
+ * async window: per-frame feature resources may be released while readback is
158
+ * awaiting GPU completion.
159
+ */
160
+ declare function retainsCaptureBootstrap(s: RecorderInternal): boolean;
161
+ /**
162
+ * @internal
163
+ * The exact pushEvent gate as a predicate: record iff not suppressed AND in an
164
+ * active recording state. Proxy methods that do pre-pushEvent work (storeBlob,
165
+ * event-object construction) check this first to skip that work when it would
166
+ * be discarded — same-condition-as-pushEvent guarantees no behavioural drift
167
+ * (a call that would record still does all its work).
168
+ */
169
+ declare function shouldRecord(s: RecorderInternal): boolean;
170
+ declare function pushEvent(s: RecorderInternal, event: RhiCallEvent): void;
171
+ /**
172
+ * Append a frame-header seed without reopening the normal RHI event gate.
173
+ * Snapshotting is not a render-recording state, but its async readback still
174
+ * needs to emit initialData events for the resources that seed replay.
175
+ */
176
+ declare function pushSnapshotEvent(s: RecorderInternal, event: RhiCallEvent): void;
177
+ declare function registerHandle(s: RecorderInternal, handle: object, kind: string, createEvent?: RhiCallEvent): HandleId;
178
+ declare function ensureTextureCreateEvent(s: RecorderInternal, texture: object, textureId: HandleId, viewFormat?: GPUTextureFormat): RhiDebugError | undefined;
179
+ declare function addSwapchainViewFormat(texture: Extract<RhiCallEvent, {
180
+ kind: 'createTexture';
181
+ }>, viewFormat: GPUTextureFormat): void;
182
+ declare function reconcileSwapchainViewFormats(s: RecorderInternal): void;
183
+ declare function hasBootstrapDependency(s: RecorderInternal, handleId: HandleId): boolean;
184
+ declare function getHandleId(s: RecorderInternal, handle: object, kind: string): HandleId;
185
+ /**
186
+ * @internal
187
+ * Collect all handleIds referenced by frame events in `s.events`.
188
+ *
189
+ * Scans events for ALL fields that reference resources — mirrors
190
+ * the reference categories checked by findDanglingHandleId in
191
+ * tape-format.ts to achieve producer/consumer convergence (D-2).
192
+ *
193
+ * Includes: buffer/texture/pipeline/bindGroup/sampler/textureView/
194
+ * shaderModule handles (persistent), plus passHandleId and cmdHandleId
195
+ * from pass/encoder events (per-frame transient). Transient handles
196
+ * that are declared in-frame are excluded later by the inFrameHandleIds
197
+ * filter in getTape().
198
+ */
199
+ export interface DebugRhiInstance extends RhiInstance {
200
+ arm(frames: number): Result<void, RhiDebugError>;
201
+ onFrameEnd(): void;
202
+ getTape(): Tape | RhiDebugError | undefined;
203
+ getState(): string;
204
+ getEvents(): readonly RhiCallEvent[];
205
+ getBlobPool(): ReadonlyMap<string, ArrayBuffer>;
206
+ /** Transition to error state (e.g. on device.lost). Tape data preserved but valid=false. */
207
+ transitionToError(): void;
208
+ /** Clear error state to idle, allowing re-arm. */
209
+ disposeError(): void;
210
+ /**
211
+ * Snapshot a resource's GPU bytes into the tape as an initialData event.
212
+ *
213
+ * Reads the resource descriptor from the internal registry, copies the
214
+ * resource's bytes via copyToBuffer/mapAsync, stores the bytes into the
215
+ * blobPool (djb2 hash-dedup), and pushes an RhiCallEventInitialData into
216
+ * the event stream. Returns Result with {handleId, dataHash} on success,
217
+ * or capture-snapshot-failed on a readback/storeBlob failure.
218
+ *
219
+ * Async: the GPU readback chain (copyToBuffer -> submit ->
220
+ * onSubmittedWorkDone -> mapAsync) is inherently asynchronous.
221
+ */
222
+ snapshotResource(handleId: HandleId): Promise<Result<{
223
+ handleId: HandleId;
224
+ dataHash: string;
225
+ }, RhiDebugError>>;
226
+ /**
227
+ * Frame-header snapshot loop: awaits all submitted GPU work, then snapshots
228
+ * every live resource in the descriptor registry (full-table dump, no
229
+ * trimming). Advances the recorder Armed -> Snapshotting -> Recording on
230
+ * success. Returns the first snapshot failure as a Result so the caller can
231
+ * fail fast rather than record a partial seed set.
232
+ */
233
+ snapshotAllLiveResources(timeoutMs?: number): Promise<Result<void, RhiDebugError>>;
234
+ /**
235
+ * @internal
236
+ * Append an event from a standalone wrapper (e.g. `wrapCreateShaderModule`)
237
+ * through the same `_skipRecord` + state-machine guard that the proxy
238
+ * methods use. This exists so external wrappers cannot bypass recursion
239
+ * protection (I-12, round 1 implement-review). Not part of the AI-user
240
+ * contract — `wrap*` helpers in this package are the only callers.
241
+ */
242
+ pushExternalEvent(event: RhiCallEvent): void;
243
+ /**
244
+ * @internal
245
+ * Register a shader module object in the recorder's handleMap so
246
+ * downstream pipeline events can look up its handleId via getHandleId.
247
+ */
248
+ registerShaderModule(handle: ShaderModule, handleId: HandleId): void;
249
+ /**
250
+ * @internal
251
+ * Route a create event through registerHandle (alloc id + write bootstrapCreates)
252
+ * and pushEvent in a single call. For standalone wrappers that cannot access
253
+ * the internal registerHandle/pushEvent functions directly.
254
+ * Returns the allocated HandleId so the caller can use it for downstream
255
+ * registration (e.g. shaderModule → handleMap).
256
+ */
257
+ pushExternalCreateEvent(handle: object, kind: string, event: RhiCallEvent): HandleId;
258
+ /**
259
+ * @internal
260
+ * Drop all device-bound recorder state after the host observes a real
261
+ * device loss. A tape recorded against the lost device cannot seed a fresh
262
+ * device, so the next capture must start from the rebuilt resource graph.
263
+ */
264
+ resetForDeviceLoss(): void;
265
+ /** @internal Return whether the current capture is valid. */
266
+ valid(): boolean;
267
+ /**
268
+ * @internal
269
+ * Return the number of entries in bootstrapCreates. Test-only accessor
270
+ * so unit tests can verify bootstrapCreates write/retain semantics
271
+ * without going through getTape() closure computation (M2).
272
+ */
273
+ bootstrapCreatesSize(): number;
274
+ /** @internal Return the create-event identities owned by the bootstrap registry. */
275
+ bootstrapEvents(): readonly RhiCallEvent[];
276
+ /**
277
+ * @internal
278
+ * Read-only view of the descriptor registry keyed by handleId. Test-only
279
+ * accessor so unit tests can verify create* register / destroy* remove
280
+ * semantics (AC-09) without reaching into the closed-over recorder state.
281
+ */
282
+ descriptorTable(): ReadonlyMap<HandleId, {
283
+ kind: 'buffer' | 'texture';
284
+ size?: number | GPUExtent3DStrict;
285
+ format?: GPUTextureFormat;
286
+ usage: number;
287
+ resource: object;
288
+ }>;
289
+ }
290
+ export type CreateShaderModuleFn = (device: RhiDevice, desc: {
291
+ code: string;
292
+ label?: string | undefined;
293
+ }) => Promise<Result<ShaderModule, import('@forgeax/engine-rhi').RhiError>>;
294
+ export type { RecorderInternal, SnapshotProgress };
295
+ export { addSwapchainViewFormat, allocHandleId, ensureTextureCreateEvent, fastHash, getHandleId, hasBootstrapDependency, isDepthOrStencilFormat, isMappableBuffer, isRecordingActive, isSnapshottableColorTexture, promoteBufferUsage, pushEvent, pushSnapshotEvent, RecorderState, reconcileSwapchainViewFormats, registerHandle, retainsCaptureBootstrap, SNAPSHOT_TIMEOUT_MS, shouldRecord, snapshotStageOf, snapshotTimeoutDetail, storeBlob, TEXTURE_USAGE_BINDING, TEXTURE_USAGE_COPY_DST, TEXTURE_USAGE_COPY_SRC, };
296
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.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AE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KAC/C,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,qBAAqB,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3E,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,QAAQ,EACR,WAAW,EACX,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,6BAA6B,EAC7B,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,GACvB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RhiDevice } from '@forgeax/engine-rhi';
2
+ import type { RecorderInternal } from './core';
3
+ export declare function createDeviceProxy(s: RecorderInternal, realDevice: RhiDevice): RhiDevice;
4
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/recorder/device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAYV,SAAS,EAKV,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAmB/C,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,GAAG,SAAS,CAyavF"}
@@ -0,0 +1,5 @@
1
+ import type { RhiCommandEncoder } from '@forgeax/engine-rhi';
2
+ import type { HandleId } from '../types';
3
+ import type { RecorderInternal } from './core';
4
+ export declare function createCommandEncoderProxy(s: RecorderInternal, realEnc: RhiCommandEncoder, cmdHId: HandleId): RhiCommandEncoder;
5
+ //# sourceMappingURL=encoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../src/recorder/encoder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAI/C,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,gBAAgB,EACnB,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,QAAQ,GACf,iBAAiB,CAyOnB"}
@@ -0,0 +1,20 @@
1
+ import type { Result } from '@forgeax/engine-rhi';
2
+ import { type RhiDebugError } from '../errors';
3
+ import type { HandleId, RhiCallEvent, Tape } from '../types';
4
+ import { type RecorderInternal } from './core';
5
+ export declare function createRecorderLifecycle(s: RecorderInternal): {
6
+ arm: (frames: number) => Result<void, RhiDebugError>;
7
+ onFrameEnd: () => void;
8
+ getTape: () => Tape | RhiDebugError | undefined;
9
+ getState: () => string;
10
+ getEvents: () => readonly RhiCallEvent[];
11
+ getBlobPool: () => ReadonlyMap<string, ArrayBuffer>;
12
+ transitionToError: () => void;
13
+ disposeError: () => void;
14
+ snapshotResource: (handleId: HandleId, snapshotGeneration?: number) => Promise<Result<{
15
+ handleId: HandleId;
16
+ dataHash: string;
17
+ }, RhiDebugError>>;
18
+ snapshotAllLiveResources: (timeoutMs?: number) => Promise<Result<void, RhiDebugError>>;
19
+ };
20
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/recorder/lifecycle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAQpE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAO7D,OAAO,EAKL,KAAK,gBAAgB,EAStB,MAAM,QAAQ,CAAC;AAEhB,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,gBAAgB;kBACpC,MAAM,KAAG,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC;sBAyClC,IAAI;mBAkDP,IAAI,GAAG,aAAa,GAAG,SAAS;oBAgI/B,MAAM;qBAGL,SAAS,YAAY,EAAE;uBAGrB,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC;6BAI1B,IAAI;wBAiBT,IAAI;iCAgCjB,QAAQ,uBACG,MAAM,KAC1B,OAAO,CAAC,MAAM,CAAC;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,aAAa,CAAC,CAAC;sDA4JxE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;EAoXxC"}
@@ -0,0 +1,6 @@
1
+ import type { RhiComputePassEncoder, RhiRenderPassEncoder } from '@forgeax/engine-rhi';
2
+ import type { HandleId } from '../types';
3
+ import type { RecorderInternal } from './core';
4
+ export declare function createRenderPassProxy(s: RecorderInternal, realPass: RhiRenderPassEncoder, passHId: HandleId): RhiRenderPassEncoder;
5
+ export declare function createComputePassProxy(s: RecorderInternal, realPass: RhiComputePassEncoder, passHId: HandleId): RhiComputePassEncoder;
6
+ //# sourceMappingURL=pass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pass.d.ts","sourceRoot":"","sources":["../../src/recorder/pass.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG/C,wBAAgB,qBAAqB,CACnC,CAAC,EAAE,gBAAgB,EACnB,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE,QAAQ,GAChB,oBAAoB,CA6KtB;AAED,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,gBAAgB,EACnB,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,QAAQ,GAChB,qBAAqB,CA6CvB"}
@@ -0,0 +1,19 @@
1
+ import type { RhiCanvasContext, RhiDevice, RhiError, RhiInstance } from '@forgeax/engine-rhi';
2
+ import { type Result } from '@forgeax/engine-types';
3
+ import { type RhiDebugError } from '../errors';
4
+ import { type CreateShaderModuleFn, type DebugRhiInstance } from '../recorder';
5
+ export interface RecordableBackend {
6
+ readonly rhi: RhiInstance & {
7
+ readonly acquireCanvasContext?: (canvas: HTMLCanvasElement | OffscreenCanvas) => Result<RhiCanvasContext, RhiError>;
8
+ };
9
+ readonly createShaderModule: CreateShaderModuleFn;
10
+ }
11
+ export interface RecorderBackend extends RecordableBackend {
12
+ readonly unwrapDeviceForSurface: (device: RhiDevice) => Result<RhiDevice, RhiDebugError>;
13
+ }
14
+ export interface RecorderProxy {
15
+ readonly backend: RecorderBackend;
16
+ readonly recorder: DebugRhiInstance;
17
+ }
18
+ export declare function createRecorderProxy(backend: RecordableBackend): RecorderProxy;
19
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/recorder/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EAGtB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG;QAC1B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC9B,MAAM,EAAE,iBAAiB,GAAG,eAAe,KACxC,MAAM,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;KACzC,CAAC;IACF,QAAQ,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;CACnD;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,QAAQ,CAAC,sBAAsB,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;CAC1F;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CA8B7E"}
@@ -0,0 +1,4 @@
1
+ import type { RhiQueue } from '@forgeax/engine-rhi';
2
+ import type { RecorderInternal } from './core';
3
+ export declare function createQueueProxy(s: RecorderInternal, realQueue: RhiQueue): RhiQueue;
4
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/recorder/queue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG/C,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAqGnF"}
@@ -0,0 +1,15 @@
1
+ import type { DebugRhiInstance } from '../recorder';
2
+ import type { HandleId } from '../types';
3
+ export interface ResourceCandidate {
4
+ readonly handleId: HandleId;
5
+ readonly kind: 'buffer' | 'texture';
6
+ readonly estimatedBytes: number;
7
+ }
8
+ export declare class ResourceRegistry {
9
+ private readonly recorder;
10
+ constructor(recorder: DebugRhiInstance);
11
+ candidates(): readonly ResourceCandidate[];
12
+ estimateSnapshotBytes(): number;
13
+ clearGeneration(): void;
14
+ }
15
+ //# sourceMappingURL=resource-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-registry.d.ts","sourceRoot":"","sources":["../../src/recorder/resource-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,gBAAgB;IAEvD,UAAU,IAAI,SAAS,iBAAiB,EAAE;IAQ1C,qBAAqB,IAAI,MAAM;IAI/B,eAAe,IAAI,IAAI;CAIxB"}
@@ -0,0 +1,25 @@
1
+ import { type Result } from '@forgeax/engine-types';
2
+ import { type RhiDebugError } from '../errors';
3
+ import { type EncodedTape } from './assemble';
4
+ import { type RecordableBackend, type RecorderBackend } from './proxy';
5
+ export interface CaptureFrameOptions {
6
+ readonly snapshotTimeoutMs?: number;
7
+ readonly byteBudget?: number;
8
+ readonly signal?: AbortSignal;
9
+ }
10
+ export interface RecorderOptions {
11
+ readonly snapshotTimeoutMs?: number;
12
+ readonly byteBudget?: number;
13
+ }
14
+ export interface RecorderAttachment {
15
+ readonly backend: RecorderBackend;
16
+ captureFrame(options?: CaptureFrameOptions): Promise<Result<EncodedTape, RhiDebugError>>;
17
+ frameBoundary(): Promise<Result<void, RhiDebugError>>;
18
+ deviceLost(): void;
19
+ dispose(): Promise<Result<void, RhiDebugError>>;
20
+ }
21
+ export declare function attachRecorder(backend: RecordableBackend, options?: RecorderOptions): Result<RecorderAttachment, RhiDebugError>;
22
+ export type { CreateShaderModuleFn } from '../recorder';
23
+ export type { EncodedTape } from './assemble';
24
+ export type { RecordableBackend, RecorderBackend } from './proxy';
25
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/recorder/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAuB,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAI5F,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;IACzF,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;IACtD,UAAU,IAAI,IAAI,CAAC;IACnB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;CACjD;AAID,wBAAgB,cAAc,CAC5B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,GAAE,eAAoB,GAC5B,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAoH3C;AAED,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CreateShaderModuleFn, DebugRhiInstance } from './core';
2
+ export declare function wrapCreateShaderModule(originalFn: CreateShaderModuleFn, debugInst: DebugRhiInstance): CreateShaderModuleFn;
3
+ //# sourceMappingURL=shader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../../src/recorder/shader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAErE,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,oBAAoB,EAChC,SAAS,EAAE,gBAAgB,GAC1B,oBAAoB,CAqCtB"}
@@ -0,0 +1,10 @@
1
+ import { type Result } from '@forgeax/engine-types';
2
+ import { type RhiDebugError } from '../errors';
3
+ import type { DebugRhiInstance } from '../recorder';
4
+ import type { ResourceRegistry } from './resource-registry';
5
+ export interface SnapshotOptions {
6
+ readonly snapshotTimeoutMs: number;
7
+ readonly byteBudget: number;
8
+ }
9
+ export declare function snapshotFrame(recorder: DebugRhiInstance, registry: ResourceRegistry, options: SnapshotOptions): Promise<Result<void, RhiDebugError>>;
10
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/recorder/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAuBtC"}
@@ -0,0 +1,4 @@
1
+ import type { RhiInstance } from '@forgeax/engine-rhi';
2
+ import { type DebugRhiInstance } from './core';
3
+ export declare function wrap(instance: RhiInstance): DebugRhiInstance;
4
+ //# sourceMappingURL=wrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../src/recorder/wrap.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAMV,WAAW,EAEZ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,KAAK,gBAAgB,EAKtB,MAAM,QAAQ,CAAC;AAIhB,wBAAgB,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,gBAAgB,CAmI5D"}
@@ -0,0 +1,7 @@
1
+ export type { CreateShaderModuleFn, DebugRhiInstance } from './recorder/core';
2
+ export { PER_EVENT_OVERHEAD, TAPE_FORMAT_VERSION } from './recorder/core';
3
+ export type { CaptureFrameOptions, EncodedTape, RecordableBackend, RecorderAttachment, RecorderBackend, RecorderOptions, } from './recorder/session';
4
+ export { attachRecorder } from './recorder/session';
5
+ export { wrapCreateShaderModule } from './recorder/shader';
6
+ export { wrap } from './recorder/wrap';
7
+ //# sourceMappingURL=recorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../src/recorder.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Tape } from '../protocol/types';
2
+ /**
3
+ * Build the strongest fresh WebGPU device the current adapter can provide for
4
+ * a recorded tape. Optional features must be enabled, not merely advertised,
5
+ * and replay receives concrete adapter limits instead of lower device defaults.
6
+ */
7
+ export declare function replayDeviceRequest(tape: Tape, adapterFeatures: ReadonlySet<GPUFeatureName>, adapterLimits: Readonly<Record<string, number>>): GPUDeviceDescriptor;
8
+ //# sourceMappingURL=device-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-request.d.ts","sourceRoot":"","sources":["../../src/replay/device-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAY9C;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,WAAW,CAAC,cAAc,CAAC,EAC5C,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC9C,mBAAmB,CAgBrB"}
@@ -0,0 +1,33 @@
1
+ import type { RhiCommandEncoder, RhiComputePassEncoder, RhiRenderPassEncoder } from '@forgeax/engine-rhi';
2
+ import { type Result } from '@forgeax/engine-types';
3
+ import { type RhiDebugError } from '../errors';
4
+ import type { RhiCallEvent, Tape } from '../protocol/types';
5
+ import type { ReplayExecutionContext } from './execute';
6
+ import type { ReplayResource } from './resources';
7
+ type ReplayPass = RhiRenderPassEncoder & RhiComputePassEncoder;
8
+ export declare function eventRecord(event: RhiCallEvent): Record<string, unknown>;
9
+ export declare function eventFailure(eventIndex: number, event: RhiCallEvent, stage: 'lookup' | 'create' | 'write' | 'encode' | 'finish' | 'submit', cause: unknown): Result<never, RhiDebugError>;
10
+ export declare function blob(tape: Tape, hash: string, event: RhiCallEvent, eventIndex: number): Result<Uint8Array, RhiDebugError>;
11
+ export declare function clearBuffer(context: ReplayExecutionContext, event: Extract<RhiCallEvent, {
12
+ kind: 'clearBuffer';
13
+ }>, eventIndex: number): Result<void, RhiDebugError>;
14
+ export declare function commandEncoderCall(context: ReplayExecutionContext, event: Extract<RhiCallEvent, {
15
+ kind: 'pushDebugGroup' | 'popDebugGroup' | 'insertDebugMarker';
16
+ }>, eventIndex: number, call: (encoder: RhiCommandEncoder) => void): Result<void, RhiDebugError>;
17
+ export declare function finish(context: ReplayExecutionContext, event: Extract<RhiCallEvent, {
18
+ kind: 'finish';
19
+ }>, eventIndex: number): Result<void, RhiDebugError>;
20
+ export declare function endPass(context: ReplayExecutionContext, event: Extract<RhiCallEvent, {
21
+ kind: 'endRenderPass' | 'endComputePass';
22
+ }>, eventIndex: number, role: 'render-pass' | 'compute-pass'): Result<void, RhiDebugError>;
23
+ export declare function seedInitialData(context: ReplayExecutionContext, event: Extract<RhiCallEvent, {
24
+ kind: 'initialData';
25
+ }>, eventIndex: number): Result<void, RhiDebugError>;
26
+ export declare function requireResource<T>(context: ReplayExecutionContext, resourceId: string, kind: ReplayResource['kind'] | string, eventIndex: number, eventKind: RhiCallEvent['kind'], role?: string): Result<T, RhiDebugError>;
27
+ export declare function requireReplayResource(context: ReplayExecutionContext, resourceId: string, kind: ReplayResource['kind'] | string, eventIndex: number, eventKind: RhiCallEvent['kind'], role?: string): Result<ReplayResource, RhiDebugError>;
28
+ export declare function passCall(context: ReplayExecutionContext, event: RhiCallEvent, eventIndex: number, role: 'render-pass' | 'compute-pass' | 'pass', call: (pass: ReplayPass) => Result<void, RhiDebugError>): Result<void, RhiDebugError>;
29
+ export declare function pipelineError<T>(result: Result<T, RhiDebugError>, event: RhiCallEvent, eventIndex: number): Result<never, RhiDebugError>;
30
+ export declare function missingResource(eventIndex: number, event: RhiCallEvent, resourceId: string, expected: string): Result<never, RhiDebugError>;
31
+ export declare function unsupportedEvent(eventIndex: number, event: RhiCallEvent, cause: string): Result<never, RhiDebugError>;
32
+ export {};
33
+ //# sourceMappingURL=execute-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-support.d.ts","sourceRoot":"","sources":["../../src/replay/execute-support.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,KAAK,UAAU,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AAE/D,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAExE;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,QA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7B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAE9B;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,GACZ,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAE9B"}
@@ -0,0 +1,18 @@
1
+ import type { RhiDevice, RhiError, RhiQueue } from '@forgeax/engine-rhi';
2
+ import { type Result } from '@forgeax/engine-types';
3
+ import type { RhiDebugError } from '../errors';
4
+ import type { RhiCallEvent, Tape } from '../protocol/types';
5
+ import type { ResourceTable } from './resources';
6
+ export { eventFailure } from './execute-support';
7
+ export interface ReplayExecutionContext {
8
+ readonly device: RhiDevice;
9
+ readonly queue: RhiQueue;
10
+ readonly tape: Tape;
11
+ readonly table: ResourceTable;
12
+ readonly createShaderModule: (device: RhiDevice, desc: {
13
+ readonly code: string;
14
+ readonly label?: string | undefined;
15
+ }) => Promise<Result<import('@forgeax/engine-rhi').ShaderModule, RhiError>>;
16
+ }
17
+ export declare function executeEvent(context: ReplayExecutionContext, event: RhiCallEvent, eventIndex: number): Promise<Result<void, RhiDebugError>>;
18
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/replay/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EASV,SAAS,EACT,QAAQ,EACR,QAAQ,EAET,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAM,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAiB5D,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,CAC3B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,KACjE,OAAO,CAAC,MAAM,CAAC,OAAO,qBAAqB,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;CAC5E;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CA+RtC"}
@@ -0,0 +1,32 @@
1
+ import type { RhiDevice } from '@forgeax/engine-rhi';
2
+ import { type Result } from '@forgeax/engine-types';
3
+ import { type RhiDebugError } from '../errors';
4
+ import type { CreateShaderModuleFn } from '../recorder';
5
+ import type { ResourceTable } from './resources';
6
+ export interface BufferReadbackRange {
7
+ readonly offset: number;
8
+ readonly size?: number;
9
+ }
10
+ export interface TextureReadbackSubresource {
11
+ readonly mipLevel?: number;
12
+ readonly arrayLayer?: number;
13
+ readonly aspect?: 'all' | 'depth-only' | 'stencil-only';
14
+ }
15
+ export type ReplayReadbackRequest = BufferReadbackRange | TextureReadbackSubresource;
16
+ export interface ReplayReadbackProvenance {
17
+ readonly generation: number;
18
+ readonly resourceId: string;
19
+ readonly subresource: ReplayReadbackRequest | null;
20
+ readonly selectedWorkIndex?: number;
21
+ }
22
+ export interface ReplayReadbackResult {
23
+ readonly resourceId: string;
24
+ readonly kind: 'buffer' | 'texture';
25
+ readonly format?: string;
26
+ readonly width?: number;
27
+ readonly height?: number;
28
+ readonly bytes: Uint8Array;
29
+ readonly provenance: ReplayReadbackProvenance;
30
+ }
31
+ export declare function readReplayResource(device: RhiDevice, table: ResourceTable, resourceId: string, subresource: ReplayReadbackRequest | undefined, createShaderModule: CreateShaderModuleFn): Promise<Result<ReplayReadbackResult, RhiDebugError>>;
32
+ //# sourceMappingURL=readback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readback.d.ts","sourceRoot":"","sources":["../../src/replay/readback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,SAAS,EAEV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,aAAa,CAAC;AAWrE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,cAAc,CAAC;CACzD;AAED,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,GAAG,0BAA0B,CAAC;AAErF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ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