@forgeax/engine-render-graph 0.1.20 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/dist/__tests__/render-graph-gpu-timing-instrumentation.unit.test.d.ts +2 -0
- package/dist/__tests__/render-graph-gpu-timing-instrumentation.unit.test.d.ts.map +1 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/compiled-graph.d.ts +2 -2
- package/dist/compiled-graph.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +23 -8
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +20 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/render-graph-builder.unit.test.ts +115 -1
- package/src/__tests__/render-graph-gpu-timing-instrumentation.unit.test.ts +183 -0
- package/src/builder.ts +6 -2
- package/src/compiled-graph.ts +32 -6
- package/src/index.ts +2 -0
- package/src/types.ts +30 -2
- package/dist/.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -107,6 +107,49 @@ label. Compute work that targets the parent command encoder, such as resolving t
|
|
|
107
107
|
belongs in `after`; pass commands remain in `encode`. `onBeginError` lets the pass owner terminalize
|
|
108
108
|
feature-local evidence before the graph returns `pass-encode-failed`.
|
|
109
109
|
|
|
110
|
+
### Pass instrumentation
|
|
111
|
+
|
|
112
|
+
Renderer-owned instrumentation may be supplied as the third argument to
|
|
113
|
+
`compiled.execute(frame, runPass, instrumentation)`. The graph calls
|
|
114
|
+
`instrumentation.begin` immediately before each executable pass and applies the
|
|
115
|
+
returned descriptor decorator at the actual `beginRenderPass` or
|
|
116
|
+
`beginComputePass` boundary. This is the single seam for pass-level timestamp
|
|
117
|
+
queries and similar graph-neutral observation; it preserves pass name, kind, and
|
|
118
|
+
execution index without moving timing policy into the graph.
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
compiled.execute(frame, undefined, {
|
|
122
|
+
begin: (pass) =>
|
|
123
|
+
pass.kind === 'compute'
|
|
124
|
+
? {
|
|
125
|
+
computePassDescriptor: (descriptor) => ({
|
|
126
|
+
...descriptor,
|
|
127
|
+
timestampWrites: {
|
|
128
|
+
querySet,
|
|
129
|
+
beginningOfPassWriteIndex: 0,
|
|
130
|
+
endOfPassWriteIndex: 1,
|
|
131
|
+
},
|
|
132
|
+
}),
|
|
133
|
+
}
|
|
134
|
+
: undefined,
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The graph never calls a backend-specific command-encoder timestamp helper.
|
|
139
|
+
Pass instrumentation must preserve any producer-owned descriptor facts; a
|
|
140
|
+
policy owner that cannot merge an existing `timestampWrites` pair should fail
|
|
141
|
+
closed instead of overwriting it. Copy passes expose `beforeCopy`/`afterCopy`
|
|
142
|
+
hooks for non-timing instrumentation, but WebGPU has no portable copy-pass
|
|
143
|
+
timestamp descriptor.
|
|
144
|
+
> [!NOTE]
|
|
145
|
+
> `timestampWrites` and an `after(frame)` callback are neutral graph seams. They
|
|
146
|
+
> let a pipeline owner place a backend command at a declared pass boundary, but
|
|
147
|
+
> Render owns the `GpuPassTiming` session, decimal tick parser, bounded facts,
|
|
148
|
+
> four-status observation, and benchmark validator. RenderGraph must not import
|
|
149
|
+
> that timing contract, name a timing status, or decide whether a measurement is
|
|
150
|
+
> accepted. The public route is documented in
|
|
151
|
+
> [`@forgeax/engine-render`](../render/README.md).
|
|
152
|
+
|
|
110
153
|
## Compile and execution
|
|
111
154
|
|
|
112
155
|
`compile({ device, surfaceSize })`:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-graph-gpu-timing-instrumentation.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/render-graph-gpu-timing-instrumentation.unit.test.ts"],"names":[],"mappings":""}
|
package/dist/builder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","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{ RenderGraphError, type Result } from './errors.js';
|
|
3
3
|
import type { ResolvedColorTargetDescriptor } from './graph.js';
|
|
4
4
|
import type { CompiledPass, CompiledResource, CompiledView } from './kernel-internal.js';
|
|
5
|
-
import type { CompiledRenderGraph, CompiledRenderGraphInfo, RenderGraphFrame, RenderGraphPassRunner } from './types.js';
|
|
5
|
+
import type { CompiledRenderGraph, CompiledRenderGraphInfo, RenderGraphFrame, RenderGraphPassInstrumentation, RenderGraphPassRunner } from './types.js';
|
|
6
6
|
export declare class CompiledRenderGraphImpl<FrameCtx extends RenderGraphFrame> implements CompiledRenderGraph<FrameCtx> {
|
|
7
7
|
private readonly generation;
|
|
8
8
|
private readonly owner;
|
|
@@ -19,7 +19,7 @@ export declare class CompiledRenderGraphImpl<FrameCtx extends RenderGraphFrame>
|
|
|
19
19
|
getColorTargetView(name: string): TextureView | undefined;
|
|
20
20
|
getColorTargetTexture(name: string): Texture | undefined;
|
|
21
21
|
getColorTargetDescriptor(name: string): ResolvedColorTargetDescriptor | undefined;
|
|
22
|
-
execute(frame: FrameCtx, runPass?: RenderGraphPassRunner): Result<void, RenderGraphError>;
|
|
22
|
+
execute(frame: FrameCtx, runPass?: RenderGraphPassRunner, instrumentation?: RenderGraphPassInstrumentation<FrameCtx>): Result<void, RenderGraphError>;
|
|
23
23
|
retire(): Promise<Result<void, RenderGraphError>>;
|
|
24
24
|
private finishRetire;
|
|
25
25
|
private resolveFrameResources;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiled-graph.d.ts","sourceRoot":"","sources":["../src/compiled-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,SAAS,EACT,OAAO,EACP,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAW,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EACV,YAAY,EAC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AC7B,sBAAsB,EAAE,WAAW,CAAC,MAAM,EAAE,6BAA6B,CAAC;IAG7F,OAAO,IAAI,uBAAuB;IAIlC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAQzD,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAOxD,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,6BAA6B,GAAG,SAAS;IAIjF,OAAO,CACL,KAAK,EAAE,QAAQ,EACf,OAAO,CAAC,EAAE,qBAAqB,EAC/B,eAAe,CAAC,EAAE,8BAA8B,CAAC,QAAQ,CAAC,GACzD,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAqKjC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;YAOnC,YAAY;IA+C1B,OAAO,CAAC,qBAAqB;IAiD7B,OAAO,CAAC,kBAAkB;CAwE3B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export type { BufferRole, ColorTargetDescriptor, ColorTargetHandle, ColorTargetS
|
|
|
4
4
|
export { RenderGraph } from './graph.js';
|
|
5
5
|
export { type CurrentFrameObservationDescriptor, type CurrentFrameObservationLease, type CurrentFrameObservationLifetime, type CurrentFrameObservationSource, createCurrentFrameObservationLease, type ObservationSize, } from './observation.js';
|
|
6
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, CompiledResourceDescriptor, 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';
|
|
7
|
+
export type { CompiledRenderGraph, CompiledRenderGraphInfo, CompiledResourceDescriptor, 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, RenderGraphPassInstrumentation, RenderGraphPassInstrumentationScope, RenderGraphPassRunner, } from './types.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,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,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,EAClC,kCAAkC,EAClC,KAAK,eAAe,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,kCAAkC,EAClC,2BAA2B,EAC3B,kBAAkB,EAClB,gCAAgC,EAChC,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAA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,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,wBAAwB,EACxB,8BAA8B,EAC9B,mCAAmC,EACnC,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -96,7 +96,7 @@ var CompiledRenderGraphImpl = class {
|
|
|
96
96
|
getColorTargetDescriptor(name) {
|
|
97
97
|
return this.colorTargetDescriptors.get(name);
|
|
98
98
|
}
|
|
99
|
-
execute(frame, runPass) {
|
|
99
|
+
execute(frame, runPass, instrumentation) {
|
|
100
100
|
if (this.retired) {
|
|
101
101
|
return err(
|
|
102
102
|
new RenderGraphError({
|
|
@@ -113,8 +113,10 @@ var CompiledRenderGraphImpl = class {
|
|
|
113
113
|
const resolver = this.createPassResolver(pass, resolved.value);
|
|
114
114
|
try {
|
|
115
115
|
if (pass.pass.descriptor.executeIf?.(frame) === false) continue;
|
|
116
|
+
const execution = { name: pass.name, kind: pass.pass.kind, executionIndex };
|
|
116
117
|
let encodeResult = ok(void 0);
|
|
117
118
|
const encode = () => {
|
|
119
|
+
const scope = instrumentation?.begin(execution, frame);
|
|
118
120
|
switch (pass.pass.kind) {
|
|
119
121
|
case "raster": {
|
|
120
122
|
const descriptor = pass.pass.descriptor;
|
|
@@ -160,11 +162,14 @@ var CompiledRenderGraphImpl = class {
|
|
|
160
162
|
...attachment.stencilReadOnly === void 0 ? {} : { stencilReadOnly: attachment.stencilReadOnly }
|
|
161
163
|
};
|
|
162
164
|
}
|
|
163
|
-
const
|
|
165
|
+
const baseDescriptor = {
|
|
164
166
|
label: pass.name,
|
|
165
167
|
colorAttachments,
|
|
166
|
-
...depthStencilAttachment === void 0 ? {} : { depthStencilAttachment }
|
|
167
|
-
|
|
168
|
+
...depthStencilAttachment === void 0 ? {} : { depthStencilAttachment },
|
|
169
|
+
...pass.pass.descriptor.occlusionQuerySet === void 0 ? {} : { occlusionQuerySet: pass.pass.descriptor.occlusionQuerySet }
|
|
170
|
+
};
|
|
171
|
+
const instrumentedDescriptor = scope?.renderPassDescriptor?.(baseDescriptor) ?? baseDescriptor;
|
|
172
|
+
const encoder = frame.encoder.beginRenderPass(instrumentedDescriptor);
|
|
168
173
|
try {
|
|
169
174
|
descriptor.encode({ pass: encoder, frame, resources: resolver });
|
|
170
175
|
} finally {
|
|
@@ -174,9 +179,13 @@ var CompiledRenderGraphImpl = class {
|
|
|
174
179
|
}
|
|
175
180
|
case "compute": {
|
|
176
181
|
const begin = pass.pass.descriptor.begin?.(frame);
|
|
182
|
+
const instrumentedBegin = scope?.computePassDescriptor?.(begin ?? {}) ?? begin;
|
|
177
183
|
let encoder;
|
|
178
184
|
try {
|
|
179
|
-
encoder = frame.encoder.beginComputePass({
|
|
185
|
+
encoder = frame.encoder.beginComputePass({
|
|
186
|
+
...instrumentedBegin ?? {},
|
|
187
|
+
label: pass.name
|
|
188
|
+
});
|
|
180
189
|
} catch (cause) {
|
|
181
190
|
pass.pass.descriptor.onBeginError?.(frame, cause);
|
|
182
191
|
throw cause;
|
|
@@ -190,14 +199,19 @@ var CompiledRenderGraphImpl = class {
|
|
|
190
199
|
break;
|
|
191
200
|
}
|
|
192
201
|
case "copy":
|
|
193
|
-
|
|
202
|
+
scope?.beforeCopy?.(frame.encoder);
|
|
203
|
+
try {
|
|
204
|
+
pass.pass.descriptor.encode({ encoder: frame.encoder, frame, resources: resolver });
|
|
205
|
+
} finally {
|
|
206
|
+
scope?.afterCopy?.(frame.encoder);
|
|
207
|
+
}
|
|
194
208
|
break;
|
|
195
209
|
}
|
|
196
210
|
};
|
|
197
211
|
if (runPass === void 0) {
|
|
198
212
|
encode();
|
|
199
213
|
} else {
|
|
200
|
-
runPass(
|
|
214
|
+
runPass(execution, encode);
|
|
201
215
|
}
|
|
202
216
|
if (!encodeResult.ok) return encodeResult;
|
|
203
217
|
} catch (cause) {
|
|
@@ -867,7 +881,8 @@ var RenderGraphBuilder = class {
|
|
|
867
881
|
const item = this.normalizeAccess(passIndex, pass, access);
|
|
868
882
|
if (!item.ok) return item;
|
|
869
883
|
normalized.push(item.value);
|
|
870
|
-
const
|
|
884
|
+
const resource = this.resources.get(item.value.resourceId);
|
|
885
|
+
const usage = (resource?.kind === "texture" && resource.origin === "created" ? resource.descriptor.usage ?? 0 : 0) | (resource?.kind === "buffer" ? bufferUsage(access.usage) : textureUsage(access.usage));
|
|
871
886
|
usageByResource.set(
|
|
872
887
|
item.value.resourceId,
|
|
873
888
|
(usageByResource.get(item.value.resourceId) ?? 0) | usage
|