[patch] Cherry-pick e357f015391ac32e8d262b4ea2bd0e3fe1e87fe6

Original commit message:

    Revert "Cut performance cost in QSGContext::prepareMaterial()".

    This reverts commit 0e9cd8b4098661bf611fa73a787c58c85e7d7338.

    This optimization breaks ShaderEffects with changing fragment
    and vertex shaders and needs some more thought.

    Task-number: QTBUG-31837
    Change-Id: I1abe249c65dd785825c249a7c22baee928bd76c8
    Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>