New transform feedback buffer binding rules

Detects undefined behavior when a buffer is bound to a transform feedback
binding point and a non transform feedback binding point at the same time.

Also moves the transform feedback buffer generic binding point out of the
transform feedback object and into the context's global state, to match
driver behavior. This way binding a new transform feedback object does not
affect GL_TRANSFORM_FEEDBACK_BUFFER_BINDING which is similar to how VAOs
work with GL_ARRAY_BUFFER_BINDING.

Bug: 696345
Change-Id: If3b9306cde7cd2197a8ce35e10c3af9ee58da0b8
Reviewed-on: https://chromium-review.googlesource.com/853130
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 7b261d1..46d3049 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -2923,6 +2923,13 @@
         }
     }
 
+    if (context->getExtensions().webglCompatibility &&
+        buffer->isBoundForTransformFeedbackAndOtherUse())
+    {
+        ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferBoundForTransformFeedback);
+        return false;
+    }
+
     return true;
 }
 
@@ -4232,6 +4239,13 @@
         return false;
     }
 
+    if (context->getExtensions().webglCompatibility &&
+        buffer->isBoundForTransformFeedbackAndOtherUse())
+    {
+        ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferBoundForTransformFeedback);
+        return false;
+    }
+
     return true;
 }
 
@@ -4273,6 +4287,13 @@
         return false;
     }
 
+    if (context->getExtensions().webglCompatibility &&
+        buffer->isBoundForTransformFeedbackAndOtherUse())
+    {
+        ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferBoundForTransformFeedback);
+        return false;
+    }
+
     // Check for possible overflow of size + offset
     angle::CheckedNumeric<size_t> checkedSize(size);
     checkedSize += offset;