Fixed instanced rendering

Instanced rendering only requires a
single attribute per instance, which
was handled properly everywhere except
in the streaming buffer, so that had to
be fixed. All related dEQP tests pass.

Change-Id: I9b9bd6cd790dfe7ecf7f5d2ed84623bfa4da4b6f
Reviewed-on: https://swiftshader-review.googlesource.com/3430
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/libGLESv2/VertexDataManager.cpp b/src/OpenGL/libGLESv2/VertexDataManager.cpp
index 8d69d65..6729c20 100644
--- a/src/OpenGL/libGLESv2/VertexDataManager.cpp
+++ b/src/OpenGL/libGLESv2/VertexDataManager.cpp
@@ -128,7 +128,8 @@
         {

             if(!attrib.mBoundBuffer)

             {

-                mStreamingBuffer->addRequiredSpace(attrib.typeSize() * count);

+                const bool isInstanced = attrib.mDivisor > 0;

+                mStreamingBuffer->addRequiredSpace(attrib.typeSize() * (isInstanced ? 1 : count));

             }

         }

     }

@@ -168,7 +169,7 @@
                 }

                 else

                 {

-                    unsigned int streamOffset = writeAttributeData(mStreamingBuffer, firstVertexIndex, count, attrib);

+                    unsigned int streamOffset = writeAttributeData(mStreamingBuffer, firstVertexIndex, isInstanced ? 1 : count, attrib);

 

 					if(streamOffset == -1)

 					{