Proliferate gl::Context everywhere.

This gives the D3D back-end access to the GL state almost anywhere.
This uses the onDestroy hook for Textures to push errors up from
destructors, although they still don't quite make it to the Context.

There are places, such as in EGL object (Context/Surface) destruction,
where we end up calling through to GL implementation internals without
having access to a gl::Context. We handle this via a proxy Context
to a Display, basically a null context, that has access to impl-side
state like the Renderer pointer if necessary. It does not have access
to the normal GL state.

Also Pass gl::Context to RefCountObject::release(). Since we're using
destroy() methods now, we should not ever call the destructor directly.

BUG=angleproject:1156

Change-Id: Ie4c32ad6bf6caaff0289901f30b5c6bafa2ce259
Reviewed-on: https://chromium-review.googlesource.com/529707
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/FramebufferImpl.h b/src/libANGLE/renderer/FramebufferImpl.h
index c4871bd..0166489 100644
--- a/src/libANGLE/renderer/FramebufferImpl.h
+++ b/src/libANGLE/renderer/FramebufferImpl.h
@@ -34,9 +34,14 @@
     virtual void destroy(const gl::Context *context) {}
     virtual void destroyDefault(const egl::Display *display) {}
 
-    virtual gl::Error discard(size_t count, const GLenum *attachments)    = 0;
-    virtual gl::Error invalidate(size_t count, const GLenum *attachments) = 0;
-    virtual gl::Error invalidateSub(size_t count,
+    virtual gl::Error discard(const gl::Context *context,
+                              size_t count,
+                              const GLenum *attachments) = 0;
+    virtual gl::Error invalidate(const gl::Context *context,
+                                 size_t count,
+                                 const GLenum *attachments) = 0;
+    virtual gl::Error invalidateSub(const gl::Context *context,
+                                    size_t count,
                                     const GLenum *attachments,
                                     const gl::Rectangle &area) = 0;
 
@@ -59,8 +64,8 @@
                                     GLfloat depth,
                                     GLint stencil) = 0;
 
-    virtual GLenum getImplementationColorReadFormat() const = 0;
-    virtual GLenum getImplementationColorReadType() const   = 0;
+    virtual GLenum getImplementationColorReadFormat(const gl::Context *context) const = 0;
+    virtual GLenum getImplementationColorReadType(const gl::Context *context) const   = 0;
     virtual gl::Error readPixels(const gl::Context *context,
                                  const gl::Rectangle &area,
                                  GLenum format,