Since the change to prevent shader recompilation at every update, we got a regression when clearcoat was used. Basically at the shader build time we would determine if the shader needed clear coat, and if it didin't, it would build a different GLSL program. However if later the user updated the clearcoat value so that it would then require the full clearcoat shader, the user wouldn't get it until manually forcing the shader to recompile, or reopening the file. We now handle the optimization in the GLSL code. That adds a minimum overhead due to branching. But the overall performance seems unchanged (tested on linux in AMD and NVidia). Reviewers: pascal, brecht, fclem Differential Revision: https://developer.blender.org/D2822