Bug 1726755 - Fix brush_mix_blend shader on Adreno 3xx. r=gfx-reviewers,kvark
Bug 1726755 - Fix brush_mix_blend shader on Adreno 3xx. r=gfx-reviewers,kvark

On some Adreno 3xx devices, the brush_mix_blend shader renders its
output as coloured triangles. This is another instance of the driver
bug from bug 1630356, where the presence of a flat varying
scalar ("v_op" in this case) causes the entire fragment shader output
to be flat, ie a single colour per primitive.

In the past we have worked around this by packing the varying in to a
vector. Unfortunately, however, in brush_mix_blend this causes us to
encounter yet another driver bug. Using the component of the new
vector as the switch condition (or if conditions in the optimized
output) does not work: none of the cases are exectuted and the output
is rendered as the default yellow.

Unpacking the vector's component in to a local variable prior to the
switch avoids this bug, however it gets optimized away by glslopt. To
prevent that, we perform a bitwise AND on the component. This should
have no logical effect and have negligable cost, but importantly
avoids the driver bug meaning the correct branch is taken and the
shader renders correctly.

Differential Revision: https://phabricator.services.mozilla.com/D123766

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/bad21e5a37077a02e26b6176f145b8f6eb16934e

servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender