Skip to content
Snippets Groups Projects

Gamma correct blending with sRGB

Merged Pekka Paalanen requested to merge pq/weston:mr/color-arch into main
Compare changes
  • Side-by-side
  • Inline
Files
4
  • 4345be90
    This adds shader support for using a three-channel one-dimensional
    look-up table for mapping input colors. This operation will be useful
    for applying EOTF or its inverse, in other words, gamma curves.
    
    Even though called three-channel and one-dimensional, it is actually
    implemented as a one-channel two-dimensional texture with four rows.
    Each row corresponds to a source color channel except the fourth one is
    unused. The reason for having the fourth row is to get texture
    coordinates in 1/8 steps instead of 1/6 steps. 1/6 may would not be
    exact in floating- or fixed-point arithmetic and might perhaps risk
    unintended results from bilinear texture filtering when we want linear
    filtering only in x but not in y texture coordinates. I may be paranoid.
    
    The LUT is applied on source colors after they have been converted to
    straight RGB. It cannot be applied with pre-multiplied alpha. A LUT can
    be used for both applying EOTF to go from source color space to blending
    color space, and EOTF^-1 to go from blending space to output
    (electrical) space. However, this type of LUT cannot do color space
    conversions.
    
    For now, this feature is hardcoded to off everywhere, to be enabled in
    following patches.
    
    Signed-off-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
Loading