Refactor all the Bind* GLES 2.0 entry points.

This requires storing a reference the the Context's Framebuffer map
in the ValidationContext. Likely we'll need to do this as well for
the other non-shared object types.

BUG=angleproject:747

Change-Id: I73ee8b0be3c3b9e54b7e48e49d6f738cf1d926dd
Reviewed-on: https://chromium-review.googlesource.com/407843
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/ContextState.cpp b/src/libANGLE/ContextState.cpp
index 2a3b68e..dbf8679 100644
--- a/src/libANGLE/ContextState.cpp
+++ b/src/libANGLE/ContextState.cpp
@@ -21,7 +21,8 @@
                            const TextureCapsMap &textureCapsIn,
                            const Extensions &extensionsIn,
                            const ResourceManager *resourceManagerIn,
-                           const Limitations &limitationsIn)
+                           const Limitations &limitationsIn,
+                           const ResourceMap<Framebuffer> &framebufferMap)
     : mClientVersion(clientVersion),
       mContext(contextIn),
       mState(stateIn),
@@ -29,7 +30,8 @@
       mTextureCaps(textureCapsIn),
       mExtensions(extensionsIn),
       mResourceManager(resourceManagerIn),
-      mLimitations(limitationsIn)
+      mLimitations(limitationsIn),
+      mFramebufferMap(framebufferMap)
 {
 }
 
@@ -49,6 +51,7 @@
                                      const Extensions &extensions,
                                      const ResourceManager *resourceManager,
                                      const Limitations &limitations,
+                                     const ResourceMap<Framebuffer> &framebufferMap,
                                      bool skipValidation)
     : mState(reinterpret_cast<uintptr_t>(this),
              clientVersion,
@@ -57,7 +60,8 @@
              textureCaps,
              extensions,
              resourceManager,
-             limitations),
+             limitations,
+             framebufferMap),
       mSkipValidation(skipValidation)
 {
 }
@@ -590,4 +594,25 @@
     return mState.mResourceManager->getShader(handle);
 }
 
+bool ValidationContext::isTextureGenerated(GLuint texture) const
+{
+    return mState.mResourceManager->isTextureGenerated(texture);
+}
+
+bool ValidationContext::isBufferGenerated(GLuint buffer) const
+{
+    return mState.mResourceManager->isBufferGenerated(buffer);
+}
+
+bool ValidationContext::isRenderbufferGenerated(GLuint renderbuffer) const
+{
+    return mState.mResourceManager->isRenderbufferGenerated(renderbuffer);
+}
+
+bool ValidationContext::isFramebufferGenerated(GLuint framebuffer) const
+{
+    ASSERT(mState.mFramebufferMap.find(0) != mState.mFramebufferMap.end());
+    return mState.mFramebufferMap.find(framebuffer) != mState.mFramebufferMap.end();
+}
+
 }  // namespace gl