color-lcms: move 3D LUT vs. blend-to-output assert

There is no reason why cmlcms_fill_in_3dlut() would not work for
blend-to-output category, so the assert is a little misplaced.

However, there would be a bug if 3D LUT was used for blend-to-output,
because we should never fail to optimize that chain. Put the assert
where it belongs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2024-02-28 15:16:52 +02:00 committed by Pekka Paalanen
parent 4b9fa23ec6
commit 5223b8430e

View File

@ -132,9 +132,6 @@ cmlcms_fill_in_3dlut(struct weston_color_transform *xform_base,
unsigned int value_b, value_r, value_g;
float divider = len - 1;
assert(xform->search_key.category == CMLCMS_CATEGORY_INPUT_TO_BLEND ||
xform->search_key.category == CMLCMS_CATEGORY_INPUT_TO_OUTPUT);
for (value_b = 0; value_b < len; value_b++) {
for (value_g = 0; value_g < len; value_g++) {
for (value_r = 0; value_r < len; value_r++) {
@ -935,7 +932,14 @@ xform_realize_chain(struct cmlcms_color_transform *xform)
case CMLCMS_TRANSFORM_FAILED:
goto failed;
case CMLCMS_TRANSFORM_OPTIMIZED:
break;
case CMLCMS_TRANSFORM_3DLUT:
/*
* Given the chain formed above, blend-to-output should never
* fall back to 3D LUT.
*/
weston_assert_uint32_neq(cm->base.compositor, xform->search_key.category,
CMLCMS_CATEGORY_BLEND_TO_OUTPUT);
break;
}