Implement EXT_discard_framebuffer for the GL backend.

BUG=angleproject:1634

Change-Id: I3822b99b59d4653e4d9a2c1d3dd16734f2050fae
Reviewed-on: https://chromium-review.googlesource.com/414437
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp
index 7e300b6..9fde07c 100644
--- a/src/libANGLE/renderer/gl/FramebufferGL.cpp
+++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp
@@ -127,20 +127,25 @@
 
 Error FramebufferGL::discard(size_t count, const GLenum *attachments)
 {
-    UNIMPLEMENTED();
-    return Error(GL_INVALID_OPERATION);
+    // glInvalidateFramebuffer accepts the same enums as glDiscardFramebufferEXT
+    return invalidate(count, attachments);
 }
 
 Error FramebufferGL::invalidate(size_t count, const GLenum *attachments)
 {
-    // Since this function is just a hint and not available until OpenGL 4.3, only call it if it is available.
+    // Since this function is just a hint, only call a native function if it exists.
     if (mFunctions->invalidateFramebuffer)
     {
         mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
         mFunctions->invalidateFramebuffer(GL_FRAMEBUFFER, static_cast<GLsizei>(count), attachments);
     }
+    else if (mFunctions->discardFramebuffer)
+    {
+        mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        mFunctions->discardFramebuffer(GL_FRAMEBUFFER, static_cast<GLsizei>(count), attachments);
+    }
 
-    return Error(GL_NO_ERROR);
+    return gl::NoError();
 }
 
 Error FramebufferGL::invalidateSub(size_t count,