render/color: replace COLOR_TRANSFORM_LUT_3D with COLOR_TRANSFORM_LCMS2

Converting the LCMS2 transform to a 3D LUT early causes issues:

- It's a lossy process, the consumer will not be able to pick a
  3D LUT size on their own.
- It requires unnecessary conversions and allocations: an intermediate
  3D LUT is allocated, but the renderer already allocates one.
- It makes it harder to support arbitrary color transforms in the
  renderer, because each type needs to be handled differently.

Instead, expose a function to evaluate a color transform, and use
that to build the 3D LUT in the renderer.
This commit is contained in:
Simon Ser 2025-05-24 13:04:45 +02:00 committed by Kenny Levinsen
parent 9b97e2607d
commit 3665b53e29
6 changed files with 109 additions and 111 deletions

View file

@ -1,5 +1,6 @@
#include <wlr/render/color.h>
#include <stdlib.h>
#include <wlr/util/log.h>
#include "render/color.h"
struct wlr_color_transform *wlr_color_transform_init_linear_to_icc(
const void *data, size_t size) {
@ -7,3 +8,17 @@ struct wlr_color_transform *wlr_color_transform_init_linear_to_icc(
"LCMS2 is compile-time disabled");
return NULL;
}
struct wlr_color_transform_lcms2 *color_transform_lcms2_from_base(
struct wlr_color_transform *tr) {
abort(); // unreachable
}
void color_transform_lcms2_finish(struct wlr_color_transform_lcms2 *tr) {
abort(); // unreachable
}
void color_transform_lcms2_eval(struct wlr_color_transform_lcms2 *tr,
float out[static 3], const float in[static 3]) {
abort(); // unreachable
}