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

What is the toDataURL behavior for GPUCanvasContext? #1548

@kdashg

Description

@kdashg

WebGL does this:

  1. If there has been a draw call to the drawing buffer since last Present, snapshot the current contents of the drawing buffer.
  2. Otherwise, snapshot the contents of the most-recently-Presented frame.

In a sense, toDataURL gives the contents that the page can expect to see next frame, if no other calls are made before next Present.

WebGPU absolutely wants number 2, but while WebGL just has a built-in default framebuffer, WebGPU has more parts: GPUCanvasContext, GPUSwapChain, and GPUTexture getCurrentTexture().

I suppose a potential solution would be:

  1. If there has been a call to getCurrentTexture() since last Present, snapshot the current contents of getCurrentTexture.
  2. Otherwise, snapshot the contents of the most-recently-Presented frame.

This came up in the context of #1474 where we want to also know, for alphaMode:opaque, when/whether we're requiring that toDataURL clears alpha to 1.0.

@kenrussell @RafaelCintron

[edit -KN] Related discussion: #1408 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions