@forgeax/engine-render-graph 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 +184 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/observation.unit.test.d.ts +2 -0
- package/dist/__tests__/observation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/render-graph-alias-source.unit.test.d.ts +2 -0
- package/dist/__tests__/render-graph-alias-source.unit.test.d.ts.map +1 -0
- package/dist/__tests__/render-graph-builder.unit.test.d.ts +2 -0
- package/dist/__tests__/render-graph-builder.unit.test.d.ts.map +1 -0
- package/dist/__tests__/render-graph-errors.test-d.d.ts +2 -0
- package/dist/__tests__/render-graph-errors.test-d.d.ts.map +1 -0
- package/dist/__tests__/render-graph-regressions.unit.test.d.ts +2 -0
- package/dist/__tests__/render-graph-regressions.unit.test.d.ts.map +1 -0
- package/dist/__tests__/render-graph-rhi-null.integration.test.d.ts +2 -0
- package/dist/__tests__/render-graph-rhi-null.integration.test.d.ts.map +1 -0
- package/dist/__tests__/render-graph.unit.test.d.ts +2 -0
- package/dist/__tests__/render-graph.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resource-declaration-collision.test.d.ts +2 -0
- package/dist/__tests__/resource-declaration-collision.test.d.ts.map +1 -0
- package/dist/builder.d.ts +42 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/compiled-graph.d.ts +23 -0
- package/dist/compiled-graph.d.ts.map +1 -0
- package/dist/errors.d.ts +148 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/graph.d.ts +403 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +2256 -0
- package/dist/index.mjs.map +1 -0
- package/dist/kernel-internal.d.ts +84 -0
- package/dist/kernel-internal.d.ts.map +1 -0
- package/dist/observation.d.ts +38 -0
- package/dist/observation.d.ts.map +1 -0
- package/dist/pass-registry.d.ts +12 -0
- package/dist/pass-registry.d.ts.map +1 -0
- package/dist/pipeline/__tests__/color-value-domain.test.d.ts +2 -0
- package/dist/pipeline/__tests__/color-value-domain.test.d.ts.map +1 -0
- package/dist/pipeline/color-value-domain.d.ts +35 -0
- package/dist/pipeline/color-value-domain.d.ts.map +1 -0
- package/dist/resource-registry.d.ts +62 -0
- package/dist/resource-registry.d.ts.map +1 -0
- package/dist/types.d.ts +171 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +61 -0
- package/src/__tests__/observation.unit.test.ts +103 -0
- package/src/__tests__/render-graph-alias-source.unit.test.ts +118 -0
- package/src/__tests__/render-graph-builder.unit.test.ts +673 -0
- package/src/__tests__/render-graph-errors.test-d.ts +207 -0
- package/src/__tests__/render-graph-regressions.unit.test.ts +126 -0
- package/src/__tests__/render-graph-rhi-null.integration.test.ts +86 -0
- package/src/__tests__/render-graph.unit.test.ts +2551 -0
- package/src/__tests__/resource-declaration-collision.test.ts +151 -0
- package/src/builder.ts +1009 -0
- package/src/compiled-graph.ts +383 -0
- package/src/errors.ts +205 -0
- package/src/graph.ts +1269 -0
- package/src/index.ts +97 -0
- package/src/kernel-internal.ts +148 -0
- package/src/observation.ts +134 -0
- package/src/pass-registry.ts +43 -0
- package/src/pipeline/__tests__/color-value-domain.test.ts +43 -0
- package/src/pipeline/color-value-domain.ts +139 -0
- package/src/resource-registry.ts +174 -0
- package/src/types.ts +216 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Private code-to-detail authority for the complete RenderGraphError surface.
|
|
3
|
+
*
|
|
4
|
+
* The two resource-key errors intentionally share DanglingReadDetail. Keeping
|
|
5
|
+
* that fact in this map lets the public code and detail unions, plus the
|
|
6
|
+
* constructor arguments, derive from one authority without
|
|
7
|
+
* exporting a framework or runtime registry.
|
|
8
|
+
*/
|
|
9
|
+
interface RenderGraphErrorDetailByCode {
|
|
10
|
+
'dangling-read': DanglingReadDetail;
|
|
11
|
+
'cap-missing': CapMissingDetail;
|
|
12
|
+
'duplicate-resource': DuplicateResourceDetail;
|
|
13
|
+
'alias-source-missing': AliasSourceDetail;
|
|
14
|
+
'unknown-resource': DanglingReadDetail;
|
|
15
|
+
'resource-alloc-failed': ResourceAllocFailedDetail;
|
|
16
|
+
'invalid-format': InvalidFormatDetail;
|
|
17
|
+
'observation-absent': ObservationDetail;
|
|
18
|
+
'observation-invalid-format': ObservationDetail;
|
|
19
|
+
'observation-invalid-size': ObservationDetail;
|
|
20
|
+
'observation-missing-copy-src': ObservationDetail;
|
|
21
|
+
'observation-stale': ObservationDetail;
|
|
22
|
+
'observation-retired': ObservationDetail;
|
|
23
|
+
'invalid-color-domain': ColorDomainDetail;
|
|
24
|
+
'missing-color-domain': ColorDomainDetail;
|
|
25
|
+
'color-domain-mismatch': ColorDomainDetail;
|
|
26
|
+
'duplicate-pass-name': DeclarationDetail;
|
|
27
|
+
'duplicate-resource-label': DeclarationDetail;
|
|
28
|
+
'builder-sealed': DeclarationDetail;
|
|
29
|
+
'foreign-resource-handle': ResourceAccessDetail;
|
|
30
|
+
'resource-not-declared-by-pass': ResourceAccessDetail;
|
|
31
|
+
'uninitialized-read': ResourceAccessDetail;
|
|
32
|
+
'access-conflict': ResourceAccessDetail;
|
|
33
|
+
'capability-missing': CapabilityDetail;
|
|
34
|
+
'resource-descriptor-invalid': DescriptorDetail;
|
|
35
|
+
'import-usage-mismatch': DescriptorDetail;
|
|
36
|
+
'resource-allocation-failed': ResourceAllocFailedDetail;
|
|
37
|
+
'resource-resolution-failed': ResourceAccessDetail;
|
|
38
|
+
'pass-encode-failed': PassFailureDetail;
|
|
39
|
+
'compiled-graph-retired': LifecycleDetail;
|
|
40
|
+
'resource-retire-failed': LifecycleDetail;
|
|
41
|
+
}
|
|
42
|
+
/** Closed RenderGraphErrorCode union derived from the private detail map. */
|
|
43
|
+
export type RenderGraphErrorCode = keyof RenderGraphErrorDetailByCode;
|
|
44
|
+
/** Detail union projected from the private code-to-detail map. */
|
|
45
|
+
export type RenderGraphErrorDetail = RenderGraphErrorDetailByCode[RenderGraphErrorCode];
|
|
46
|
+
/**
|
|
47
|
+
* Constructor arguments correlated by code. `detail` remains optional to
|
|
48
|
+
* preserve the existing envelope behavior for callers that only need the
|
|
49
|
+
* top-level fields.
|
|
50
|
+
*/
|
|
51
|
+
type RenderGraphErrorConstructorArgs = {
|
|
52
|
+
[Code in RenderGraphErrorCode]: {
|
|
53
|
+
code: Code;
|
|
54
|
+
expected: string;
|
|
55
|
+
hint: string;
|
|
56
|
+
detail?: RenderGraphErrorDetailByCode[Code] | undefined;
|
|
57
|
+
};
|
|
58
|
+
}[RenderGraphErrorCode];
|
|
59
|
+
/** Detail variant for dangling-read and unknown-resource errors. */
|
|
60
|
+
export interface DanglingReadDetail {
|
|
61
|
+
readonly resourceKey: string;
|
|
62
|
+
readonly passName: string;
|
|
63
|
+
}
|
|
64
|
+
/** Detail variant for cap-missing errors. */
|
|
65
|
+
export interface CapMissingDetail {
|
|
66
|
+
readonly cap: 'compute' | 'storageBuffer';
|
|
67
|
+
readonly passName: string;
|
|
68
|
+
}
|
|
69
|
+
/** Detail variant for duplicate-resource errors. */
|
|
70
|
+
export interface DuplicateResourceDetail {
|
|
71
|
+
readonly resourceKey: string;
|
|
72
|
+
}
|
|
73
|
+
/** Detail variant for aliases whose source is not a registered color target. */
|
|
74
|
+
export interface AliasSourceDetail {
|
|
75
|
+
readonly aliasKey: string;
|
|
76
|
+
readonly sourceKey: string;
|
|
77
|
+
}
|
|
78
|
+
/** Detail variant for resource-alloc-failed errors. */
|
|
79
|
+
export interface ResourceAllocFailedDetail {
|
|
80
|
+
readonly resourceKey: string;
|
|
81
|
+
readonly passName?: string | undefined;
|
|
82
|
+
readonly rhiCode?: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/** Detail variant for invalid-format errors. */
|
|
85
|
+
export interface InvalidFormatDetail {
|
|
86
|
+
readonly resourceKey: string;
|
|
87
|
+
readonly format: string;
|
|
88
|
+
readonly expected: readonly string[];
|
|
89
|
+
}
|
|
90
|
+
/** Generic current-frame observation failures. */
|
|
91
|
+
export interface ObservationDetail {
|
|
92
|
+
readonly frameId?: number | undefined;
|
|
93
|
+
readonly expected?: string | undefined;
|
|
94
|
+
}
|
|
95
|
+
export interface ColorDomainDetail {
|
|
96
|
+
readonly value?: string | undefined;
|
|
97
|
+
readonly resourceKey?: string | undefined;
|
|
98
|
+
readonly sourceDomain?: string | undefined;
|
|
99
|
+
readonly destinationDomain?: string | undefined;
|
|
100
|
+
}
|
|
101
|
+
export interface DeclarationDetail {
|
|
102
|
+
readonly passName?: string | undefined;
|
|
103
|
+
readonly resourceLabel?: string | undefined;
|
|
104
|
+
}
|
|
105
|
+
export interface ResourceAccessDetail {
|
|
106
|
+
readonly passName?: string | undefined;
|
|
107
|
+
readonly resourceLabel?: string | undefined;
|
|
108
|
+
readonly usage?: string | undefined;
|
|
109
|
+
readonly accesses?: readonly string[] | undefined;
|
|
110
|
+
}
|
|
111
|
+
export interface CapabilityDetail extends ResourceAccessDetail {
|
|
112
|
+
readonly capability: 'compute' | 'storage-buffer' | 'storage-texture' | 'indirect';
|
|
113
|
+
}
|
|
114
|
+
export interface DescriptorDetail {
|
|
115
|
+
readonly resourceLabel: string;
|
|
116
|
+
readonly field: string;
|
|
117
|
+
readonly expected: string;
|
|
118
|
+
readonly actual?: string | number | undefined;
|
|
119
|
+
}
|
|
120
|
+
export interface PassFailureDetail {
|
|
121
|
+
readonly passName: string;
|
|
122
|
+
readonly passKind: 'raster' | 'compute' | 'copy';
|
|
123
|
+
readonly cause: unknown;
|
|
124
|
+
}
|
|
125
|
+
export interface LifecycleDetail {
|
|
126
|
+
readonly generation: number;
|
|
127
|
+
readonly resourceLabel?: string | undefined;
|
|
128
|
+
readonly cause?: unknown;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Structured RenderGraph error.
|
|
132
|
+
*
|
|
133
|
+
* Four readonly fields aligned with AGENTS.md "Errors are structured"
|
|
134
|
+
* and RhiError (research Finding 8):
|
|
135
|
+
* - `.code` — closed union member (L1 key signal).
|
|
136
|
+
* - `.expected` — expected-state description (L2 detail).
|
|
137
|
+
* - `.hint` — actionable recovery guidance (L2 detail).
|
|
138
|
+
* - `.detail` — narrowed payload per code variant.
|
|
139
|
+
*/
|
|
140
|
+
export declare class RenderGraphError extends Error {
|
|
141
|
+
readonly code: RenderGraphErrorCode;
|
|
142
|
+
readonly expected: string;
|
|
143
|
+
readonly hint: string;
|
|
144
|
+
readonly detail: RenderGraphErrorDetail | undefined;
|
|
145
|
+
constructor(args: RenderGraphErrorConstructorArgs);
|
|
146
|
+
}
|
|
147
|
+
export { err, ok, type Result, type ResultErr, type ResultOk, } from '@forgeax/engine-types';
|
|
148
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AACH,UAAU,4BAA4B;IACpC,eAAe,EAAE,kBAAkB,CAAC;IACpC,aAAa,EAAE,gBAAgB,CAAC;IAChC,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,sBAAsB,EAAE,iBAAiB,CAAC;IAC1C,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,uBAAuB,EAAE,yBAAyB,CAAC;IACnD,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,oBAAoB,EAAE,iBAAiB,CAAC;IACxC,4BAA4B,EAAE,iBAAiB,CAAC;IAChD,0BAA0B,EAAE,iBAAiB,CAAC;IAC9C,8BAA8B,EAAE,iBAAiB,CAAC;IAClD,mBAAmB,EAAE,iBAAiB,CAAC;IACvC,qBAAqB,EAAE,iBAAiB,CAAC;IACzC,sBAAsB,EAAE,iBAAiB,CAAC;IAC1C,sBAAsB,EAAE,iBAAiB,CAAC;IAC1C,uBAAuB,EAAE,iBAA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AI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,sBAAsB,GAAG,SAAS,CAAC;gBAExC,IAAI,EAAE,+BAA+B;CAQlD;AAOD,OAAO,EACL,GAAG,EACH,EAAE,EACF,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,QAAQ,GACd,MAAM,uBAAuB,CAAC"}
|
package/dist/graph.d.ts
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import type { RhiCaps, ComputePassDescriptor as RhiComputePassDescriptor, RhiComputePassEncoder, RhiDevice, Texture, TextureFormat, TextureView } from '@forgeax/engine-rhi';
|
|
2
|
+
import { RenderGraphError, type Result } from './errors.js';
|
|
3
|
+
import { type CurrentFrameObservationDescriptor, type CurrentFrameObservationLease } from './observation.js';
|
|
4
|
+
import type { PassEntry } from './pass-registry.js';
|
|
5
|
+
import { type ColorDomainConnection, type ColorValueDomain } from './pipeline/color-value-domain.js';
|
|
6
|
+
import type { ResourceEntry } from './resource-registry.js';
|
|
7
|
+
export type ResourceKind = 'texture' | 'buffer';
|
|
8
|
+
export type ResourceLifetime = 'transient' | 'persistent';
|
|
9
|
+
export type BufferRole = 'auto-storage-or-uniform' | 'uniform';
|
|
10
|
+
/**
|
|
11
|
+
* Three-state size for addColorTarget (D-8):
|
|
12
|
+
* - 'swapchain' — matches the output canvas size
|
|
13
|
+
* - 'half-swapchain' — 1/2 the output canvas size (bloom downscale)
|
|
14
|
+
* - { w, h } — fixed pixel dimensions (shadow maps, etc.)
|
|
15
|
+
*/
|
|
16
|
+
export type ColorTargetSize = 'swapchain' | 'half-swapchain' | {
|
|
17
|
+
readonly w: number;
|
|
18
|
+
readonly h: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Color target descriptor for addColorTarget (D-8).
|
|
22
|
+
*
|
|
23
|
+
* format: GPU texture format (e.g. 'rgba16float', 'bgra8unorm').
|
|
24
|
+
* size: target dimensions relative to swap-chain or absolute.
|
|
25
|
+
* lifetime: allocation lifetime (default 'transient'); persistent targets keep
|
|
26
|
+
* their physical texture across unchanged compiles and replace it on descriptor drift.
|
|
27
|
+
* sample: multisample count (default 1; MSAA count=4 via #301).
|
|
28
|
+
* usage: GPU texture usage flags (default RENDER_ATTACHMENT | TEXTURE_BINDING).
|
|
29
|
+
* viewFormats: extra GPU texture formats viewable via createTextureView from this
|
|
30
|
+
* texture; mirrors GPUTextureDescriptor.viewFormats. The LDR MSAA path needs
|
|
31
|
+
* `bgra8unorm` storage + `bgra8unorm-srgb` view (hardware sRGB encoding on
|
|
32
|
+
* store), so the consumer pre-declares the alternate format here.
|
|
33
|
+
*/
|
|
34
|
+
export interface ColorTargetDescriptor {
|
|
35
|
+
readonly format: TextureFormat;
|
|
36
|
+
readonly size: ColorTargetSize;
|
|
37
|
+
readonly lifetime?: ResourceLifetime | undefined;
|
|
38
|
+
readonly sample?: number | undefined;
|
|
39
|
+
readonly usage?: number | undefined;
|
|
40
|
+
readonly viewFormats?: readonly TextureFormat[] | undefined;
|
|
41
|
+
/** Semantic color domain. Omitted only for legacy graphs without domain connections. */
|
|
42
|
+
readonly domain?: ColorValueDomain | undefined;
|
|
43
|
+
}
|
|
44
|
+
export interface ResolvedColorTargetDescriptor {
|
|
45
|
+
readonly texture: Texture;
|
|
46
|
+
readonly format: TextureFormat;
|
|
47
|
+
readonly size: {
|
|
48
|
+
readonly width: number;
|
|
49
|
+
readonly height: number;
|
|
50
|
+
};
|
|
51
|
+
readonly usage: number;
|
|
52
|
+
readonly sample: number;
|
|
53
|
+
}
|
|
54
|
+
export interface ResourceDescriptor {
|
|
55
|
+
readonly kind: ResourceKind;
|
|
56
|
+
readonly lifetime: ResourceLifetime;
|
|
57
|
+
readonly bufferRole?: BufferRole;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Opaque handle returned by addColorTarget. Resolved to a TextureView after
|
|
61
|
+
* compile by calling resolve(name) in a pass execute closure.
|
|
62
|
+
*/
|
|
63
|
+
export type ColorTargetHandle = string;
|
|
64
|
+
/**
|
|
65
|
+
* Per-pass resolve context: maps color target names to compiled TextureViews.
|
|
66
|
+
* A pass execute closure receives this alongside the user-provided Ctx.
|
|
67
|
+
*/
|
|
68
|
+
export interface ResolveContext {
|
|
69
|
+
/** Resolve a color target name to its compiled TextureView, or undefined if not compiled. */
|
|
70
|
+
readonly resolve: (name: string) => unknown;
|
|
71
|
+
}
|
|
72
|
+
export interface PassDescriptor<Ctx = unknown> {
|
|
73
|
+
readonly reads: readonly string[];
|
|
74
|
+
readonly writes: readonly string[];
|
|
75
|
+
readonly execute?: ((ctx: Ctx) => void) | ((ctx: Ctx, resolve: ResolveContext) => void);
|
|
76
|
+
readonly compute?: boolean;
|
|
77
|
+
readonly storageBuffer?: boolean;
|
|
78
|
+
/** Explicit resource-to-resource color-domain edges validated at compile time. */
|
|
79
|
+
readonly colorConnections?: readonly ColorDomainConnection[] | undefined;
|
|
80
|
+
}
|
|
81
|
+
export interface ComputePassDescriptor<Ctx> {
|
|
82
|
+
readonly reads: readonly string[];
|
|
83
|
+
readonly writes: readonly string[];
|
|
84
|
+
readonly storageBuffer?: boolean | undefined;
|
|
85
|
+
readonly begin?: ((frame: Ctx) => RhiComputePassDescriptor) | undefined;
|
|
86
|
+
readonly onBeginError?: ((frame: Ctx, cause: unknown) => void) | undefined;
|
|
87
|
+
readonly after?: ((frame: Ctx) => void) | undefined;
|
|
88
|
+
encode(context: {
|
|
89
|
+
readonly pass: RhiComputePassEncoder;
|
|
90
|
+
readonly frame: Ctx;
|
|
91
|
+
readonly resources: ResolveContext;
|
|
92
|
+
}): void;
|
|
93
|
+
}
|
|
94
|
+
/** Optional nested observer for per-pass execution attribution. */
|
|
95
|
+
export type PassExecuteRunner = (passName: string, action: () => void) => void;
|
|
96
|
+
export interface PassInfo {
|
|
97
|
+
readonly name: string;
|
|
98
|
+
readonly reads: readonly string[];
|
|
99
|
+
readonly writes: readonly string[];
|
|
100
|
+
}
|
|
101
|
+
export interface ResourceInfo {
|
|
102
|
+
readonly key: string;
|
|
103
|
+
readonly kind: ResourceKind;
|
|
104
|
+
readonly lifetime: ResourceLifetime;
|
|
105
|
+
}
|
|
106
|
+
export interface InternalizedPass {
|
|
107
|
+
readonly name: string;
|
|
108
|
+
readonly reads: readonly string[];
|
|
109
|
+
readonly writes: readonly string[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* RHI buffer binding type a buffer resource resolves to after compile.
|
|
113
|
+
* Mirrors the `@webgpu/types` GPUBufferBindingType subset used by the
|
|
114
|
+
* storage-vs-uniform cap switch (research Finding 7; runtime template
|
|
115
|
+
* `pbr-pipeline.ts` `caps.storageBuffer ? 'read-only-storage' : 'uniform'`).
|
|
116
|
+
*/
|
|
117
|
+
export type ResolvedBufferType = 'read-only-storage' | 'uniform';
|
|
118
|
+
/**
|
|
119
|
+
* Resolved buffer binding for a registered `kind:'buffer'` resource.
|
|
120
|
+
* Produced by compile() per AC-09 / D-6.1: the declarative graph picks the
|
|
121
|
+
* concrete binding type from `caps.storageBuffer`, so a consumer building a
|
|
122
|
+
* bind-group layout reads `resolvedBufferType` instead of duplicating the
|
|
123
|
+
* cap switch.
|
|
124
|
+
*/
|
|
125
|
+
export interface ResolvedBuffer {
|
|
126
|
+
readonly key: string;
|
|
127
|
+
readonly resolvedBufferType: ResolvedBufferType;
|
|
128
|
+
}
|
|
129
|
+
export interface InternalizedGraph {
|
|
130
|
+
readonly passes: readonly InternalizedPass[];
|
|
131
|
+
/**
|
|
132
|
+
* Buffer resources resolved to a concrete RHI binding type (AC-09).
|
|
133
|
+
* Empty when the graph declares no `kind:'buffer'` resources.
|
|
134
|
+
*/
|
|
135
|
+
readonly resolvedBuffers: readonly ResolvedBuffer[];
|
|
136
|
+
/**
|
|
137
|
+
* Resolved TextureViews keyed by resource name.
|
|
138
|
+
* Populated by the compile allocation phase for addColorTarget resources.
|
|
139
|
+
* Empty when no color targets were declared.
|
|
140
|
+
*/
|
|
141
|
+
readonly resolvedTextures: ReadonlyMap<string, TextureView>;
|
|
142
|
+
}
|
|
143
|
+
export interface CompileOptions {
|
|
144
|
+
readonly backendKind: 'webgpu' | 'wgpu-native' | 'wgpu-webgl2' | 'null';
|
|
145
|
+
readonly caps: RhiCaps;
|
|
146
|
+
/**
|
|
147
|
+
* RHI device interface handle for real GPU texture allocation (D-1).
|
|
148
|
+
* Required when the graph has addColorTarget resources; the compile phase
|
|
149
|
+
* calls device.createTexture/createTextureView for each color target.
|
|
150
|
+
*/
|
|
151
|
+
readonly device?: RhiDevice | undefined;
|
|
152
|
+
}
|
|
153
|
+
export declare class RenderGraph<Ctx = unknown> {
|
|
154
|
+
private readonly resources;
|
|
155
|
+
private readonly passes;
|
|
156
|
+
private compiled;
|
|
157
|
+
/** Transient texture pool: keyed by descriptor, reused across compiles (D-2). */
|
|
158
|
+
private readonly transientPool;
|
|
159
|
+
/**
|
|
160
|
+
* Pending-destroy queue (bug-20260622): replaced textures awaiting GPU
|
|
161
|
+
* retirement before actual device.destroyTexture. drainTransient(),
|
|
162
|
+
* setTransientEntry(), and setPersistentEntry() push here instead of destroying immediately;
|
|
163
|
+
* reclaimRetiredTransients() (called post-queue.submit in recordFrame) drains
|
|
164
|
+
* the queue when the GPU signals onSubmittedWorkDone.
|
|
165
|
+
*/
|
|
166
|
+
private readonly pendingDestroy;
|
|
167
|
+
/** Persistent textures: keyed by resource name, kept across compiles. */
|
|
168
|
+
private readonly persistentTextures;
|
|
169
|
+
/** Swap-chain size for resolving 'swapchain' / 'half-swapchain' sizes. */
|
|
170
|
+
private swapChainWidth;
|
|
171
|
+
private swapChainHeight;
|
|
172
|
+
/** Last compile-time swap-chain size; diff triggers recompile-invalidation. */
|
|
173
|
+
private compiledWidth;
|
|
174
|
+
private compiledHeight;
|
|
175
|
+
/**
|
|
176
|
+
* feat-20260612 M-4 / w15: device reference stashed at compile-time so
|
|
177
|
+
* drain() can release pooled textures via device.destroyTexture without
|
|
178
|
+
* a separate parameter. Set by compile(); null until the first compile.
|
|
179
|
+
* Render-graph stays RHI-pure (no runtime dep): the destroy bookkeeping
|
|
180
|
+
* SSOT is the RHI shim, exactly as GpuTexture.destroy() routes through it.
|
|
181
|
+
*/
|
|
182
|
+
private lastDevice;
|
|
183
|
+
/**
|
|
184
|
+
* Set the current swap-chain dimensions (w7).
|
|
185
|
+
* The compile allocation phase uses this to resolve 'swapchain' and
|
|
186
|
+
* 'half-swapchain' size specifiers. Returns true when dimensions differ
|
|
187
|
+
* from the last compile, signalling that a recompile is needed.
|
|
188
|
+
*/
|
|
189
|
+
setSwapChainSize(width: number, height: number): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* w7: resolve a color-target name to its compiled TextureView.
|
|
192
|
+
* Returns the GPU view after compile, or undefined if not yet compiled
|
|
193
|
+
* or the name was not registered via addColorTarget.
|
|
194
|
+
*/
|
|
195
|
+
getColorTargetView(name: string): unknown;
|
|
196
|
+
/**
|
|
197
|
+
* w7: resolve a color-target name to its compiled GPU Texture handle.
|
|
198
|
+
* Returns the texture after compile, or undefined if not yet compiled.
|
|
199
|
+
*/
|
|
200
|
+
getColorTargetTexture(name: string): unknown;
|
|
201
|
+
getColorTargetDescriptor(name: string): ResolvedColorTargetDescriptor | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Declare a color target alias: both names share the same physical texture.
|
|
204
|
+
* The source must already be registered via addColorTarget.
|
|
205
|
+
* Used for hdrComposited -> hdrColor folding (KB-1 / D-2). The returned
|
|
206
|
+
* Result contains the opaque alias handle or a duplicate-resource error.
|
|
207
|
+
*/
|
|
208
|
+
addColorTargetAlias(name: string, source: string): Result<ColorTargetHandle, RenderGraphError>;
|
|
209
|
+
addResource(key: string, descriptor: ResourceDescriptor): Result<ResourceEntry, RenderGraphError>;
|
|
210
|
+
/**
|
|
211
|
+
* Declare a color target resource that the compiler will allocate as a
|
|
212
|
+
* transient or persistent GPU texture (D-1 / D-8). A successful Result
|
|
213
|
+
* contains an opaque string handle that can be referenced in pass read/write
|
|
214
|
+
* arrays and resolved to a TextureView via resolve(name) inside a pass
|
|
215
|
+
* execute closure. A duplicate key is rejected before registry publication.
|
|
216
|
+
*
|
|
217
|
+
* Omitted lifetime preserves the default `transient`; `persistent` retains
|
|
218
|
+
* identity across unchanged compiles and replaces on descriptor drift.
|
|
219
|
+
* format/size/sample/usage are stored on the resource entry for the compile
|
|
220
|
+
* allocation phase (w6).
|
|
221
|
+
*/
|
|
222
|
+
addColorTarget(name: string, desc: ColorTargetDescriptor): Result<ColorTargetHandle, RenderGraphError>;
|
|
223
|
+
addPass(name: string, descriptor: PassDescriptor<Ctx>): PassEntry<Ctx>;
|
|
224
|
+
/** @internal Renderer composition seam for declaring feature work at its semantic target. */
|
|
225
|
+
_addPassBefore(name: string, before: string, descriptor: PassDescriptor<Ctx>): PassEntry<Ctx>;
|
|
226
|
+
addComputePass(name: string, descriptor: ComputePassDescriptor<Ctx>): PassEntry<Ctx>;
|
|
227
|
+
/** @internal Renderer composition seam for declaring feature work at its semantic target. */
|
|
228
|
+
_addComputePassBefore(name: string, before: string, descriptor: ComputePassDescriptor<Ctx>): PassEntry<Ctx>;
|
|
229
|
+
private addComputePassAt;
|
|
230
|
+
/**
|
|
231
|
+
* Validate a producer-scoped current-frame texture without exposing graph
|
|
232
|
+
* resource names through the observation lease.
|
|
233
|
+
*/
|
|
234
|
+
createCurrentFrameObservationLease(descriptor: CurrentFrameObservationDescriptor, currentFrameId: number): Result<CurrentFrameObservationLease, RenderGraphError>;
|
|
235
|
+
/**
|
|
236
|
+
* Compile the graph into an internalized form.
|
|
237
|
+
*
|
|
238
|
+
* Phases (plan-strategy 3.1):
|
|
239
|
+
* 1. Cap-gate fail-fast
|
|
240
|
+
* 2. Unknown-resource fail-fast (every pass read/write key is registered)
|
|
241
|
+
* 3. Dangling-read fail-fast
|
|
242
|
+
* 4. Preserve declaration order as the temporal authority
|
|
243
|
+
* 5. Buffer-role resolution (AC-09 / D-6.1)
|
|
244
|
+
* 6. GPU allocation for color targets (D-1) — when device is provided and the
|
|
245
|
+
* graph has addColorTarget resources, allocate textures via
|
|
246
|
+
* device.createTexture/createTextureView. Errors surface as
|
|
247
|
+
* 'resource-alloc-failed' or 'invalid-format'.
|
|
248
|
+
*/
|
|
249
|
+
compile(opts: CompileOptions): Result<InternalizedGraph, RenderGraphError>;
|
|
250
|
+
/**
|
|
251
|
+
* feat-20260612 M-4 / w15: release every pooled GPU texture and clear
|
|
252
|
+
* the pools.
|
|
253
|
+
*
|
|
254
|
+
* Walks `transientPool` + `persistentTextures`, forwarding each
|
|
255
|
+
* `PooledTexture.texture` opaque handle to `device.destroyTexture(...)`,
|
|
256
|
+
* then clears both Maps. The destroy bookkeeping SSOT is the RHI shim
|
|
257
|
+
* (architecture-principles §1 SSOT: same path GpuTexture.destroy()
|
|
258
|
+
* uses); render-graph stays RHI-pure (no runtime dep).
|
|
259
|
+
*
|
|
260
|
+
* Plan-strategy D-7: drain covers the dispose exit path (`Renderer.dispose()`);
|
|
261
|
+
* descriptor-drift replacement during compile is fenced through
|
|
262
|
+
* `pendingDestroy` and `reclaimRetiredTransients()`.
|
|
263
|
+
*
|
|
264
|
+
* Idempotent (architecture-principles §6): a second drain on cleared
|
|
265
|
+
* Maps is a no-op. drain() before any compile is also a safe no-op.
|
|
266
|
+
* Per-handle errors from the RHI shim (e.g. 'destroy-after-destroy'
|
|
267
|
+
* on a stale handle) are tolerated so the dispose chain can make
|
|
268
|
+
* progress (mirrors gpuStore.destroyAll's swallow-and-continue
|
|
269
|
+
* policy; plan-strategy D-3 / D-8). The structured error stays
|
|
270
|
+
* available on the device handle for future inspector hooks.
|
|
271
|
+
*/
|
|
272
|
+
drain(): void;
|
|
273
|
+
/**
|
|
274
|
+
* Relinquish every texture owned by this graph after its last frame has
|
|
275
|
+
* been submitted. Unlike {@link drain}, this does not synchronously destroy
|
|
276
|
+
* GPU resources: they join `pendingDestroy` and are released by
|
|
277
|
+
* `reclaimRetiredTransients()` only after `onSubmittedWorkDone` resolves.
|
|
278
|
+
*
|
|
279
|
+
* A retired graph is no longer executable. Runtime replaces a memoized
|
|
280
|
+
* per-frame graph through this entry when topology changes (rather than
|
|
281
|
+
* dropping the graph and its pools), while `drain()` remains the teardown
|
|
282
|
+
* path where immediate destruction is safe.
|
|
283
|
+
*/
|
|
284
|
+
retire(): void;
|
|
285
|
+
/**
|
|
286
|
+
* Release every transient-pool texture while keeping persistentTextures
|
|
287
|
+
* intact (AC-09: resize drain, plan-strategy D-4).
|
|
288
|
+
*
|
|
289
|
+
* Walks `transientPool` values and forwards each `PooledTexture.texture`
|
|
290
|
+
* opaque handle to `device.destroyTexture(...)`, then clears the transient
|
|
291
|
+
* pool. Mirror of `drain()` but scoped to the transient pool only.
|
|
292
|
+
*
|
|
293
|
+
* Persistent textures survive `drainTransient` — they are only released by
|
|
294
|
+
* the full `drain()` on teardown. `drainTransient` is an internal helper
|
|
295
|
+
* called by `compile()` when swap-chain size changes; it is NOT a public API
|
|
296
|
+
* (callers should use `drain()` for teardown).
|
|
297
|
+
*
|
|
298
|
+
* Idempotent (architecture-principles §6): a second drainTransient on an
|
|
299
|
+
* already-cleared transient pool is a no-op.
|
|
300
|
+
*/
|
|
301
|
+
private drainTransient;
|
|
302
|
+
/**
|
|
303
|
+
* Guarded transient pool insert (AC-08, plan-strategy D-4).
|
|
304
|
+
*
|
|
305
|
+
* Before overwriting a key in the transient pool, destroys the old pooled
|
|
306
|
+
* texture via `device.destroyTexture(...)` to prevent stranded GPU textures.
|
|
307
|
+
* The guard is defensive: in current production code flow this code path is
|
|
308
|
+
* unreachable (set() only follows a get() miss inside allocateColorTargets),
|
|
309
|
+
* but the single-line guard costs almost nothing and closes the symmetry gap
|
|
310
|
+
* (every GPU resource allocation has a paired destroy).
|
|
311
|
+
*
|
|
312
|
+
* When `lastDevice` is null (no device ever stashed), the old entry is
|
|
313
|
+
* silently dropped without destroy (mirrors drainTransient's null-device
|
|
314
|
+
* fast path).
|
|
315
|
+
*/
|
|
316
|
+
private setTransientEntry;
|
|
317
|
+
/**
|
|
318
|
+
* Publish a persistent replacement only after a complete allocation succeeds.
|
|
319
|
+
* The old handle remains fenced until the GPU retires work that may still
|
|
320
|
+
* reference it, just like a transient replacement.
|
|
321
|
+
*/
|
|
322
|
+
private setPersistentEntry;
|
|
323
|
+
/**
|
|
324
|
+
* bug-20260622 D-2: reclaim pool textures queued in pendingDestroy after
|
|
325
|
+
* the GPU has retired all prior command buffers.
|
|
326
|
+
*
|
|
327
|
+
* Takes a snapshot of pendingDestroy, then calls
|
|
328
|
+
* `lastDevice.queue.onSubmittedWorkDone()`. When the promise resolves,
|
|
329
|
+
* the snapshot items are actually destroyed via
|
|
330
|
+
* `device.destroyTexture(...)` and removed from the queue.
|
|
331
|
+
*
|
|
332
|
+
* Idempotent (architecture-principles D-4): a second reclaim on an
|
|
333
|
+
* already-drained pendingDestroy is a no-op. When lastDevice is null
|
|
334
|
+
* (no device ever stashed), pendingDestroy is cleared directly.
|
|
335
|
+
*
|
|
336
|
+
* Per-handle destroy errors are tolerated (swallow-and-continue,
|
|
337
|
+
* plan-strategy D-5) — a stale-handle destroy-after-destroy does not
|
|
338
|
+
* interrupt the reclaim chain.
|
|
339
|
+
*/
|
|
340
|
+
reclaimRetiredTransients(): Promise<void>;
|
|
341
|
+
/**
|
|
342
|
+
* Drop the pendingDestroy queue WITHOUT calling device.destroyTexture
|
|
343
|
+
* (feat-20260622-s5 M3 / B-2 / B-AC-02).
|
|
344
|
+
*
|
|
345
|
+
* Used on the device-lost recover() rebuild path: the queue holds
|
|
346
|
+
* PooledTexture handles minted against the now-lost device, so calling
|
|
347
|
+
* destroyTexture on them against the freshly-rebuilt device is meaningless
|
|
348
|
+
* (the old GPUDevice owns them; spec retires its resources implicitly when
|
|
349
|
+
* it is lost). recover() calls this after `gpuStore.destroyAll()` and before
|
|
350
|
+
* `tryCreateWebGPURenderer` so no stale handle reaches the new device.
|
|
351
|
+
*
|
|
352
|
+
* device-lost is an upstream judgement (createRenderer's health state); the
|
|
353
|
+
* graph stays RHI-pure and takes no device parameter — it only exposes the
|
|
354
|
+
* clear entry. Same effect as the existing null-device fast paths in drain()
|
|
355
|
+
* / reclaimRetiredTransients() (`pendingDestroy.length = 0`), surfaced as a
|
|
356
|
+
* method recover() can call directly. Idempotent: a second call on an
|
|
357
|
+
* already-empty queue is a no-op.
|
|
358
|
+
*/
|
|
359
|
+
clearPendingDestroy(): void;
|
|
360
|
+
/**
|
|
361
|
+
* Execute the compiled graph in declaration order, calling
|
|
362
|
+
* each pass's execute closure with the provided context. Passes without an
|
|
363
|
+
* execute closure are silently skipped.
|
|
364
|
+
*/
|
|
365
|
+
execute(ctx: Ctx, runPass?: PassExecuteRunner): void;
|
|
366
|
+
listPasses(): readonly PassInfo[];
|
|
367
|
+
listResources(): readonly ResourceInfo[];
|
|
368
|
+
private validateCaps;
|
|
369
|
+
private validateColorDomains;
|
|
370
|
+
private validateNoUnknownResource;
|
|
371
|
+
/**
|
|
372
|
+
* Resolve every registered `kind:'buffer'` resource to a concrete RHI
|
|
373
|
+
* binding type (AC-09 / D-6.1). `bufferRole='auto-storage-or-uniform'`
|
|
374
|
+
* (the default when unset) picks `'read-only-storage'` when the backend
|
|
375
|
+
* advertises `caps.storageBuffer`, else falls back to `'uniform'`;
|
|
376
|
+
* `bufferRole='uniform'` is always `'uniform'`. Mirrors the runtime
|
|
377
|
+
* `pbr-pipeline.ts` cap switch (research Finding 7), expressed here in the
|
|
378
|
+
* RHI-pure graph layer so consumers never duplicate the branch.
|
|
379
|
+
*/
|
|
380
|
+
private resolveBuffers;
|
|
381
|
+
private validateColorTargetFormats;
|
|
382
|
+
/**
|
|
383
|
+
* Phase 7: allocate GPU textures for registered color targets (D-1 / D-2).
|
|
384
|
+
*
|
|
385
|
+
* For each addColorTarget resource, resolves the concrete size from the
|
|
386
|
+
* ColorTargetSize descriptor and swapChainSize, then looks up the transient
|
|
387
|
+
* pool by descriptor key. Pool hit reuses the same physical texture/view;
|
|
388
|
+
* pool miss (drift) triggers device.createTexture/createTextureView rebuild.
|
|
389
|
+
*
|
|
390
|
+
* Alias targets (addColorTargetAlias) fold into the source's physical texture
|
|
391
|
+
* (KB-1 MoveNode pattern). Persistent targets are retained across compiles
|
|
392
|
+
* with size-drift rebuild.
|
|
393
|
+
*
|
|
394
|
+
* device === undefined is a no-op (returns an empty map).
|
|
395
|
+
* Allocation is transactional: newly created textures are destroyed on any
|
|
396
|
+
* failure, and pool mutations are committed only after every target succeeds.
|
|
397
|
+
*/
|
|
398
|
+
private allocateColorTargets;
|
|
399
|
+
private resolveWidth;
|
|
400
|
+
private resolveHeight;
|
|
401
|
+
private validateNoDanglingRead;
|
|
402
|
+
}
|
|
403
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,OAAO,EACP,qBAAqB,IAAI,wBAAwB,EACjD,qBAAqB,EACrB,SAAS,EACT,OAAO,EACP,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAML,gBAAgB,EAChB,KAAK,MAAM,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EAElC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EAEtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAK5D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,YAAY,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG,yBAAyB,GAAG,SAAS,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,eA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;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAQ1B;;;;;;;;;;;;;;;;OAgBG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B/C;;;;;;;;;;;;;;;;;OAiBG;IACH,mBAAmB,IAAI,IAAI;IAI3B;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAwBpD,UAAU,IAAI,SAAS,QAAQ,EAAE;IAQjC,aAAa,IAAI,SAAS,YAAY,EAAE;IAcxC,OAAO,CAAC,YAAY;IAmCpB,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,yBAAyB;IAkCjC;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,0BAA0B;IAqBlC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,oBAAoB;IA0K5B,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,sBAAsB;CAyB/B"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { RenderGraphBuilder } from './builder.js';
|
|
2
|
+
export { err, type InvalidFormatDetail, ok, RenderGraphError, type RenderGraphErrorCode, type RenderGraphErrorDetail, type ResourceAllocFailedDetail, type Result, type ResultErr, type ResultOk, } from './errors.js';
|
|
3
|
+
export type { BufferRole, ColorTargetDescriptor, ColorTargetHandle, ColorTargetSize, CompileOptions, ComputePassDescriptor, InternalizedGraph, InternalizedPass, PassDescriptor, PassInfo, ResolveContext, ResolvedBuffer, ResolvedBufferType, ResolvedColorTargetDescriptor, ResourceDescriptor, ResourceInfo, ResourceKind, ResourceLifetime, } from './graph.js';
|
|
4
|
+
export { RenderGraph } from './graph.js';
|
|
5
|
+
export { type CurrentFrameObservationDescriptor, type CurrentFrameObservationLease, type CurrentFrameObservationLifetime, type CurrentFrameObservationSource, createCurrentFrameObservationLease, type ObservationSize, } from './observation.js';
|
|
6
|
+
export { COLOR_VALUE_DOMAINS, type ColorDomainConnection, type ColorDomainConversion, type ColorDomainValidation, type ColorResourceDescriptor, type ColorValueDomain, deserializeColorResourceDescriptor, deserializeColorValueDomain, isColorValueDomain, serializeColorResourceDescriptor, serializeColorValueDomain, validateColorDomainConnection, } from './pipeline/color-value-domain.js';
|
|
7
|
+
export type { CompiledRenderGraph, CompiledRenderGraphInfo, ComputeGraphPass, CopyGraphPass, GraphAccess, GraphAccessInfo, GraphBuffer, GraphBufferAccess, GraphBufferDescriptor, GraphExtent, GraphPass, GraphPassKind, GraphResource, GraphResourceKind, GraphResourceOrigin, GraphResourceResolver, GraphTexture, GraphTextureAccess, GraphTextureDescriptor, GraphTextureView, GraphTextureViewDescriptor, ImportedBufferDescriptor, ImportedTextureDescriptor, ImportedTextureViewResolver, RasterColorAttachment, RasterDepthStencilAttachment, RasterGraphPass, RenderGraphCompileOptions, RenderGraphFrame, RenderGraphPassExecution, RenderGraphPassRunner, } from './types.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EACL,GAAG,EACH,KAAK,mBAAmB,EACxB,EAAE,EACF,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,QAAQ,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,6BAA6B,EAC7B,kBAAkB,EAClB,YAA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