Generate error on program-framebuffer num views mismatch

According to the ANGLE_multiview spec Draw* commands should generate
an INVALID_OPERATION error if the program uses the multiview extension
and the number of views in the active draw framebuffer and active
program differs. The patch addresses this by extending the base draw
call validation.

BUG=angleproject:2062
TEST=angle_end2end_tests

Change-Id: I369070beb5ccb17211dbe61ebec40bfcbcf5bc4e
Reviewed-on: https://chromium-review.googlesource.com/586605
Commit-Queue: Martin Radev <mradev@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 2ed8d3a..f4712a8 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -2819,6 +2819,17 @@
         return false;
     }
 
+    if (context->getExtensions().multiview)
+    {
+        const int programNumViews = program->getNumViews();
+        if (programNumViews != -1 && framebuffer->getNumViews() != programNumViews)
+        {
+            context->handleError(InvalidOperation() << "The number of views in the active program "
+                                                       "and draw framebuffer does not match.");
+            return false;
+        }
+    }
+
     // Uniform buffer validation
     for (unsigned int uniformBlockIndex = 0;
          uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++)