Skip to content

Conversation

@andreiborza
Copy link
Member

@andreiborza andreiborza commented Jan 14, 2026

Adds documentation for the skipRequestAnimationFrame option when using manual canvas snapshots with WebGPU.

WebGPU textures expire after the current task completes, so deferring snapshot capture to the next animation frame results in an empty canvas. This option captures immediately after rendering.

Sources:

Related: getsentry/sentry-javascript#18804

…nvas snapshots

WebGPU canvases require the skipRequestAnimationFrame option when using
manual snapshotting because WebGPU textures expire after the current task
completes, unlike WebGL which can use preserveDrawingBuffer.

References:
- WebGPU Explainer: https://gpuweb.github.io/gpuweb/explainer/
- gpuweb/gpuweb#2743: WebGPU rejected preserveDrawingBuffer by design
- gpuweb/gpuweb#3295: Canvas texture expiry timing

Co-Authored-By: Claude <[email protected]>
@vercel
Copy link

vercel bot commented Jan 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
sentry-docs Ready Ready Preview, Comment Jan 15, 2026 9:45am
1 Skipped Deployment
Project Deployment Review Updated (UTC)
develop-docs Ignored Ignored Preview Jan 15, 2026 9:45am

@codeowner-assignment codeowner-assignment bot requested a review from a team January 14, 2026 15:51
Copy link
Collaborator

@inventarSarah inventarSarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall.
Just two comments from my side -- please have a look :)


WebGPU works differently from WebGL. The canvas texture returned by `getCurrentTexture()` is only valid until the current task completes - after that, the texture expires and its contents are no longer accessible. This means that by default, when `snapshot()` defers capture to the next animation frame, it will capture an empty or invalid canvas.

To fix this, pass `skipRequestAnimationFrame: true` to capture the snapshot immediately:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also require setting enableManualSnapshot: true? If so, we could add the 2-step explanation as in the WebGL section to make sure users don't miss it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, yea it does. Good catch!

andreiborza and others added 2 commits January 15, 2026 10:26
Clarify that enableManualSnapshot must be set before using
skipRequestAnimationFrame for WebGPU canvas snapshots. Follows
the same 2-step pattern as the WebGL section to ensure users
don't miss required configuration.

Co-Authored-By: Claude <[email protected]>
Copy link
Collaborator

@inventarSarah inventarSarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍looks great now!

@andreiborza andreiborza merged commit 93323cb into master Jan 15, 2026
14 checks passed
@andreiborza andreiborza deleted the ab/docs-replay-canvas-webgpu-snapshot branch January 15, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants