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/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