@forgeax/engine-render-graph 0.1.21 → 0.1.24

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 CHANGED
@@ -107,6 +107,40 @@ 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.
110
144
  > [!NOTE]
111
145
  > `timestampWrites` and an `after(frame)` callback are neutral graph seams. They
112
146
  > let a pipeline owner place a backend command at a declared pass boundary, but
@@ -1 +1 @@
1
- {"version":3,"file":"compiled-graph.d.ts","sourceRoot":"","sources":["../src/compiled-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,SAAS,EAC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false) continue;
116
116
  const execution = { name: pass.name, kind: pass.pass.kind, executionIndex };
117
- const scope = instrumentation?.begin(execution, frame);
118
117
  let encodeResult = ok(void 0);
119
118
  const encode = () => {
119
+ const scope = instrumentation?.begin(execution, frame);
120
120
  switch (pass.pass.kind) {
121
121
  case "raster": {
122
122
  const descriptor = pass.pass.descriptor;
@@ -165,7 +165,8 @@ var CompiledRenderGraphImpl = class {
165
165
  const baseDescriptor = {
166
166
  label: pass.name,
167
167
  colorAttachments,
168
- ...depthStencilAttachment === void 0 ? {} : { depthStencilAttachment }
168
+ ...depthStencilAttachment === void 0 ? {} : { depthStencilAttachment },
169
+ ...pass.pass.descriptor.occlusionQuerySet === void 0 ? {} : { occlusionQuerySet: pass.pass.descriptor.occlusionQuerySet }
169
170
  };
170
171
  const instrumentedDescriptor = scope?.renderPassDescriptor?.(baseDescriptor) ?? baseDescriptor;
171
172
  const encoder = frame.encoder.beginRenderPass(instrumentedDescriptor);