Re-land "Inline and micro-optimize more for perf tests.""

Re-land fixes memory leaks.

Using a custom array instead of std::vector speeds up the resource
manager. One reason is because calls to size() are implemented in many
implementations as a difference between two pointers. This sub size
implementations are slower than storing a simple size variable in a
custom class.

Also includes more inlining of hot spots functions.

Also includes a small unit test class for ResourceMap. And an unrelated
but small test fix for TextureLimisTest. Also a small unrelated fix for
a Transform Feedback test.

Increase the scores of the draw call perf test with texture and buffer
bindings and the buffer binding perf test.

Bug: angleproject:2763
Change-Id: Ic2f0f689107b2bf05c63da2ed6bbc9f0feea63f7
Reviewed-on: https://chromium-review.googlesource.com/1229033
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 5a1521e..30b8251 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -2981,20 +2981,6 @@
 
 bool ValidateBindTexture(Context *context, TextureType target, GLuint texture)
 {
-    Texture *textureObject = context->getTexture(texture);
-    if (textureObject && textureObject->getType() != target && texture != 0)
-    {
-        ANGLE_VALIDATION_ERR(context, InvalidOperation(), TypeMismatch);
-        return false;
-    }
-
-    if (!context->getGLState().isBindGeneratesResourceEnabled() &&
-        !context->isTextureGenerated(texture))
-    {
-        context->handleError(InvalidOperation() << "Texture was not generated");
-        return false;
-    }
-
     switch (target)
     {
         case TextureType::_2D:
@@ -3046,6 +3032,25 @@
             return false;
     }
 
+    if (texture == 0)
+    {
+        return true;
+    }
+
+    Texture *textureObject = context->getTexture(texture);
+    if (textureObject && textureObject->getType() != target)
+    {
+        ANGLE_VALIDATION_ERR(context, InvalidOperation(), TypeMismatch);
+        return false;
+    }
+
+    if (!context->getGLState().isBindGeneratesResourceEnabled() &&
+        !context->isTextureGenerated(texture))
+    {
+        context->handleError(InvalidOperation() << "Texture was not generated");
+        return false;
+    }
+
     return true;
 }