Don't sync the read framebuffer on draw calls.

The read framebuffer may not be complete and be incapable of syncing.

Removed the generate syncDirtyObjects method so each caller must make sure they
are only syncing objects that are known to be valid for the operation.

BUG=angleproject:2737

Change-Id: Ia8edf3fca3a8369aa813be46ba99f6b50a36b2e6
Reviewed-on: https://chromium-review.googlesource.com/1151621
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/tests/gl_tests/FramebufferTest.cpp b/src/tests/gl_tests/FramebufferTest.cpp
index 5eedecf..b0dc66a 100644
--- a/src/tests/gl_tests/FramebufferTest.cpp
+++ b/src/tests/gl_tests/FramebufferTest.cpp
@@ -322,6 +322,46 @@
     testZeroHeightRenderbuffer();
 }
 
+// Test to cover a bug where the read framebuffer affects the completeness of the draw framebuffer.
+TEST_P(FramebufferFormatsTest, ReadDrawCompleteness)
+{
+    ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3);
+
+    GLTexture incompleteTexture;
+    glBindTexture(GL_TEXTURE_2D, incompleteTexture);
+
+    GLFramebuffer incompleteFBO;
+    glBindFramebuffer(GL_FRAMEBUFFER, incompleteFBO);
+    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, incompleteTexture,
+                           0);
+    EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT,
+                     glCheckFramebufferStatus(GL_FRAMEBUFFER));
+
+    GLTexture completeTexture;
+    glBindTexture(GL_TEXTURE_2D, completeTexture);
+    glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, getWindowWidth(), getWindowHeight());
+
+    GLFramebuffer completeFBO;
+    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, completeFBO);
+    glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+                           completeTexture, 0);
+
+    EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT,
+                     glCheckFramebufferStatus(GL_READ_FRAMEBUFFER));
+    EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER));
+
+    ASSERT_GL_NO_ERROR();
+
+    // Simple draw program.
+    ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::Red());
+
+    drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f, 1.0f, true);
+    EXPECT_GL_NO_ERROR();
+
+    glBindFramebuffer(GL_READ_FRAMEBUFFER, completeFBO);
+    EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
+}
+
 // Use this to select which configurations (e.g. which renderer, which GLES major version) these
 // tests should be run against.
 ANGLE_INSTANTIATE_TEST(FramebufferFormatsTest,