mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
This adds several fields to `ExternalTextureDescriptor`, specifying how to handle color space conversion for an external texture. These fields consist of transfer functions for the source and destination color spaces, and a matrix for converting between gamuts. This allows `ImageSample` and `ImageLoad` operations on external textures to return values in a desired destination color space rather than the source color space of the underlying planes. These fields are plumbed through to the `ExternalTextureParams` uniform buffer from which they are exposed to the shader. Following conversion from YUV to RGB after sampling/loading from the external texture planes, the shader uses them to gamma decode to linear RGB in the source color space, convert from source to destination gamut, then finally gamma encode to non-linear RGB in the destination color space.