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

copyToTexture for color-managed image sources #1483

@kainino0x

Description

@kainino0x

We agreed upon a copyToTexture (aka copyFromTextureSource/copyImageBitmapToTexture) for various image sources (ImageBitmap, HTMLCanvasElement, HTMLVideoElement, OffscreenCanvas in #1154). Of note, all of these image sources are color-managed - that is, they represent colors. (IIUC ImageData should be treated as color-managed as well.)

GPUTextures are not color-managed - they represent raw float/int/norm numbers (with optional srgb conversions). This means colorspace conversions can/should occur inside copyToTexture. In order to do this, we need to know (and specify) the destination colorspace and encoding.

  • An easy starting point is to specify that the destination colorspace/encoding are always well-known defaults. This lets us add optional dictionary options later on that allow changing the defaults - but this would require feature detection, so it's best if we add a member earlier, even if it has only one legal value and it's the default.
  • It's important to get the encoding conversions right - that is, srgb vs non-srgb. We allow both srgb and non-srgb formats as copy destinations, and we need to make sure applications can achieve the managed-image-upload semantics they need. (Note they can also get exact behavior by uploading using writeTexture instead, which involves no color management.)

See also #1482 about high-bit-depth sources.
See https://github.com/WICG/canvas-color-space about output colorspace/encoding.

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions