Store current transform feedback buffer bindings in the object itself.

BUG=angleproject:763

Change-Id: I76565f68fa8145da29713de2a517a39a8d50a24b
Reviewed-on: https://chromium-review.googlesource.com/263061
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp
index eaa132a..c153cdc 100644
--- a/src/libANGLE/State.cpp
+++ b/src/libANGLE/State.cpp
@@ -120,7 +120,6 @@
     }
 
     mUniformBuffers.resize(caps.maxCombinedUniformBlocks);
-    mTransformFeedbackBuffers.resize(caps.maxTransformFeedbackSeparateAttributes);
 
     mSamplerTextures[GL_TEXTURE_2D].resize(caps.maxCombinedTextureImageUnits);
     mSamplerTextures[GL_TEXTURE_CUBE_MAP].resize(caps.maxCombinedTextureImageUnits);
@@ -177,17 +176,11 @@
     }
 
     mGenericUniformBuffer.set(NULL);
-    mGenericTransformFeedbackBuffer.set(NULL);
     for (BufferVector::iterator bufItr = mUniformBuffers.begin(); bufItr != mUniformBuffers.end(); ++bufItr)
     {
         bufItr->set(NULL);
     }
 
-    for (BufferVector::iterator bufItr = mTransformFeedbackBuffers.begin(); bufItr != mTransformFeedbackBuffers.end(); ++bufItr)
-    {
-        bufItr->set(NULL);
-    }
-
     mCopyReadBuffer.set(NULL);
     mCopyWriteBuffer.set(NULL);
 
@@ -956,42 +949,6 @@
     return mUniformBuffers[index].getSize();
 }
 
-void State::setGenericTransformFeedbackBufferBinding(Buffer *buffer)
-{
-    mGenericTransformFeedbackBuffer.set(buffer);
-}
-
-void State::setIndexedTransformFeedbackBufferBinding(GLuint index, Buffer *buffer, GLintptr offset, GLsizeiptr size)
-{
-    mTransformFeedbackBuffers[index].set(buffer, offset, size);
-}
-
-GLuint State::getIndexedTransformFeedbackBufferId(GLuint index) const
-{
-    ASSERT(static_cast<size_t>(index) < mTransformFeedbackBuffers.size());
-
-    return mTransformFeedbackBuffers[index].id();
-}
-
-Buffer *State::getIndexedTransformFeedbackBuffer(GLuint index) const
-{
-    ASSERT(static_cast<size_t>(index) < mTransformFeedbackBuffers.size());
-
-    return mTransformFeedbackBuffers[index].get();
-}
-
-GLuint State::getIndexedTransformFeedbackBufferOffset(GLuint index) const
-{
-    ASSERT(static_cast<size_t>(index) < mTransformFeedbackBuffers.size());
-
-    return static_cast<unsigned int>(mTransformFeedbackBuffers[index].getOffset());
-}
-
-size_t State::getTransformFeedbackBufferIndexRange() const
-{
-    return mTransformFeedbackBuffers.size();
-}
-
 void State::setCopyReadBufferBinding(Buffer *buffer)
 {
     mCopyReadBuffer.set(buffer);
@@ -1022,7 +979,7 @@
       case GL_ELEMENT_ARRAY_BUFFER:      return getVertexArray()->getElementArrayBuffer();
       case GL_PIXEL_PACK_BUFFER:         return mPack.pixelBuffer.get();
       case GL_PIXEL_UNPACK_BUFFER:       return mUnpack.pixelBuffer.get();
-      case GL_TRANSFORM_FEEDBACK_BUFFER: return mGenericTransformFeedbackBuffer.get();
+      case GL_TRANSFORM_FEEDBACK_BUFFER: return mTransformFeedback->getGenericBuffer().get();
       case GL_UNIFORM_BUFFER:            return mGenericUniformBuffer.get();
       default: UNREACHABLE();            return NULL;
     }
@@ -1366,7 +1323,7 @@
         *params = mGenericUniformBuffer.id();
         break;
       case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
-        *params = mGenericTransformFeedbackBuffer.id();
+        *params = mTransformFeedback->getGenericBuffer().id();
         break;
       case GL_COPY_READ_BUFFER_BINDING:
         *params = mCopyReadBuffer.id();
@@ -1391,9 +1348,9 @@
     switch (target)
     {
       case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
-        if (static_cast<size_t>(index) < mTransformFeedbackBuffers.size())
+        if (static_cast<size_t>(index) < mTransformFeedback->getIndexedBufferCount())
         {
-            *data = mTransformFeedbackBuffers[index].id();
+            *data = mTransformFeedback->getIndexedBuffer(index).id();
         }
         break;
       case GL_UNIFORM_BUFFER_BINDING:
@@ -1414,15 +1371,15 @@
     switch (target)
     {
       case GL_TRANSFORM_FEEDBACK_BUFFER_START:
-        if (static_cast<size_t>(index) < mTransformFeedbackBuffers.size())
+        if (static_cast<size_t>(index) < mTransformFeedback->getIndexedBufferCount())
         {
-            *data = mTransformFeedbackBuffers[index].getOffset();
+            *data = mTransformFeedback->getIndexedBuffer(index).getOffset();
         }
         break;
       case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
-        if (static_cast<size_t>(index) < mTransformFeedbackBuffers.size())
+        if (static_cast<size_t>(index) < mTransformFeedback->getIndexedBufferCount())
         {
-            *data = mTransformFeedbackBuffers[index].getSize();
+            *data = mTransformFeedback->getIndexedBuffer(index).getSize();
         }
         break;
       case GL_UNIFORM_BUFFER_START: