@forgeax/engine-rhi-debug 0.1.34 → 0.1.35

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
@@ -116,6 +116,8 @@ supplied backend remains owned by its caller.
116
116
  `inspectWork(..., ['pixels'])` reads the first color attachment's resolve target
117
117
  when present, after finishing the selected work's pass. Direct reads of an
118
118
  unresolved multisampled texture return `readback-unsupported` before any copy.
119
+ Partial replay closes command and pass debug groups still open at the selected
120
+ work, deriving the scopes from the recorded prefix without running later draws.
119
121
  The remaining readback matrix is explicit: supported color/depth formats use
120
122
  the backend path, unsupported formats return `readback-unsupported`, and
121
123
  transfer or map failures return `readback-failed`.
package/dist/index.mjs CHANGED
@@ -10645,6 +10645,13 @@ async function finalizeWorkPass(context, index, work) {
10645
10645
  finishEventIndex ?? context.tape.events.length
10646
10646
  );
10647
10647
  if (!closure.ok) return closure;
10648
+ const groupsClosed = closeReplayDebugGroups(
10649
+ context,
10650
+ begin.cmdHandleId,
10651
+ work.eventIndex,
10652
+ encoder.resource.value
10653
+ );
10654
+ if (!groupsClosed.ok) return groupsClosed;
10648
10655
  const finished = encoder.resource.value.finish();
10649
10656
  const finishEvent = context.tape.events[finishEventIndex ?? work.eventIndex] ?? begin;
10650
10657
  if (!finished.ok)
@@ -10700,6 +10707,15 @@ function closeReplayPass(context, entry, begin, pass, selectedEventIndex) {
10700
10707
  );
10701
10708
  }
10702
10709
  }
10710
+ if (entry.resource.role === "render-pass") {
10711
+ const groupsClosed = closeReplayDebugGroups(
10712
+ context,
10713
+ begin.passHandleId,
10714
+ selectedEventIndex,
10715
+ entry.resource.value
10716
+ );
10717
+ if (!groupsClosed.ok) return groupsClosed;
10718
+ }
10703
10719
  entry.resource.value.end();
10704
10720
  } catch (cause) {
10705
10721
  return eventFailure(pass.endEventIndex ?? selectedEventIndex, begin, "encode", cause);
@@ -10707,6 +10723,28 @@ function closeReplayPass(context, entry, begin, pass, selectedEventIndex) {
10707
10723
  context.table.delete(begin.passHandleId);
10708
10724
  return ok(void 0);
10709
10725
  }
10726
+ function closeReplayDebugGroups(context, handleId, throughEventIndex, encoder) {
10727
+ const open = [];
10728
+ for (let eventIndex = 0; eventIndex <= throughEventIndex; eventIndex++) {
10729
+ const event = context.tape.events[eventIndex];
10730
+ if (event === void 0) continue;
10731
+ if (event.kind === "pushDebugGroup" && event.cmdHandleId === handleId || event.kind === "passPushDebugGroup" && event.passHandleId === handleId) {
10732
+ open.push({ event, eventIndex });
10733
+ } else if (event.kind === "popDebugGroup" && event.cmdHandleId === handleId || event.kind === "passPopDebugGroup" && event.passHandleId === handleId) {
10734
+ open.pop();
10735
+ }
10736
+ }
10737
+ for (let index = open.length - 1; index >= 0; index--) {
10738
+ const scope = open[index];
10739
+ if (scope === void 0) continue;
10740
+ try {
10741
+ encoder.popDebugGroup();
10742
+ } catch (cause) {
10743
+ return eventFailure(scope.eventIndex, scope.event, "encode", cause);
10744
+ }
10745
+ }
10746
+ return ok(void 0);
10747
+ }
10710
10748
  async function replayCommandClosure(context, cmdHandleId, start, end) {
10711
10749
  for (let eventIndex = start; eventIndex < end; eventIndex++) {
10712
10750
  const event = context.tape.events[eventIndex];