Use std::map to find correct index range

Instead of iterating through every range to find the one we're looking for, instead put them all in a map and find them with that. This helps performance with index buffers that contain a bunch of different ranges.

BUG=
TEST=

Review URL: http://codereview.appspot.com/4974051

git-svn-id: https://angleproject.googlecode.com/svn/trunk@742 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index 03559ee..011944a 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
 #define MAJOR_VERSION 0
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 740
+#define BUILD_REVISION 742
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libGLESv2/IndexDataManager.cpp b/src/libGLESv2/IndexDataManager.cpp
index 5b939b8..55297e8 100644
--- a/src/libGLESv2/IndexDataManager.cpp
+++ b/src/libGLESv2/IndexDataManager.cpp
@@ -381,24 +381,25 @@
 
 UINT StaticIndexBuffer::lookupRange(intptr_t offset, GLsizei count, UINT *minIndex, UINT *maxIndex)
 {
-    for (unsigned int range = 0; range < mCache.size(); range++)
-    {
-        if (mCache[range].offset == offset && mCache[range].count == count)
-        {
-            *minIndex = mCache[range].minIndex;
-            *maxIndex = mCache[range].maxIndex;
+    IndexRange range = {offset, count};
 
-            return mCache[range].streamOffset;
-        }
+    std::map<IndexRange, IndexResult>::iterator res = mCache.find(range);
+    
+    if (res == mCache.end())
+    {
+        return -1;
     }
 
-    return -1;
+    *minIndex = res->second.minIndex;
+    *maxIndex = res->second.maxIndex;
+    return res->second.streamOffset;
 }
 
 void StaticIndexBuffer::addRange(intptr_t offset, GLsizei count, UINT minIndex, UINT maxIndex, UINT streamOffset)
 {
-    IndexRange indexRange = {offset, count, minIndex, maxIndex, streamOffset};
-    mCache.push_back(indexRange);
+    IndexRange indexRange = {offset, count};
+    IndexResult indexResult = {minIndex, maxIndex, streamOffset};
+    mCache[indexRange] = indexResult;
 }
 
 }
diff --git a/src/libGLESv2/IndexDataManager.h b/src/libGLESv2/IndexDataManager.h
index 814f410..c076b90 100644
--- a/src/libGLESv2/IndexDataManager.h
+++ b/src/libGLESv2/IndexDataManager.h
@@ -87,12 +87,28 @@
         intptr_t offset;
         GLsizei count;
 
+        bool operator<(const IndexRange& rhs) const
+        {
+            if (offset != rhs.offset)
+            {
+                return offset < rhs.offset;
+            }
+            if (count != rhs.count)
+            {
+                return count < rhs.count;
+            }
+            return false;
+        }
+    };
+
+    struct IndexResult
+    {
         UINT minIndex;
         UINT maxIndex;
         UINT streamOffset;
     };
 
-    std::vector<IndexRange> mCache;
+    std::map<IndexRange, IndexResult> mCache;
 };
 
 class IndexDataManager