color: fail weston_color_curve_to_3x1D_LUT() when !xform->steps_valid

This is a leftover from "color: do not use color steps for non-optimized
pipelines". If a xform don't have valid steps, it shouldn't have curves.
So this function should fail.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2025-06-10 20:52:12 -03:00
parent fceb4151a3
commit e77ca25a80

View file

@ -339,7 +339,8 @@ curve_to_lut_has_good_precision(struct weston_color_curve *curve)
/**
* Given a xform and an enum corresponding to one of its curves (pre or post),
* returns a 3x1D LUT that corresponds to such curve.
* returns a 3x1D LUT that corresponds to such curve. This only works for
* transformations such that xform->steps_valid.
*
* The 3x1D LUT returned looks like this: the first lut_size elements compose
* the LUT for the R channel, the next lut_size elements compose the LUT for the
@ -382,6 +383,13 @@ weston_color_curve_to_3x1D_LUT(struct weston_compositor *compositor,
weston_assert_not_reached(compositor, "unknown curve step");
}
if (!xform->steps_valid) {
str_printf(err_msg, "can't create LUT from xform (id %u) %s-curve, as the " \
"xform don't have valid steps",
xform->id, step_str);
return NULL;
}
if (!curve_to_lut_has_good_precision(curve)) {
if (precision_mode == WESTON_COLOR_PRECISION_CAREFUL) {
str_printf(err_msg, "can't create color LUT from xform (id %u) " \