Skip to content
Snippets Groups Projects

Gamma correct blending with sRGB

Merged Pekka Paalanen requested to merge pq/weston:mr/color-arch into main
5 files
+ 242
2
Compare changes
  • Side-by-side
  • Inline
Files
5
  • This makes weston_color_transform object be able to express
    three-channel one-dimensional look-up table transformations. They are
    useful for applying EOTF and EOTF^-1 mapping, or, gamma curves.
    
    The code added here translates from the lut_3x1d fill_in() interface to
    a GL texture to be used with SHADER_TRANSFER_FUNCTION_LUT_3x1D for
    weston_surfaces.
    
    It demonstrates how renderer data is attached to weston_color_transform
    and cached.
    
    GL_OES_texture_float_linear is required to be able to use bilinear
    texture filtering with 32-bit floating-point textures, used for the LUT.
    
    As the size of the LUT depends on what implements it, lut_3x1d fill_in()
    interface is a callback to the color management component to ask for an
    arbitrary size. For GL-renderer this is not important as it can easily
    realize any LUT size, but when DRM-backend wants to offload the EOTF^-1
    mapping to KMS (GAMMA_LUT), the LUT size comes from KMS.
    
    Nothing actually implements lut_3x1d fill_in() yet, that will come in a
    later patch.
    
    Signed-off-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
@@ -83,6 +83,7 @@ static_assert(sizeof(struct gl_shader_requirements) ==
"struct gl_shader_requirements must not contain implicit padding");
struct gl_shader;
struct weston_color_transform;
#define GL_SHADER_INPUT_TEX_MAX 3
struct gl_shader_config {
@@ -234,4 +235,8 @@ gl_renderer_use_program(struct gl_renderer *gr,
struct weston_log_scope *
gl_shader_scope_create(struct gl_renderer *gr);
bool
gl_shader_config_set_color_transform(struct gl_shader_config *sconf,
struct weston_color_transform *xform);
#endif /* GL_RENDERER_INTERNAL_H */
Loading