Validate program changes wrt transform feedback

UseProgram can't be called while transform feedback is active and
unpaused. Validate this by checking the presence of active transform
feedback in UseProgram.

LinkProgram or ProgramBinary can't be called while transform feedback
associated with the program is active. Validate this by going through
all of the existing transform feedback objects when one of these
functions is called and checking whether they are associated with the
program being changed. A program association is added to
gl::TransformFeedback to facilitate this.

BeginTransformFeedback can't be used to unpause a transform feedback
object, so code for that is removed.

The validation of the entry points touched in this patch is refactored
to follow the current convention of separate Validate* functions,
though with LinkProgram following this convention fully isn't
practical.

This patch also makes sure that ANGLE doesn't invoke behavior that the
GL spec doesn't specify if a program object associated with a paused
transform feedback is deleted.

Tests are edited so that they don't call UseProgram when it generates
an error.

BUG=angleproject:1101
TEST=dEQP-GLES3.functional.negative_api.shader.* (2 more tests pass),
     dEQP-GLES3.functional.transform_feedback.* (no regressions),
     angle_end2end_tests

Change-Id: I2e5b3a027ced11249b762ec01a29fa41d2c0dd96
Reviewed-on: https://chromium-review.googlesource.com/332141
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index dba4aa9..6dad59f 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -2000,6 +2000,27 @@
     return mExtensionStrings.size();
 }
 
+void Context::beginTransformFeedback(GLenum primitiveMode)
+{
+    TransformFeedback *transformFeedback = getState().getCurrentTransformFeedback();
+    ASSERT(transformFeedback != nullptr);
+    ASSERT(!transformFeedback->isPaused());
+
+    transformFeedback->begin(primitiveMode, getState().getProgram());
+}
+
+bool Context::hasActiveTransformFeedback(GLuint program) const
+{
+    for (auto pair : mTransformFeedbackMap)
+    {
+        if (pair.second != nullptr && pair.second->hasBoundProgram(program))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
 void Context::initCaps(GLuint clientVersion)
 {
     mCaps = mRenderer->getRendererCaps();