Add suppressions for several Intel failures.

Also add a new test for UBOs to end2end_tests.

BUG=540538

Change-Id: I6ffa6ba061a2c33811c65719deaa4302f1dbd704
Reviewed-on: https://chromium-review.googlesource.com/304521
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tryjob-Request: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/BlendMinMaxTest.cpp b/src/tests/gl_tests/BlendMinMaxTest.cpp
index d09b311..0b8bc81 100644
--- a/src/tests/gl_tests/BlendMinMaxTest.cpp
+++ b/src/tests/gl_tests/BlendMinMaxTest.cpp
@@ -172,6 +172,13 @@
         return;
     }
 
+    // TODO(jmadill): Figure out why this is broken on Intel
+    if (isIntel() && (GetParam() == ES2_D3D11() || GetParam() == ES2_D3D9()))
+    {
+        std::cout << "Test skipped on Intel OpenGL." << std::endl;
+        return;
+    }
+
     runTest(GL_RGBA32F);
 }
 
@@ -184,7 +191,7 @@
     }
 
     // TODO(jmadill): figure out why this fails
-    if (isIntel() && GetParam() == ES2_D3D11())
+    if (isIntel() && (GetParam() == ES2_D3D11() || GetParam() == ES2_D3D9()))
     {
         std::cout << "Test skipped on Intel due to failures." << std::endl;
         return;
diff --git a/src/tests/gl_tests/ClearTest.cpp b/src/tests/gl_tests/ClearTest.cpp
index 1af48d8..5062bdc 100644
--- a/src/tests/gl_tests/ClearTest.cpp
+++ b/src/tests/gl_tests/ClearTest.cpp
@@ -238,6 +238,13 @@
 // Test that SRGB framebuffers clear to the linearized clear color
 TEST_P(ClearTestES3, SRGBClear)
 {
+    // TODO(jmadill): figure out why this fails
+    if (isIntel() && GetParam() == ES3_OPENGL())
+    {
+        std::cout << "Test skipped on Intel due to failures." << std::endl;
+        return;
+    }
+
     // First make a simple framebuffer, and clear it
     glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
 
@@ -267,6 +274,13 @@
     }
 #endif
 
+    // TODO(jmadill): figure out why this fails
+    if (isIntel() && GetParam() == ES3_OPENGL())
+    {
+        std::cout << "Test skipped on Intel due to failures." << std::endl;
+        return;
+    }
+
     glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
 
     GLuint textures[2];
diff --git a/src/tests/gl_tests/PointSpritesTest.cpp b/src/tests/gl_tests/PointSpritesTest.cpp
index 3bc565f..2ad2e01 100644
--- a/src/tests/gl_tests/PointSpritesTest.cpp
+++ b/src/tests/gl_tests/PointSpritesTest.cpp
@@ -42,6 +42,13 @@
 // https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/variables/gl-pointcoord.html
 TEST_P(PointSpritesTest, PointCoordAndPointSizeCompliance)
 {
+    // TODO(jmadill): figure out why this fails
+    if (isIntel() && GetParam() == ES2_D3D9())
+    {
+        std::cout << "Test skipped on Intel due to failures." << std::endl;
+        return;
+    }
+
     const std::string fs = SHADER_SOURCE
     (
         precision mediump float;
diff --git a/src/tests/gl_tests/SwizzleTest.cpp b/src/tests/gl_tests/SwizzleTest.cpp
index d816488..6eb2d1c 100644
--- a/src/tests/gl_tests/SwizzleTest.cpp
+++ b/src/tests/gl_tests/SwizzleTest.cpp
@@ -93,6 +93,7 @@
         mTextureUniformLocation = glGetUniformLocation(mProgram, "tex");
 
         glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+        ASSERT_GL_NO_ERROR();
     }
 
     void TearDown() override
@@ -140,6 +141,13 @@
 
     void runTest2D()
     {
+        // TODO(jmadill): Figure out why this fails on Intel.
+        if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
+        {
+            std::cout << "Test skipped on Intel." << std::endl;
+            return;
+        }
+
         glUseProgram(mProgram);
         glBindTexture(GL_TEXTURE_2D, mTexture);
         glUniform1i(mTextureUniformLocation, 0);
@@ -155,6 +163,8 @@
         GLubyte unswizzled[4];
         glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &unswizzled);
 
+        ASSERT_GL_NO_ERROR();
+
         for (size_t i = 0; i < mPermutations.size(); i++)
         {
             const swizzlePermutation& permutation = mPermutations[i];
@@ -172,6 +182,8 @@
                             getExpectedValue(permutation.swizzleGreen, unswizzled),
                             getExpectedValue(permutation.swizzleBlue, unswizzled),
                             getExpectedValue(permutation.swizzleAlpha, unswizzled));
+
+            ASSERT_GL_NO_ERROR();
         }
     }
 
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index b07a7de..a693e8c 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -916,6 +916,13 @@
 // Test rendering with the maximum vertex texture units.
 TEST_P(TextureLimitsTest, MaxVertexTextures)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     compileProgramWithTextureCounts("tex", mMaxVertexTextures, mMaxVertexTextures, "tex", 0, 0);
     ASSERT_NE(0u, mProgram);
     ASSERT_GL_NO_ERROR();
@@ -926,6 +933,13 @@
 // Test rendering with the maximum fragment texture units.
 TEST_P(TextureLimitsTest, MaxFragmentTextures)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     compileProgramWithTextureCounts("tex", 0, 0, "tex", mMaxFragmentTextures, mMaxFragmentTextures);
     ASSERT_NE(0u, mProgram);
     ASSERT_GL_NO_ERROR();
