Make Context handle dirty texture events.

Moving from State to Context allows the Context to update the State
Cache class directly. It also calls through to the State class to
update the Texture cache. This consolidates notification events into
the Context class. This is also in line with how we handle state event
updates in other gl classes.

Bug: angleproject:2747
Bug: angleproject:2763
Change-Id: Iff7dc7e46ee8768819235ebd151707cd2a03dfc9
Reviewed-on: https://chromium-review.googlesource.com/1166143
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 0d30951..48fd5fc 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -298,9 +298,11 @@
 static_assert(static_cast<gl::PrimitiveMode>(11) == gl::PrimitiveMode::EnumCount,
               "gl::PrimitiveMode enum values have changed, update kMinimumPrimitiveCounts.");
 
-constexpr angle::SubjectIndex kVertexArraySubjectIndex     = 0;
-constexpr angle::SubjectIndex kReadFramebufferSubjectIndex = 1;
-constexpr angle::SubjectIndex kDrawFramebufferSubjectIndex = 2;
+constexpr angle::SubjectIndex kVertexArraySubjectIndex = gl::IMPLEMENTATION_MAX_ACTIVE_TEXTURES + 0;
+constexpr angle::SubjectIndex kReadFramebufferSubjectIndex =
+    gl::IMPLEMENTATION_MAX_ACTIVE_TEXTURES + 1;
+constexpr angle::SubjectIndex kDrawFramebufferSubjectIndex =
+    gl::IMPLEMENTATION_MAX_ACTIVE_TEXTURES + 2;
 }  // anonymous namespace
 
 namespace gl
@@ -7561,7 +7563,6 @@
                                    angle::SubjectIndex index,
                                    angle::SubjectMessage message)
 {
-    ASSERT(message == angle::SubjectMessage::CONTENTS_CHANGED);
     switch (index)
     {
         case kVertexArraySubjectIndex:
@@ -7578,7 +7579,8 @@
             break;
 
         default:
-            UNREACHABLE();
+            ASSERT(index < mGLState.getActiveTexturesCache().size());
+            mGLState.onActiveTextureStateChange(index);
             break;
     }
 }