Use active textures mask in GL and Vulkan.

This also inlines a few accessors and changes the type of the texture
cache.

Bug: angleproject:2763
Change-Id: I82f3c508613f6284d835e8cb64808cfe26a56161
Reviewed-on: https://chromium-review.googlesource.com/1166142
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
index b657c57..b8d35bc 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
@@ -969,27 +969,27 @@
 
 gl::Error ContextVk::updateActiveTextures(const gl::Context *context)
 {
-    const auto &completeTextures = mState.getState().getCompleteTextureCache();
-    const gl::Program *program   = mState.getState().getProgram();
+    const gl::State &glState   = mState.getState();
+    const gl::Program *program = glState.getProgram();
 
     mActiveTextures.fill(nullptr);
 
-    for (const gl::SamplerBinding &samplerBinding : program->getSamplerBindings())
+    const gl::ActiveTexturePointerArray &textures  = glState.getActiveTexturesCache();
+    const gl::ActiveTextureMask &activeTextures    = program->getActiveSamplersMask();
+    const gl::ActiveTextureTypeArray &textureTypes = program->getActiveSamplerTypes();
+
+    for (size_t textureUnit : activeTextures)
     {
-        ASSERT(!samplerBinding.unreferenced);
+        gl::Texture *texture        = textures[textureUnit];
+        gl::TextureType textureType = textureTypes[textureUnit];
 
-        for (GLuint textureUnit : samplerBinding.boundTextureUnits)
+        // Null textures represent incomplete textures.
+        if (texture == nullptr)
         {
-            gl::Texture *texture = completeTextures[textureUnit];
-
-            // Null textures represent incomplete textures.
-            if (texture == nullptr)
-            {
-                ANGLE_TRY(getIncompleteTexture(context, samplerBinding.textureType, &texture));
-            }
-
-            mActiveTextures[textureUnit] = vk::GetImpl(texture);
+            ANGLE_TRY(getIncompleteTexture(context, textureType, &texture));
         }
+
+        mActiveTextures[textureUnit] = vk::GetImpl(texture);
     }
 
     return gl::NoError();