@@ -977,6 +991,13 @@
 // Test active vertex textures under the limit, but excessive textures specified.
 TEST_P(TextureLimitsTest, MaxActiveVertexTextures)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     compileProgramWithTextureCounts("tex", mMaxVertexTextures + 4, mMaxVertexTextures, "tex", 0, 0);
     ASSERT_NE(0u, mProgram);
     ASSERT_GL_NO_ERROR();
@@ -987,6 +1008,13 @@
 // Test active fragment textures under the limit, but excessive textures specified.
 TEST_P(TextureLimitsTest, MaxActiveFragmentTextures)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     compileProgramWithTextureCounts("tex", 0, 0, "tex", mMaxFragmentTextures + 4,
                                     mMaxFragmentTextures);
     ASSERT_NE(0u, mProgram);
diff --git a/src/tests/gl_tests/TransformFeedbackTest.cpp b/src/tests/gl_tests/TransformFeedbackTest.cpp
index 23b5bf5..8450109 100644
--- a/src/tests/gl_tests/TransformFeedbackTest.cpp
+++ b/src/tests/gl_tests/TransformFeedbackTest.cpp
@@ -126,6 +126,13 @@
 // Test that XFB can write back vertices to a buffer and that we can draw from this buffer afterward.
 TEST_P(TransformFeedbackTest, RecordAndDraw)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     // Set the program's transform feedback varyings (just gl_Position)
     const GLchar* transformFeedbackVaryings[] =
     {
diff --git a/src/tests/gl_tests/UniformBufferTest.cpp b/src/tests/gl_tests/UniformBufferTest.cpp
index b71b58a..f8078e5 100644
--- a/src/tests/gl_tests/UniformBufferTest.cpp
+++ b/src/tests/gl_tests/UniformBufferTest.cpp
@@ -74,11 +74,43 @@
     GLuint mUniformBuffer;
 };
 
+// Basic UBO functionality.
+TEST_P(UniformBufferTest, Simple)
+{
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
+    glClear(GL_COLOR_BUFFER_BIT);
+    float floatData[4] = {0.5f, 0.75f, 0.25f, 1.0f};
+
+    glBindBuffer(GL_UNIFORM_BUFFER, mUniformBuffer);
+    glBufferData(GL_UNIFORM_BUFFER, sizeof(float) * 4, floatData, GL_STATIC_DRAW);
+
+    glBindBufferBase(GL_UNIFORM_BUFFER, 0, mUniformBuffer);
+
+    glUniformBlockBinding(mProgram, mUniformBufferIndex, 0);
+    drawQuad(mProgram, "position", 0.5f);
+
+    ASSERT_GL_NO_ERROR();
+    EXPECT_PIXEL_NEAR(0, 0, 128, 191, 64, 255, 1);
+}
+
 // Test that using a UBO with a non-zero offset and size actually works.
 // The first step of this test renders a color from a UBO with a zero offset.
 // The second step renders a color from a UBO with a non-zero offset.
 TEST_P(UniformBufferTest, UniformBufferRange)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     int px = getWindowWidth() / 2;
     int py = getWindowHeight() / 2;
 
@@ -150,6 +182,13 @@
 // Test uniform block bindings.
 TEST_P(UniformBufferTest, UniformBufferBindings)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     int px = getWindowWidth() / 2;
     int py = getWindowHeight() / 2;
 
@@ -206,6 +245,13 @@
 // https://code.google.com/p/angleproject/issues/detail?id=965
 TEST_P(UniformBufferTest, UniformBufferManyUpdates)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     int px = getWindowWidth() / 2;
     int py = getWindowHeight() / 2;
 
@@ -239,6 +285,13 @@
 // Use a large number of buffer ranges (compared to the actual size of the UBO)
 TEST_P(UniformBufferTest, ManyUniformBufferRange)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     int px = getWindowWidth() / 2;
     int py = getWindowHeight() / 2;
 
diff --git a/src/tests/gl_tests/VertexAttributeTest.cpp b/src/tests/gl_tests/VertexAttributeTest.cpp
index 9a0ebb7..2449e33 100644
--- a/src/tests/gl_tests/VertexAttributeTest.cpp
+++ b/src/tests/gl_tests/VertexAttributeTest.cpp
@@ -288,10 +288,10 @@
 // Validate that we can support GL_MAX_ATTRIBS attribs
 TEST_P(VertexAttributeTest, MaxAttribs)
 {
-    // TODO(jmadill): Figure out why we get this error on AMD/OpenGL
-    if (isAMD() && (GetParam() == ES2_OPENGL() || GetParam() == ES3_OPENGL()))
+    // TODO(jmadill): Figure out why we get this error on AMD/OpenGL and Intel.
+    if ((isIntel() || isAMD()) && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
     {
-        std::cout << "Test disabled on AMD/OpenGL" << std::endl;
+        std::cout << "Test skipped on Intel and AMD." << std::endl;
         return;
     }
 
@@ -336,6 +336,13 @@
 // Simple test for when we use glBindAttribLocation
 TEST_P(VertexAttributeTest, SimpleBindAttribLocation)
 {
+    // TODO(jmadill): Figure out why this fails on Intel.
+    if (isIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
+    {
+        std::cout << "Test skipped on Intel." << std::endl;
+        return;
+    }
+
     // Re-use the multi-attrib program, binding attribute 0
     GLuint program = compileMultiAttribProgram(1);
     glBindAttribLocation(program, 2, "position");