Use GL-like methods for InvalidateFramebuffer calls.

This will faciliate the MANGLE implementation.

BUG=angle:732

Change-Id: I0e4d569667e03305c9cca8d7c23154c70fb71eeb
Reviewed-on: https://chromium-review.googlesource.com/213854
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index ba129bf..62f98d8 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -7990,8 +7990,11 @@
             return;
         }
 
-        GLuint maxDimension = context->getCaps().maxRenderbufferSize;
-        context->invalidateFrameBuffer(target, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
+        gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+        if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
+        {
+            framebuffer->invalidate(context->getCaps(), numAttachments, attachments);
+        }
     }
 }
 
@@ -8015,7 +8018,11 @@
             return;
         }
 
-        context->invalidateFrameBuffer(target, numAttachments, attachments, x, y, width, height);
+        gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+        if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
+        {
+            framebuffer->invalidateSub(context->getCaps(), numAttachments, attachments, x, y, width, height);
+        }
     }
 }