gl-shaders: Remove asserts relying on shader compiler behavior

yuv_coefficients and yuv_offsets should get optimized away by shader
compilers as the related code paths can never be reached. This seems to
work well on Mesa but not necessarily with other drivers.

While on it, assert that the uniforms *are* present, unless the
yuv-to-rgb conversion is handled by the driver.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
(cherry picked from commit 5c49563ef4)
This commit is contained in:
Robert Mader 2026-03-02 13:11:05 +01:00 committed by Marius Vlad
parent c9c305121c
commit 82d6297416

View file

@ -762,8 +762,18 @@ gl_shader_load_config_representation(struct weston_compositor *compositor,
if (sconf->yuv_coefficients == WESTON_COLOR_MATRIX_COEF_UNSET ||
sconf->yuv_coefficients == WESTON_COLOR_MATRIX_COEF_IDENTITY) {
assert(shader->yuv_coefficients_uniform == -1);
assert(shader->yuv_offsets_uniform == -1);
/*
* In this case the yuv_coefficients and yuv_offsets uniforms
* should never be used and thus get optimized away by the
* shader compiler. Unfortunately on some drivers this is not
* the case, so we can't assert on it.
*/
return;
}
if (shader->yuv_coefficients_uniform == -1 ||
shader->yuv_offsets_uniform == -1) {
assert(shader->key.variant == SHADER_VARIANT_EXTERNAL);
return;
}