@forgeax/engine-render-graph 0.1.20 → 0.1.21
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 +9 -0
- package/dist/.tsbuildinfo +1 -1
- 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 +21 -7
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +17 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/render-graph-builder.unit.test.ts +23 -0
- package/src/__tests__/render-graph-gpu-timing-instrumentation.unit.test.ts +183 -0
- package/src/builder.ts +6 -2
- package/src/compiled-graph.ts +25 -6
- package/src/index.ts +2 -0
- package/src/types.ts +26 -2
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Buffer, ComputePassDescriptor, RhiCommandEncoder, RhiComputePassEncoder, RhiDevice, RhiRenderPassEncoder, Texture, TextureFormat, TextureView } from '@forgeax/engine-rhi';
|
|
1
|
+
import type { Buffer, ComputePassDescriptor, RenderPassDescriptor, RhiCommandEncoder, RhiComputePassEncoder, RhiDevice, RhiRenderPassEncoder, Texture, TextureFormat, TextureView } from '@forgeax/engine-rhi';
|
|
2
2
|
import type { RenderGraphError, Result } from './errors.js';
|
|
3
3
|
import type { ColorValueDomain } from './pipeline/color-value-domain.js';
|
|
4
4
|
declare const graphTextureBrand: unique symbol;
|
|
@@ -25,7 +25,7 @@ export type GraphExtent = 'surface' | 'half-surface' | {
|
|
|
25
25
|
export interface GraphTextureDescriptor {
|
|
26
26
|
readonly format: TextureFormat;
|
|
27
27
|
readonly size: GraphExtent;
|
|
28
|
-
/** Additional RHI usage required by an external diagnostic consumer. */
|
|
28
|
+
/** Additional RHI usage required by an external diagnostic consumer such as readback. */
|
|
29
29
|
readonly usage?: number | undefined;
|
|
30
30
|
readonly mipLevelCount?: number | undefined;
|
|
31
31
|
readonly sampleCount?: number | undefined;
|
|
@@ -193,6 +193,20 @@ export interface RenderGraphPassExecution {
|
|
|
193
193
|
readonly executionIndex: number;
|
|
194
194
|
}
|
|
195
195
|
export type RenderGraphPassRunner = (pass: RenderGraphPassExecution, encode: () => void) => void;
|
|
196
|
+
/**
|
|
197
|
+
* The graph-neutral boundary for observing and decorating an actual pass.
|
|
198
|
+
* Render owns the policy supplied here; the graph only preserves pass
|
|
199
|
+
* provenance and the existing encoder boundaries.
|
|
200
|
+
*/
|
|
201
|
+
export interface RenderGraphPassInstrumentationScope {
|
|
202
|
+
readonly renderPassDescriptor?: (descriptor: RenderPassDescriptor) => RenderPassDescriptor;
|
|
203
|
+
readonly computePassDescriptor?: (descriptor: ComputePassDescriptor) => ComputePassDescriptor;
|
|
204
|
+
readonly beforeCopy?: (encoder: RhiCommandEncoder) => void;
|
|
205
|
+
readonly afterCopy?: (encoder: RhiCommandEncoder) => void;
|
|
206
|
+
}
|
|
207
|
+
export interface RenderGraphPassInstrumentation<FrameCtx extends RenderGraphFrame> {
|
|
208
|
+
begin(pass: RenderGraphPassExecution, frame: FrameCtx): RenderGraphPassInstrumentationScope | undefined;
|
|
209
|
+
}
|
|
196
210
|
export interface RenderGraphCompileOptions {
|
|
197
211
|
readonly device: RhiDevice;
|
|
198
212
|
readonly surfaceSize: {
|
|
@@ -201,7 +215,7 @@ export interface RenderGraphCompileOptions {
|
|
|
201
215
|
};
|
|
202
216
|
}
|
|
203
217
|
export interface CompiledRenderGraph<FrameCtx extends RenderGraphFrame> {
|
|
204
|
-
execute(frame: FrameCtx, runPass?: RenderGraphPassRunner): Result<void, RenderGraphError>;
|
|
218
|
+
execute(frame: FrameCtx, runPass?: RenderGraphPassRunner, instrumentation?: RenderGraphPassInstrumentation<FrameCtx>): Result<void, RenderGraphError>;
|
|
205
219
|
inspect(): CompiledRenderGraphInfo;
|
|
206
220
|
retire(): Promise<Result<void, RenderGraphError>>;
|
|
207
221
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,CAAC,MAAM,iBAAiB,EAAE,OAAO,MAAM,CAAC;AAC/C,OAAO,CAAC,MAAM,qBAAqB,EAAE,OAAO,MAAM,CAAC;AACnD,OAAO,CAAC,MAAM,gBAAgB,EAAE,OAAO,MAAM,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;CACnC;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,UAAU,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,M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ACH,IAAI,EAAE,wBAAwB,EAC9B,KAAK,EAAE,QAAQ,GACd,mCAAmC,GAAG,SAAS,CAAC;CACpD;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3E;AAED,MAAM,WAAW,mBAAmB,CAAC,QAAQ,SAAS,gBAAgB;IACpE,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,CAAC;IAClC,OAAO,IAAI,uBAAuB,CAAC;IACnC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;CACnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgeax/engine-render-graph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"LICENSE"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@forgeax/engine-rhi": "0.1.
|
|
26
|
-
"@forgeax/engine-types": "0.1.
|
|
25
|
+
"@forgeax/engine-rhi": "0.1.21",
|
|
26
|
+
"@forgeax/engine-types": "0.1.21",
|
|
27
27
|
"@webgpu/types": "^0.1.71"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@forgeax/engine-rhi-null": "0.1.
|
|
30
|
+
"@forgeax/engine-rhi-null": "0.1.21"
|
|
31
31
|
},
|
|
32
32
|
"forgeax": {
|
|
33
33
|
"metrics": {
|
|
@@ -448,6 +448,29 @@ describe('RenderGraphBuilder capability, execution, and lifecycle contracts', ()
|
|
|
448
448
|
);
|
|
449
449
|
});
|
|
450
450
|
|
|
451
|
+
it('keeps declared created-texture usage alongside graph-derived usage', () => {
|
|
452
|
+
const graph = new RenderGraphBuilder<Frame>();
|
|
453
|
+
const texture = value(
|
|
454
|
+
graph.createTexture('readback-target', {
|
|
455
|
+
format: 'rgba8unorm',
|
|
456
|
+
size: 'surface',
|
|
457
|
+
usage: 0x01,
|
|
458
|
+
}),
|
|
459
|
+
);
|
|
460
|
+
const view = value(graph.view(texture));
|
|
461
|
+
graph.addRasterPass('write', {
|
|
462
|
+
accesses: [{ resource: view, usage: 'color-attachment' }],
|
|
463
|
+
colorAttachments: [{ view, loadOp: 'clear', storeOp: 'store' }],
|
|
464
|
+
encode: () => undefined,
|
|
465
|
+
});
|
|
466
|
+
const compiled = value(
|
|
467
|
+
graph.compile({ device: mockDevice(), surfaceSize: { width: 1, height: 1 } }),
|
|
468
|
+
);
|
|
469
|
+
expect(compiled.inspect().resources).toContainEqual(
|
|
470
|
+
expect.objectContaining({ label: 'readback-target', derivedUsage: 0x11 }),
|
|
471
|
+
);
|
|
472
|
+
});
|
|
473
|
+
|
|
451
474
|
it('derives compute and storage capabilities from pass/access declarations', () => {
|
|
452
475
|
const graph = new RenderGraphBuilder<Frame>();
|
|
453
476
|
const buffer = value(
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Buffer,
|
|
3
|
+
ComputePassDescriptor,
|
|
4
|
+
RenderPassDescriptor,
|
|
5
|
+
RhiCommandEncoder,
|
|
6
|
+
RhiComputePassEncoder,
|
|
7
|
+
RhiDevice,
|
|
8
|
+
RhiRenderPassEncoder,
|
|
9
|
+
Texture,
|
|
10
|
+
TextureView,
|
|
11
|
+
} from '@forgeax/engine-rhi';
|
|
12
|
+
import { describe, expect, it } from 'vitest';
|
|
13
|
+
import { RenderGraphBuilder } from '../builder.js';
|
|
14
|
+
import type { RenderGraphFrame, RenderGraphPassInstrumentation } from '../types.js';
|
|
15
|
+
|
|
16
|
+
interface Frame extends RenderGraphFrame {
|
|
17
|
+
readonly source: Buffer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function mockDevice(): RhiDevice {
|
|
21
|
+
let nextId = 0;
|
|
22
|
+
return {
|
|
23
|
+
caps: {
|
|
24
|
+
backendKind: 'null',
|
|
25
|
+
compute: true,
|
|
26
|
+
storageBuffer: true,
|
|
27
|
+
storageTexture: true,
|
|
28
|
+
timestampQuery: false,
|
|
29
|
+
timestampPeriodNanoseconds: null,
|
|
30
|
+
indirectDrawing: true,
|
|
31
|
+
textureCompressionBc: false,
|
|
32
|
+
textureCompressionEtc2: false,
|
|
33
|
+
textureCompressionAstc: false,
|
|
34
|
+
multiDrawIndirect: false,
|
|
35
|
+
pushConstants: false,
|
|
36
|
+
textureBindingArray: false,
|
|
37
|
+
samplerAliasing: true,
|
|
38
|
+
firstInstanceIndirect: false,
|
|
39
|
+
rgba16floatRenderable: true,
|
|
40
|
+
rg11b10ufloatRenderable: true,
|
|
41
|
+
float32Filterable: true,
|
|
42
|
+
maxColorAttachments: 8,
|
|
43
|
+
},
|
|
44
|
+
limits: {} as never,
|
|
45
|
+
features: new Set() as never,
|
|
46
|
+
queue: { onSubmittedWorkDone: async () => undefined } as never,
|
|
47
|
+
createTexture: () => ({ ok: true, value: { id: nextId++ } as unknown as Texture }),
|
|
48
|
+
createTextureView: () => ({ ok: true, value: { id: nextId++ } as unknown as TextureView }),
|
|
49
|
+
createBuffer: () => ({ ok: true, value: { id: nextId++ } as unknown as Buffer }),
|
|
50
|
+
destroyTexture: () => ({ ok: true, value: undefined }),
|
|
51
|
+
destroyBuffer: () => ({ ok: true, value: undefined }),
|
|
52
|
+
} as unknown as RhiDevice;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function buildGraph() {
|
|
56
|
+
const graph = new RenderGraphBuilder<Frame>();
|
|
57
|
+
const color = graph.createTexture('color', { format: 'rgba8unorm', size: 'surface' });
|
|
58
|
+
if (!color.ok) throw color.error;
|
|
59
|
+
const view = graph.view(color.value);
|
|
60
|
+
if (!view.ok) throw view.error;
|
|
61
|
+
graph.addRasterPass('raster', {
|
|
62
|
+
accesses: [{ resource: view.value, usage: 'color-attachment' }],
|
|
63
|
+
colorAttachments: [{ view: view.value, loadOp: 'clear', storeOp: 'store' }],
|
|
64
|
+
encode: () => undefined,
|
|
65
|
+
});
|
|
66
|
+
graph.addComputePass('compute', { accesses: [], encode: () => undefined });
|
|
67
|
+
graph.addCopyPass('copy', { accesses: [], encode: () => undefined });
|
|
68
|
+
graph.addComputePass('skipped', {
|
|
69
|
+
accesses: [],
|
|
70
|
+
executeIf: () => false,
|
|
71
|
+
encode: () => undefined,
|
|
72
|
+
});
|
|
73
|
+
return graph;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function mockEncoder(events: string[]): RhiCommandEncoder {
|
|
77
|
+
return {
|
|
78
|
+
beginRenderPass: (descriptor: RenderPassDescriptor) => {
|
|
79
|
+
events.push(`begin-raster:${descriptor.timestampWrites === undefined ? 'none' : 'timed'}`);
|
|
80
|
+
return { end: () => events.push('end-raster') } as unknown as RhiRenderPassEncoder;
|
|
81
|
+
},
|
|
82
|
+
beginComputePass: (descriptor: ComputePassDescriptor = {}) => {
|
|
83
|
+
events.push(`begin-compute:${descriptor.timestampWrites === undefined ? 'none' : 'timed'}`);
|
|
84
|
+
return { end: () => events.push('end-compute') } as unknown as RhiComputePassEncoder;
|
|
85
|
+
},
|
|
86
|
+
clearBuffer: () => events.push('clear-buffer'),
|
|
87
|
+
} as unknown as RhiCommandEncoder;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function value<T>(result: { readonly ok: true; readonly value: T } | { readonly ok: false }): T {
|
|
91
|
+
if (!result.ok) throw new Error('expected ok result');
|
|
92
|
+
return result.value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
describe('RenderGraph actual-pass timing instrumentation', () => {
|
|
96
|
+
it('reports only actual passes with compiled provenance and injects at pass boundaries', () => {
|
|
97
|
+
const graph = buildGraph();
|
|
98
|
+
const compiled = graph.compile({
|
|
99
|
+
device: mockDevice(),
|
|
100
|
+
surfaceSize: { width: 1, height: 1 },
|
|
101
|
+
});
|
|
102
|
+
expect(compiled.ok).toBe(true);
|
|
103
|
+
if (!compiled.ok) return;
|
|
104
|
+
|
|
105
|
+
const events: string[] = [];
|
|
106
|
+
const actualPasses: string[] = [];
|
|
107
|
+
const instrumentation: RenderGraphPassInstrumentation<Frame> = {
|
|
108
|
+
begin(pass) {
|
|
109
|
+
actualPasses.push(`${pass.executionIndex}:${pass.kind}:${pass.name}`);
|
|
110
|
+
return {
|
|
111
|
+
renderPassDescriptor: (descriptor) => ({
|
|
112
|
+
...descriptor,
|
|
113
|
+
timestampWrites: {
|
|
114
|
+
querySet: {} as never,
|
|
115
|
+
beginningOfPassWriteIndex: 0,
|
|
116
|
+
endOfPassWriteIndex: 1,
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
computePassDescriptor: (descriptor) => ({
|
|
120
|
+
...descriptor,
|
|
121
|
+
timestampWrites: {
|
|
122
|
+
querySet: {} as never,
|
|
123
|
+
beginningOfPassWriteIndex: 2,
|
|
124
|
+
endOfPassWriteIndex: 3,
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
beforeCopy: () => events.push('before-copy'),
|
|
128
|
+
afterCopy: () => events.push('after-copy'),
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const result = value(compiled).execute(
|
|
134
|
+
{ encoder: mockEncoder(events), source: {} as Buffer },
|
|
135
|
+
undefined,
|
|
136
|
+
instrumentation,
|
|
137
|
+
);
|
|
138
|
+
expect(result.ok).toBe(true);
|
|
139
|
+
expect(actualPasses).toEqual(['0:raster:raster', '1:compute:compute', '2:copy:copy']);
|
|
140
|
+
expect(events).toEqual([
|
|
141
|
+
'begin-raster:timed',
|
|
142
|
+
'end-raster',
|
|
143
|
+
'begin-compute:timed',
|
|
144
|
+
'end-compute',
|
|
145
|
+
'before-copy',
|
|
146
|
+
'after-copy',
|
|
147
|
+
]);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('keeps the no-hook graph and command ledger equivalent', () => {
|
|
151
|
+
const graph = buildGraph();
|
|
152
|
+
const compiled = graph.compile({
|
|
153
|
+
device: mockDevice(),
|
|
154
|
+
surfaceSize: { width: 1, height: 1 },
|
|
155
|
+
});
|
|
156
|
+
expect(compiled.ok).toBe(true);
|
|
157
|
+
if (!compiled.ok) return;
|
|
158
|
+
|
|
159
|
+
const events: string[] = [];
|
|
160
|
+
const result = value(compiled).execute({ encoder: mockEncoder(events), source: {} as Buffer });
|
|
161
|
+
expect(result.ok).toBe(true);
|
|
162
|
+
expect(events).toEqual([
|
|
163
|
+
'begin-raster:none',
|
|
164
|
+
'end-raster',
|
|
165
|
+
'begin-compute:none',
|
|
166
|
+
'end-compute',
|
|
167
|
+
]);
|
|
168
|
+
expect(
|
|
169
|
+
value(compiled)
|
|
170
|
+
.inspect()
|
|
171
|
+
.passes.map(({ name, kind, executionIndex }) => ({
|
|
172
|
+
name,
|
|
173
|
+
kind,
|
|
174
|
+
executionIndex,
|
|
175
|
+
})),
|
|
176
|
+
).toEqual([
|
|
177
|
+
{ name: 'raster', kind: 'raster', executionIndex: 0 },
|
|
178
|
+
{ name: 'compute', kind: 'compute', executionIndex: 1 },
|
|
179
|
+
{ name: 'copy', kind: 'copy', executionIndex: 2 },
|
|
180
|
+
{ name: 'skipped', kind: 'compute', executionIndex: 3 },
|
|
181
|
+
]);
|
|
182
|
+
});
|
|
183
|
+
});
|
package/src/builder.ts
CHANGED
|
@@ -597,10 +597,14 @@ export class RenderGraphBuilder<FrameCtx extends RenderGraphFrame> {
|
|
|
597
597
|
const item = this.normalizeAccess(passIndex, pass, access);
|
|
598
598
|
if (!item.ok) return item;
|
|
599
599
|
normalized.push(item.value);
|
|
600
|
+
const resource = this.resources.get(item.value.resourceId);
|
|
600
601
|
const usage =
|
|
601
|
-
|
|
602
|
+
(resource?.kind === 'texture' && resource.origin === 'created'
|
|
603
|
+
? (resource.descriptor.usage ?? 0)
|
|
604
|
+
: 0) |
|
|
605
|
+
(resource?.kind === 'buffer'
|
|
602
606
|
? bufferUsage(access.usage as GraphBufferAccess)
|
|
603
|
-
: textureUsage(access.usage as GraphTextureAccess);
|
|
607
|
+
: textureUsage(access.usage as GraphTextureAccess));
|
|
604
608
|
usageByResource.set(
|
|
605
609
|
item.value.resourceId,
|
|
606
610
|
(usageByResource.get(item.value.resourceId) ?? 0) | usage,
|
package/src/compiled-graph.ts
CHANGED
|
@@ -24,6 +24,7 @@ import type {
|
|
|
24
24
|
GraphTexture,
|
|
25
25
|
GraphTextureView,
|
|
26
26
|
RenderGraphFrame,
|
|
27
|
+
RenderGraphPassInstrumentation,
|
|
27
28
|
RenderGraphPassRunner,
|
|
28
29
|
} from './types.js';
|
|
29
30
|
|
|
@@ -82,7 +83,11 @@ export class CompiledRenderGraphImpl<FrameCtx extends RenderGraphFrame>
|
|
|
82
83
|
return this.colorTargetDescriptors.get(name);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
execute(
|
|
86
|
+
execute(
|
|
87
|
+
frame: FrameCtx,
|
|
88
|
+
runPass?: RenderGraphPassRunner,
|
|
89
|
+
instrumentation?: RenderGraphPassInstrumentation<FrameCtx>,
|
|
90
|
+
): Result<void, RenderGraphError> {
|
|
86
91
|
if (this.retired) {
|
|
87
92
|
return err(
|
|
88
93
|
new RenderGraphError({
|
|
@@ -101,6 +106,8 @@ export class CompiledRenderGraphImpl<FrameCtx extends RenderGraphFrame>
|
|
|
101
106
|
const resolver = this.createPassResolver(pass, resolved.value);
|
|
102
107
|
try {
|
|
103
108
|
if (pass.pass.descriptor.executeIf?.(frame) === false) continue;
|
|
109
|
+
const execution = { name: pass.name, kind: pass.pass.kind, executionIndex };
|
|
110
|
+
const scope = instrumentation?.begin(execution, frame);
|
|
104
111
|
let encodeResult: Result<void, RenderGraphError> = ok(undefined);
|
|
105
112
|
const encode = () => {
|
|
106
113
|
switch (pass.pass.kind) {
|
|
@@ -172,11 +179,14 @@ export class CompiledRenderGraphImpl<FrameCtx extends RenderGraphFrame>
|
|
|
172
179
|
: { stencilReadOnly: attachment.stencilReadOnly }),
|
|
173
180
|
};
|
|
174
181
|
}
|
|
175
|
-
const
|
|
182
|
+
const baseDescriptor = {
|
|
176
183
|
label: pass.name,
|
|
177
184
|
colorAttachments,
|
|
178
185
|
...(depthStencilAttachment === undefined ? {} : { depthStencilAttachment }),
|
|
179
|
-
}
|
|
186
|
+
};
|
|
187
|
+
const instrumentedDescriptor =
|
|
188
|
+
scope?.renderPassDescriptor?.(baseDescriptor) ?? baseDescriptor;
|
|
189
|
+
const encoder = frame.encoder.beginRenderPass(instrumentedDescriptor);
|
|
180
190
|
try {
|
|
181
191
|
descriptor.encode({ pass: encoder, frame, resources: resolver });
|
|
182
192
|
} finally {
|
|
@@ -186,9 +196,13 @@ export class CompiledRenderGraphImpl<FrameCtx extends RenderGraphFrame>
|
|
|
186
196
|
}
|
|
187
197
|
case 'compute': {
|
|
188
198
|
const begin = pass.pass.descriptor.begin?.(frame);
|
|
199
|
+
const instrumentedBegin = scope?.computePassDescriptor?.(begin ?? {}) ?? begin;
|
|
189
200
|
let encoder: RhiComputePassEncoder;
|
|
190
201
|
try {
|
|
191
|
-
encoder = frame.encoder.beginComputePass({
|
|
202
|
+
encoder = frame.encoder.beginComputePass({
|
|
203
|
+
...(instrumentedBegin ?? {}),
|
|
204
|
+
label: pass.name,
|
|
205
|
+
});
|
|
192
206
|
} catch (cause) {
|
|
193
207
|
pass.pass.descriptor.onBeginError?.(frame, cause);
|
|
194
208
|
throw cause;
|
|
@@ -202,14 +216,19 @@ export class CompiledRenderGraphImpl<FrameCtx extends RenderGraphFrame>
|
|
|
202
216
|
break;
|
|
203
217
|
}
|
|
204
218
|
case 'copy':
|
|
205
|
-
|
|
219
|
+
scope?.beforeCopy?.(frame.encoder);
|
|
220
|
+
try {
|
|
221
|
+
pass.pass.descriptor.encode({ encoder: frame.encoder, frame, resources: resolver });
|
|
222
|
+
} finally {
|
|
223
|
+
scope?.afterCopy?.(frame.encoder);
|
|
224
|
+
}
|
|
206
225
|
break;
|
|
207
226
|
}
|
|
208
227
|
};
|
|
209
228
|
if (runPass === undefined) {
|
|
210
229
|
encode();
|
|
211
230
|
} else {
|
|
212
|
-
runPass(
|
|
231
|
+
runPass(execution, encode);
|
|
213
232
|
}
|
|
214
233
|
if (!encodeResult.ok) return encodeResult;
|
|
215
234
|
} catch (cause) {
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
Buffer,
|
|
3
3
|
ComputePassDescriptor,
|
|
4
|
+
RenderPassDescriptor,
|
|
4
5
|
RhiCommandEncoder,
|
|
5
6
|
RhiComputePassEncoder,
|
|
6
7
|
RhiDevice,
|
|
@@ -45,7 +46,7 @@ export type GraphExtent =
|
|
|
45
46
|
export interface GraphTextureDescriptor {
|
|
46
47
|
readonly format: TextureFormat;
|
|
47
48
|
readonly size: GraphExtent;
|
|
48
|
-
/** Additional RHI usage required by an external diagnostic consumer. */
|
|
49
|
+
/** Additional RHI usage required by an external diagnostic consumer such as readback. */
|
|
49
50
|
readonly usage?: number | undefined;
|
|
50
51
|
readonly mipLevelCount?: number | undefined;
|
|
51
52
|
readonly sampleCount?: number | undefined;
|
|
@@ -244,13 +245,36 @@ export interface RenderGraphPassExecution {
|
|
|
244
245
|
|
|
245
246
|
export type RenderGraphPassRunner = (pass: RenderGraphPassExecution, encode: () => void) => void;
|
|
246
247
|
|
|
248
|
+
/**
|
|
249
|
+
* The graph-neutral boundary for observing and decorating an actual pass.
|
|
250
|
+
* Render owns the policy supplied here; the graph only preserves pass
|
|
251
|
+
* provenance and the existing encoder boundaries.
|
|
252
|
+
*/
|
|
253
|
+
export interface RenderGraphPassInstrumentationScope {
|
|
254
|
+
readonly renderPassDescriptor?: (descriptor: RenderPassDescriptor) => RenderPassDescriptor;
|
|
255
|
+
readonly computePassDescriptor?: (descriptor: ComputePassDescriptor) => ComputePassDescriptor;
|
|
256
|
+
readonly beforeCopy?: (encoder: RhiCommandEncoder) => void;
|
|
257
|
+
readonly afterCopy?: (encoder: RhiCommandEncoder) => void;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface RenderGraphPassInstrumentation<FrameCtx extends RenderGraphFrame> {
|
|
261
|
+
begin(
|
|
262
|
+
pass: RenderGraphPassExecution,
|
|
263
|
+
frame: FrameCtx,
|
|
264
|
+
): RenderGraphPassInstrumentationScope | undefined;
|
|
265
|
+
}
|
|
266
|
+
|
|
247
267
|
export interface RenderGraphCompileOptions {
|
|
248
268
|
readonly device: RhiDevice;
|
|
249
269
|
readonly surfaceSize: { readonly width: number; readonly height: number };
|
|
250
270
|
}
|
|
251
271
|
|
|
252
272
|
export interface CompiledRenderGraph<FrameCtx extends RenderGraphFrame> {
|
|
253
|
-
execute(
|
|
273
|
+
execute(
|
|
274
|
+
frame: FrameCtx,
|
|
275
|
+
runPass?: RenderGraphPassRunner,
|
|
276
|
+
instrumentation?: RenderGraphPassInstrumentation<FrameCtx>,
|
|
277
|
+
): Result<void, RenderGraphError>;
|
|
254
278
|
inspect(): CompiledRenderGraphInfo;
|
|
255
279
|
retire(): Promise<Result<void, RenderGraphError>>;
|
|
256
280
|
}
|