FramebufferGL: Add a member to know if we are the default FBO

On CGL, the default framebuffer will have a name different than 0 and
without this change it wouldn't get special-cased as on the other
platforms. It is assumed that the default framebuffer will get
initialized directly by the driver or other parts of the code.

BUG=angleproject:891

Change-Id: Ifbe4ada58f27ad9ddb5b43697c234cb17e7504f0
Reviewed-on: https://chromium-review.googlesource.com/290147
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp
index 37ebe78..61f55eb 100644
--- a/src/libANGLE/renderer/gl/FramebufferGL.cpp
+++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp
@@ -26,9 +26,10 @@
     : FramebufferImpl(data),
       mFunctions(functions),
       mStateManager(stateManager),
-      mFramebufferID(0)
+      mFramebufferID(0),
+      mIsDefault(isDefault)
 {
-    if (!isDefault)
+    if (!mIsDefault)
     {
         mFunctions->genFramebuffers(1, &mFramebufferID);
     }
@@ -92,7 +93,7 @@
 
 void FramebufferGL::onUpdateColorAttachment(size_t index)
 {
-    if (mFramebufferID != 0)
+    if (!mIsDefault)
     {
         mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
         BindFramebufferAttachment(mFunctions,
@@ -103,7 +104,7 @@
 
 void FramebufferGL::onUpdateDepthAttachment()
 {
-    if (mFramebufferID != 0)
+    if (!mIsDefault)
     {
         mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
         BindFramebufferAttachment(mFunctions,
@@ -114,7 +115,7 @@
 
 void FramebufferGL::onUpdateStencilAttachment()
 {
-    if (mFramebufferID != 0)
+    if (!mIsDefault)
     {
         mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
         BindFramebufferAttachment(mFunctions,
@@ -125,7 +126,7 @@
 
 void FramebufferGL::onUpdateDepthStencilAttachment()
 {
-    if (mFramebufferID != 0)
+    if (!mIsDefault)
     {
         mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
         BindFramebufferAttachment(mFunctions,
@@ -136,7 +137,7 @@
 
 void FramebufferGL::setDrawBuffers(size_t count, const GLenum *buffers)
 {
-    if (mFramebufferID != 0)
+    if (!mIsDefault)
     {
         mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
         mFunctions->drawBuffers(count, buffers);
@@ -145,7 +146,7 @@
 
 void FramebufferGL::setReadBuffer(GLenum buffer)
 {
-    if (mFramebufferID != 0)
+    if (!mIsDefault)
     {
         mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
         mFunctions->readBuffer(buffer);