Bug 1679700 - Cast int parameter in get_yuv_offset_vector to float, to work around a shader compilation bug with integer equality comparisons on macOS Intel. r=jrmuizel

We've encountered similar bugs before, e.g.
https://github.com/servo/webrender/wiki/Driver-issues#3540---mac-glsl-compiler-bug-with-integer-comparison-take-two

We don't want to change this `if` to a `switch` because glsl-opt compiles it
down to an if statement anyway, just a more complicated one (which was triggering
other bugs on other platforms, see bug 1678924).

Differential Revision: https://phabricator.services.mozilla.com/D98208
This commit is contained in:
Markus Stange 2020-11-30 19:54:41 +00:00
Родитель ac75b50d8b
Коммит d74d995c13
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -86,7 +86,8 @@ mat3 get_yuv_color_matrix(int color_space) {
}
vec3 get_yuv_offset_vector(int color_space) {
if (color_space == YUV_COLOR_SPACE_IDENTITY) {
// Float conversion to work around a macOS Intel shader compiler bug
if (float(color_space) == float(YUV_COLOR_SPACE_IDENTITY)) {
return vec3(0.0, 0.0, 0.0);
} else {
return vec3(0.06275, 0.50196, 0.50196);