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

Can WebGPU canvas alpha be configured? #1425

@kainino0x

Description

@kainino0x

For WebGPU (gpupresent) canvases, I want to propose that the following options (from WebGL) would be unconfigurable and fixed at the following values. I thought we previously agreed on these, but I'm not sure where, and it would have been a VERY long time ago.

  • alpha: true - In WebGL, alpha:false has significant cost on some platforms because it's necessary to use RGBA instead of RGB, meaning the platform surface/overlay's alpha channel needs to get cleared or guarded against writes. It's possible that we can sidestep this issue in WebGL - perhaps problems that force us to use RGBA won't be present, but I don't think we should bank on it. This may also change the swap chain format to e.g. rgb8unorm, which we don't even have.
  • premultipliedAlpha: true - Platform surfaces/overlays generally require premultiplied alpha (AFAIK). Unfortunately, this means color values where r>a || g>a || b>a cause undefined compositing results (this is true in WebGL) (but not undefined JS-visible results).

Related: #1408 (comment) for preserveDrawingBuffer

CC cts issue: gpuweb/cts#460

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions