[cogl-material] Always bind the new texture handle
[cogl-material] Always bind the new texture handle

Cogl previously tried to cache the currently bound texture when
drawing through the material API to avoid excessive GL calls. However,
a few other places in Cogl and Clutter rebind the texture as well so
this can cause problems.

This was causing shaped windows to fail in Mutter because
ClutterGLXTexturePixmap was binding a different texture to update it
while the second texture unit was still active which meant the mask
texture would not be selected when the shaped window was drawn
subsequent times.

Ideally we would fix this by providing a wrapper around glBindTexture
which would affect the cached value. The cache would also have to be
cleared if a selected texture was deleted.

spatulasnout/cogl,djdeath/cogl,Distrotech/cogl,djdeath/cogl-android,djdeath/cogl-android,gcampax/cogl,collects/cogl,Distrotech/cogl,gcampax/cogl,collects/cogl,gcampax/cogl,djdeath/cogl-android,djdeath/cogl,Distrotech/cogl,spatulasnout/cogl,djdeath/cogl,Distrotech/cogl,gcampax/cogl