这是indexloc提供的服务,不要输入任何密码
Skip to content

Canvas texture expiry timing is unpredictable #3295

@kainino0x

Description

@kainino0x

EDIT: Updated title to reflect both: issues with invisible canvases, and general unreliability of timing in the event loop.


Right now it's not clear whether Update the rendering of the WebGPU canvas gets called for canvases not in the DOM. This affects the advancement of the frame, i.e. whether the next call to getCurrentTexture() will return the same texture or a new one.

WebGL (with preserveDrawingBuffer: false) has an equivalent question, which is whether the drawing buffer gets replaced or not. This test case tries to test that: https://codepen.io/kainino0x/pen/mdxKKyM
Unfortunately, the results are kind of wonky.

  • Firefox and Chrome seem to advance the frame only if the canvas is actually visible (inside the viewport) OR it's had transferControlToOffscreen called on it. Neither of them advances a new OffscreenCanvas.
  • Safari seems to advances the frame as long as it's in the DOM. (no OffscreenCanvas support)

Tasks (see below)

  • Figure out behavior for canvases
  • Consider if behavior for external textures should match closer to behavior for canvases

Metadata

Metadata

Assignees

Labels

copyeditingPure editorial stuff (copyediting, *.bs file syntax, etc.)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions