-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
First off, amazing tool! I had some things to resolve to use it:
- I need it to work in a worker
- I want it it worker programmatically instead of interactively.
I was able to get both to work but i'm not sure if/how you want to integrate it.
I changed to:
function __WebGPUReconstruct_requestAnimationFrame_callback(timestamp) {
__WebGPUReconstruct_file.writeUint32(2);
__WebGPUReconstruct_file.writeUint32(1);
const globalScope =
typeof window !== "undefined" ? window :
typeof self !== "undefined" ? self :
undefined;
__webGPUReconstruct.animationFrameID = __webGPUReconstruct.requestAnimationFrame_original.call(globalScope, __WebGPUReconstruct_requestAnimationFrame_callback);
}
I have a maxFrames and numFrames. Because our requestAnimationFrame may run before our webgpu component is rendering, I count submits in __WebGPUReconstruct_GPUQueue_submit and only consider it a frame if it is non-zero for a call of requestAnimationFrame. Then when maxFrames is reached requestAnimationFrame calls finishCapture.
I removed document.addEventListener('__WebGPUReconstruct_saveCapture' add added this into finishCapture
const blob = new Blob(__WebGPUReconstruct_file.arrays);
postMessage({ type: 'wgpuCaptureData', data: blob });
Which is then hooked when the worker is created.
Ideally I'd like to see:
- The build script/package containing a "manual" file which can be imported (could be useful as an npm package too)
- Detect if it's in a worker or not and directly download or postmessage
- Export the WebgpuReconstruct class so it can be created programmatically, and with configuration parameters (e.g. maxFrames)
If I know your thoughts I can also try to make a PR.
Metadata
Metadata
Assignees
Labels
No labels