Skip to content

copyExternalImageToTexture/importExternalTexture with destination in linear color space #1715

@kainino0x

Description

@kainino0x

Image sources (like JPEG) are typically non-linearly encoded, e.g. with sRGB.
Using copyExternalImageToTexture, these non-linear values can be uploaded into:

  • e.g. rgba8unorm, if the application wants to sample the original values
  • e.g. rgba8unorm-srgb, if the application wants to sample linear values (e.g. for linear rendering pipelines).
    EDIT: probably only if the destination color space is srgb-encoded [1], and not premultiplied [2])

However in order to store actual linear values in the texture (in particular with formats like rgba16float), currently applications would need to perform the conversion themselves (either on CPU + writeTexture, or in a compute/fragment shader).

A destination color-space option on copyExternalImageToTexture (soon to be added) would provide a place for users to control the upload: instead of srgb, they could specify srgb-linear, which is the same color space but linearly encoded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU API

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions