@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,6 @@
1
+ import { type Result } from '@forgeax/engine-types';
2
+ import { createRhiDebugError } from '../errors';
3
+ import { type Tape, type TapeEncodeOptions } from './types';
4
+ export declare function encodeTape(tape: Tape, options?: TapeEncodeOptions): Result<Uint8Array, ReturnType<typeof createRhiDebugError<'tape-invalid'>>>;
5
+ export declare function decodeTape(bytes: Uint8Array): Result<Tape, ReturnType<typeof createRhiDebugError<'tape-invalid'>> | ReturnType<typeof createRhiDebugError<'tape-version-unsupported'>>>;
6
+ //# sourceMappingURL=codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/protocol/codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAIL,KAAK,IAAI,EAET,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAC;AAqBjB,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,iBAAsB,GAC9B,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC,CAyC5E;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,GAChB,MAAM,CACP,IAAI,EACF,UAAU,CAAC,OAAO,mBAAmB,CAAC,cAAc,CAAC,CAAC,GACtD,UAAU,CAAC,OAAO,mBAAmB,CAAC,0BAA0B,CAAC,CAAC,CACrE,CA4GA"}
@@ -0,0 +1,15 @@
1
+ import type { EventKind, ResourceKind, RhiCallEvent } from './types';
2
+ export type EventCategory = 'resource' | 'pass' | 'state' | 'work' | 'copy' | 'submit' | 'marker';
3
+ export interface EventSemantics {
4
+ readonly category: EventCategory;
5
+ readonly created: (event: RhiCallEvent) => readonly string[];
6
+ readonly read: (event: RhiCallEvent) => readonly string[];
7
+ readonly written: (event: RhiCallEvent) => readonly string[];
8
+ readonly destroyed: (event: RhiCallEvent) => readonly string[];
9
+ }
10
+ export declare const eventKinds: readonly ["frameMark", "createBuffer", "createTexture", "destroyBuffer", "destroyTexture", "createTextureView", "createSampler", "createBindGroupLayout", "createBindGroup", "createPipelineLayout", "createRenderPipeline", "createComputePipeline", "createShaderModule", "createCommandEncoder", "writeBuffer", "writeTexture", "copyExternalImageToTexture", "submit", "beginRenderPass", "beginComputePass", "copyBufferToBuffer", "copyBufferToTexture", "copyTextureToBuffer", "copyTextureToTexture", "clearBuffer", "pushDebugGroup", "popDebugGroup", "insertDebugMarker", "finish", "setPipeline", "setVertexBuffer", "setIndexBuffer", "setBindGroup", "draw", "drawIndexed", "setViewport", "setScissorRect", "setStencilReference", "endRenderPass", "setBlendConstant", "drawIndirect", "drawIndexedIndirect", "passPushDebugGroup", "passPopDebugGroup", "passInsertDebugMarker", "setComputePipeline", "dispatchWorkgroups", "dispatchWorkgroupsIndirect", "endComputePass", "initialData"];
11
+ export declare const workEventKinds: readonly ["draw", "drawIndexed", "drawIndirect", "drawIndexedIndirect", "dispatchWorkgroups", "dispatchWorkgroupsIndirect"];
12
+ export declare function isWorkEvent(kind: EventKind): boolean;
13
+ export declare const EVENT_SEMANTICS: Readonly<Record<EventKind, EventSemantics>>;
14
+ export declare function resourceKindForEvent(kind: EventKind): ResourceKind | undefined;
15
+ //# sourceMappingURL=event-semantics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-semantics.d.ts","sourceRoot":"","sources":["../../src/protocol/event-semantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAErE,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,SAAS,MAAM,EAAE,CAAC;IAC7D,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,SAAS,MAAM,EAAE,CAAC;IAC1D,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,SAAS,MAAM,EAAE,CAAC;IAC7D,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,SAAS,MAAM,EAAE,CAAC;CAChE;AAED,eAAO,MAAM,UAAU,88BAmDkB,CAAC;AAE1C,eAAO,MAAM,cAAc,6HAOc,CAAC;AAE1C,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAEpD;AAED,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAElC,CAAC;AAEvC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,CAwB9E"}
@@ -0,0 +1,30 @@
1
+ import type { EventKind, ResourceKind, Tape } from './types';
2
+ export interface TapePassEntry {
3
+ readonly passIndex: number;
4
+ readonly kind: 'render' | 'compute';
5
+ readonly beginEventIndex: number;
6
+ readonly endEventIndex: number | undefined;
7
+ readonly workIndices: readonly number[];
8
+ }
9
+ export interface TapeWorkEntry {
10
+ readonly workIndex: number;
11
+ readonly eventIndex: number;
12
+ readonly passIndex: number;
13
+ readonly kind: Extract<EventKind, 'draw' | 'drawIndexed' | 'drawIndirect' | 'drawIndexedIndirect' | 'dispatchWorkgroups' | 'dispatchWorkgroupsIndirect'>;
14
+ }
15
+ export interface TapeResourceEntry {
16
+ readonly resourceId: string;
17
+ readonly kind: ResourceKind;
18
+ readonly origin: 'bootstrap' | 'frame';
19
+ readonly createEventIndex: number | undefined;
20
+ readonly destroyEventIndex: number | undefined;
21
+ }
22
+ export interface TapeIndex {
23
+ readonly passes: readonly TapePassEntry[];
24
+ readonly works: readonly TapeWorkEntry[];
25
+ readonly resources: readonly TapeResourceEntry[];
26
+ readonly eventKinds: readonly EventKind[];
27
+ readonly passIndexByEvent: readonly number[];
28
+ }
29
+ export declare function buildTapeIndex(tape: Tape): TapeIndex;
30
+ //# sourceMappingURL=tape-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tape-index.d.ts","sourceRoot":"","sources":["../../src/protocol/tape-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CACpB,SAAS,EACP,MAAM,GACN,aAAa,GACb,cAAc,GACd,qBAAqB,GACrB,oBAAoB,GACpB,4BAA4B,CAC/B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC;IACvC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;CAChD;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACjD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CA6EpD"}
@@ -0,0 +1,44 @@
1
+ import type { Result } from '@forgeax/engine-types';
2
+ import type { RhiDebugError } from '../errors';
3
+ import type { RhiCallEvent as LegacyRhiCallEvent } from '../types';
4
+ export declare const TAPE_FORMAT_VERSION: 7;
5
+ export declare const TAPE_MAGIC: "RHITAPE";
6
+ export type RhiCallEvent = LegacyRhiCallEvent;
7
+ export type EventKind = RhiCallEvent['kind'];
8
+ export type TapeBlobCompression = 'none' | 'gzip';
9
+ export type ResourceKind = 'buffer' | 'texture' | 'texture-view' | 'sampler' | 'shader-module' | 'pipeline' | 'binding' | 'encoder';
10
+ export interface RhiCapsRecorded {
11
+ readonly [key: string]: boolean | number | string | null;
12
+ }
13
+ export interface InitialDataSlice {
14
+ readonly hash: string;
15
+ readonly byteOffset: number;
16
+ readonly byteLength: number;
17
+ }
18
+ export interface BootstrapResource {
19
+ readonly handleId: string;
20
+ readonly kind: ResourceKind;
21
+ readonly create: Record<string, unknown>;
22
+ readonly initialData: readonly InitialDataSlice[];
23
+ }
24
+ export interface TapeBlob {
25
+ readonly hash: string;
26
+ readonly bytes: Uint8Array;
27
+ readonly compression: TapeBlobCompression;
28
+ }
29
+ export interface Tape {
30
+ readonly header: {
31
+ readonly formatVersion: typeof TAPE_FORMAT_VERSION;
32
+ readonly rhiCaps: RhiCapsRecorded;
33
+ readonly eventCount: number;
34
+ readonly blobCount: number;
35
+ };
36
+ readonly bootstrap: readonly BootstrapResource[];
37
+ readonly events: readonly RhiCallEvent[];
38
+ readonly blobs: readonly TapeBlob[];
39
+ }
40
+ export interface TapeEncodeOptions {
41
+ readonly compression?: TapeBlobCompression;
42
+ }
43
+ export type RhiDebugResult<T> = Result<T, RhiDebugError>;
44
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/protocol/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnE,eAAO,MAAM,mBAAmB,EAAG,CAAU,CAAC;AAC9C,eAAO,MAAM,UAAU,EAAG,SAAkB,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,SAAS,GACT,cAAc,GACd,SAAS,GACT,eAAe,GACf,UAAU,GACV,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC1D;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACnD;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;CAC3C;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,aAAa,EAAE,OAAO,mBAAmB,CAAC;QACnD,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;QAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC;CAC5C;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Result } from '@forgeax/engine-types';
2
+ import { createRhiDebugError } from '../errors';
3
+ import { type Tape } from './types';
4
+ type TapeValidation = ReturnType<typeof createRhiDebugError<'tape-invalid'>>;
5
+ export declare function validateTape(tape: Tape): Result<Tape, TapeValidation>;
6
+ export {};
7
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/protocol/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAA6D,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/F,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC;AAE7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAkFrE"}
@@ -0,0 +1,156 @@
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 { RhiCallEvent } from './types';
5
+ /** Resolved descriptor for a texture (or texture-view) handle from the tape. */
6
+ export interface ResolvedTextureDescriptor {
7
+ /** The source GPUTexture handleId (copyTextureToBuffer needs a texture, not a view). */
8
+ readonly handleId: string;
9
+ readonly width: number;
10
+ readonly height: number;
11
+ readonly format: string;
12
+ /** The view's dimension ('2d' | 'cube' | '2d-array' | '3d' | ...); '2d' when no view event. */
13
+ readonly dimension: string;
14
+ /** The source texture's depthOrArrayLayers (slice count); 1 for a plain 2D texture. */
15
+ readonly arrayLayers: number;
16
+ }
17
+ /**
18
+ * Walk the tape events to resolve a view-or-texture handleId to its source
19
+ * GPUTexture descriptor (handleId, real dimensions, format, view dimension).
20
+ *
21
+ * The single source of truth for "tape handle -> texture descriptor": both the
22
+ * color-attachment RT path (resolveAttachmentSize / readbackDrawRt) and the
23
+ * viewer's depth + bound-texture preview paths resolve handles this way —
24
+ * createTextureView.resultHandleId -> sourceHandleId -> createTexture, falling
25
+ * back to the id itself when it is a direct texture handle (no view event).
26
+ *
27
+ * Size is read from the raw createTexture event. Returns null when no
28
+ * createTexture event declares the resolved handle.
29
+ */
30
+ export declare function resolveTextureDescriptor(events: readonly RhiCallEvent[], viewOrTextureHandleId: string): ResolvedTextureDescriptor | null;
31
+ /**
32
+ * Walk the tape events to find the real texture dimensions for a given
33
+ * color attachment view/target handleId. Avoids hard-coding 512×512.
34
+ *
35
+ * Thin wrapper over {@link resolveTextureDescriptor}; returns
36
+ * { width: 512, height: 512 } as a conservative fallback when no createTexture
37
+ * event is found (should not happen for a real frame).
38
+ */
39
+ export declare function resolveAttachmentSize(events: readonly RhiCallEvent[], attachmentViewHandleId: string): {
40
+ readonly width: number;
41
+ readonly height: number;
42
+ };
43
+ /**
44
+ * Read back raw RGBA8 pixels from a GPU texture into a host-side Uint8Array.
45
+ *
46
+ * Steps:
47
+ * 1. Create a staging buffer (COPY_DST | MAP_READ) sized to aligned rows.
48
+ * 2. Create a command encoder + copyTextureToBuffer.
49
+ * 3. Finish + submit + await onSubmittedWorkDone.
50
+ * 4. mapAsync(READ) + getMappedRange() → new Uint8Array(slice).
51
+ * 5. Unmap + destroy staging buffer.
52
+ *
53
+ * The returned Uint8Array has length = texWidth * texHeight * 4 (tight;
54
+ * alignment padding is stripped). The buffer alignment is WebGPU 256-byte
55
+ * row requirement.
56
+ *
57
+ * @param device - The RHI device that owns the texture.
58
+ * @param texture - The texture to read back (opaque branded handle at the boundary).
59
+ * @param texWidth - Texture width in pixels.
60
+ * @param texHeight - Texture height in pixels.
61
+ */
62
+ export declare function readbackTexturePixels(device: RhiDevice, texture: unknown, texWidth: number, texHeight: number, opts?: {
63
+ /** Bytes in one uncompressed texel; retained for depth/color callers. */
64
+ bytesPerTexel?: number;
65
+ /** Compressed-format footprint; defaults to bytesPerTexel with a 1x1 block. */
66
+ bytesPerBlock?: number;
67
+ blockWidth?: number;
68
+ blockHeight?: number;
69
+ mipLevel?: number;
70
+ baseArrayLayer?: number;
71
+ aspect?: 'all' | 'depth-only' | 'stencil-only';
72
+ }): Promise<Uint8Array>;
73
+ /**
74
+ * Read back the raw bytes of a GPU buffer into a host-side ArrayBuffer.
75
+ *
76
+ * Sibling of readbackTexturePixels under the single "GPU byte readback"
77
+ * responsibility unit (plan-strategy D-7) — snapshotResource calls this to
78
+ * capture a buffer's initial GPU bytes at frame-header time.
79
+ *
80
+ * Steps:
81
+ * 1. Create a staging buffer (COPY_DST | MAP_READ) sized to `size`.
82
+ * 2. Create a command encoder + copyBufferToBuffer(src, 0, staging, 0, size).
83
+ * 3. Finish + submit + await onSubmittedWorkDone.
84
+ * 4. mapAsync(READ=0x1) + getMappedRange() -> sliced ArrayBuffer copy.
85
+ * 5. Unmap + destroy staging buffer.
86
+ *
87
+ * Returns Ok(ArrayBuffer) (a detached copy independent of the mapped range)
88
+ * or Err(readback-failed) with `.detail.phase` narrowing
89
+ * the failure point (copy / map). The buffer is passed opaque (`unknown`)
90
+ * because RHI handles are branded; the caller resolved it from the descriptor
91
+ * registry. The caller (snapshotResource) holds the handleId and maps this
92
+ * readback error to the capture-snapshot-failed boundary.
93
+ *
94
+ * Reuses the M0-fixed mapAsync(0x1) + Result-unwrap pattern from
95
+ * readbackTexturePixels (never the all-zero mode=2 bug).
96
+ *
97
+ * @param device - The RHI device that owns the buffer.
98
+ * @param buffer - The source buffer (opaque branded handle) to read back.
99
+ * @param size - Number of bytes to read back (the buffer's recorded size).
100
+ */
101
+ export declare function readbackBufferBytes(device: RhiDevice, buffer: unknown, size: number): Promise<Result<ArrayBuffer, RhiDebugError>>;
102
+ /** A load-time buffer that can be read back as part of one GPU submission. */
103
+ export interface BufferReadbackBatchRequest {
104
+ readonly handleId: string;
105
+ readonly buffer: unknown;
106
+ readonly size: number;
107
+ }
108
+ export interface BufferReadbackBatchCallbacks {
109
+ readonly onResourceStart?: (handleId: string) => void;
110
+ readonly onResourceComplete?: (handleId: string) => void;
111
+ /** Return true when the owning snapshot generation has been invalidated. */
112
+ readonly isCancelled?: () => boolean;
113
+ }
114
+ /**
115
+ * Read back multiple buffers with one command submission and one queue drain.
116
+ *
117
+ * Prism City exposed the cost of the old one-buffer helper: every resource
118
+ * submitted and awaited independently, so thousands of small buffers spent
119
+ * most of capture time in synchronization rather than byte transfer. The
120
+ * batch keeps each staging buffer isolated but submits all copies together;
121
+ * mapping remains per-resource so a timeout can still identify the current
122
+ * handle and the caller can preserve the original initialData event order.
123
+ */
124
+ export declare function readbackBufferBytesBatch(device: RhiDevice, requests: readonly BufferReadbackBatchRequest[], callbacks?: BufferReadbackBatchCallbacks): Promise<Result<ReadonlyMap<string, ArrayBuffer>, RhiDebugError>>;
125
+ /** One (layer, mip) copy contributing to a complete texture snapshot blob. */
126
+ export interface TextureReadbackBatchSlice {
127
+ readonly layer: number;
128
+ readonly mip: number;
129
+ readonly width: number;
130
+ readonly height: number;
131
+ readonly byteOffset: number;
132
+ readonly byteLength: number;
133
+ }
134
+ /** A complete texture whose subresources are copied in one bounded batch. */
135
+ export interface TextureReadbackBatchRequest {
136
+ readonly handleId: string;
137
+ readonly texture: unknown;
138
+ readonly bytesPerBlock: number;
139
+ readonly blockWidth: number;
140
+ readonly blockHeight: number;
141
+ readonly totalBytes: number;
142
+ readonly slices: readonly TextureReadbackBatchSlice[];
143
+ }
144
+ export interface TextureReadbackBatchCallbacks {
145
+ readonly onResourceStart?: (handleId: string) => void;
146
+ readonly onResourceComplete?: (handleId: string) => void;
147
+ /** Return true when the owning snapshot generation has been invalidated. */
148
+ readonly isCancelled?: () => boolean;
149
+ }
150
+ /**
151
+ * Read complete texture snapshots with one submission and drain per bounded
152
+ * resource batch. Each subresource retains its own staging buffer, so mip and
153
+ * array-layer bytes are copied without padding or ordering loss.
154
+ */
155
+ export declare function readbackTexturePixelsBatch(device: RhiDevice, requests: readonly TextureReadbackBatchRequest[], callbacks?: TextureReadbackBatchCallbacks): Promise<Result<ReadonlyMap<string, ArrayBuffer>, RhiDebugError>>;
156
+ //# sourceMappingURL=readback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readback.d.ts","sourceRoot":"","sources":["../src/readback.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ import { type Result } from '@forgeax/engine-types';
2
+ import { type RhiDebugError } from '../errors';
3
+ import type { Tape as V7Tape } from '../protocol/types';
4
+ import type { DebugRhiInstance } from '../recorder';
5
+ export interface EncodedTape {
6
+ readonly bytes: Uint8Array;
7
+ readonly digest: string;
8
+ readonly tape: V7Tape;
9
+ }
10
+ export declare function assembleTape(recorder: DebugRhiInstance): Result<EncodedTape, RhiDebugError>;
11
+ //# sourceMappingURL=assemble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../src/recorder/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAEpE,OAAO,KAAK,EAAqB,IAAI,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAqB3F"}
@@ -0,0 +1,39 @@
1
+ import type { HandleId, RhiCallEvent } from '../types';
2
+ export declare function _collectFrameReferencedHandleIds(events: readonly RhiCallEvent[]): Set<HandleId>;
3
+ /**
4
+ * @internal
5
+ * Return handleIds referenced by a create* event for transitive closure traversal.
6
+ *
7
+ * The edge set follows D-3 (plan-strategy 2):
8
+ * - createBindGroup → layoutHandleId + resourceHandleIds
9
+ * - createPipelineLayout → bglHandleIds
10
+ * - createRenderPipeline → layoutHandleId (if != 'layout:auto') + vertex/fragmentShaderModuleHandleId (R-1)
11
+ * - createComputePipeline → layoutHandleId (if != 'layout:auto') + computeShaderModuleHandleId (R-1)
12
+ * - createTextureView → sourceHandleId
13
+ * Leaf resources (buffer / texture / sampler / BGL / shaderModule) return empty.
14
+ */
15
+ export declare function _getCreateEventReferencedHandleIds(event: RhiCallEvent): HandleId[];
16
+ /**
17
+ * @internal
18
+ * Compute the transitive closure of handleIds from bootstrapCreates.
19
+ *
20
+ * Starting from the given seed set, recursively walks all referenced handleIds
21
+ * via _getCreateEventReferencedHandleIds. Returns the set of all handleIds
22
+ * whose create events must be included in the tape prefix for self-containment.
23
+ *
24
+ * If a referenced handleId is not found in bootstrapCreates, returns
25
+ * `null` for that id — the caller should produce a structured tape error.
26
+ */
27
+ export declare function _computeClosure(seedHandleIds: Set<HandleId>, bootstrapCreates: Map<HandleId, RhiCallEvent>, inFrameHandleIds: Set<HandleId>): {
28
+ closure: Set<HandleId>;
29
+ missing: HandleId | null;
30
+ };
31
+ /**
32
+ * @internal
33
+ * Topologically sort the closure set so that dependencies appear before dependents.
34
+ *
35
+ * Builds a dep-graph: if event A references handleId of event B, then B must
36
+ * appear before A. Uses Kahn's algorithm.
37
+ */
38
+ export declare function _topoSortClosure(closure: Set<HandleId>, bootstrapCreates: Map<HandleId, RhiCallEvent>): RhiCallEvent[];
39
+ //# sourceMappingURL=closure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closure.d.ts","sourceRoot":"","sources":["../../src/recorder/closure.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEvD,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC,CAmP/F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,YAAY,GAAG,QAAQ,EAAE,CA2ClF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,GAAG,CAAC,QAAQ,CAAC,EAC5B,gBAAgB,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,EAC7C,gBAAgB,EAAE,GAAG,CAAC,QAAQ,CAAC,GAC9B;IAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAAC,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,CAwBtD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,EACtB,gBAAgB,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC5C,YAAY,EAAE,CA8ChB"}