Remove unused streamOffset from IndexRangeCache
This value is now redundant - it is always the same as regular offset.
TEST=angle_end2end_tests
BUG=angleproject:956
Change-Id: If4b6c8bcbebf24fbf84723fe081fd058916cc504
Reviewed-on: https://chromium-review.googlesource.com/262423
Reviewed-by: Nicolas Capens <capn@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/libANGLE/renderer/IndexRangeCache.cpp b/src/libANGLE/renderer/IndexRangeCache.cpp
index 697c8d1..4a71cf4 100644
--- a/src/libANGLE/renderer/IndexRangeCache.cpp
+++ b/src/libANGLE/renderer/IndexRangeCache.cpp
@@ -46,10 +46,9 @@
}
}
-void IndexRangeCache::addRange(GLenum type, unsigned int offset, GLsizei count, const RangeUI &range,
- unsigned int streamOffset)
+void IndexRangeCache::addRange(GLenum type, unsigned int offset, GLsizei count, const RangeUI &range)
{
- mIndexRangeCache[IndexRange(type, offset, count)] = IndexBounds(range, streamOffset);
+ mIndexRangeCache[IndexRange(type, offset, count)] = range;
}
void IndexRangeCache::invalidateRange(unsigned int offset, unsigned int size)
@@ -60,8 +59,8 @@
IndexRangeMap::iterator i = mIndexRangeCache.begin();
while (i != mIndexRangeCache.end())
{
- unsigned int rangeStart = i->second.streamOffset;
- unsigned int rangeEnd = i->second.streamOffset + (gl::GetTypeInfo(i->first.type).bytes * i->first.count);
+ unsigned int rangeStart = i->first.offset;
+ unsigned int rangeEnd = i->first.offset + (gl::GetTypeInfo(i->first.type).bytes * i->first.count);
if (invalidateEnd < rangeStart || invalidateStart > rangeEnd)
{
@@ -75,19 +74,17 @@
}
bool IndexRangeCache::findRange(GLenum type, unsigned int offset, GLsizei count,
- RangeUI *outRange, unsigned int *outStreamOffset) const
+ RangeUI *outRange) const
{
IndexRangeMap::const_iterator i = mIndexRangeCache.find(IndexRange(type, offset, count));
if (i != mIndexRangeCache.end())
{
- if (outRange) *outRange = i->second.range;
- if (outStreamOffset) *outStreamOffset = i->second.streamOffset;
+ if (outRange) *outRange = i->second;
return true;
}
else
{
if (outRange) *outRange = RangeUI(0, 0);
- if (outStreamOffset) *outStreamOffset = 0;
return false;
}
}
@@ -114,15 +111,4 @@
return count < rhs.count;
}
-IndexRangeCache::IndexBounds::IndexBounds()
- : range(0, 0),
- streamOffset(0)
-{
-}
-
-IndexRangeCache::IndexBounds::IndexBounds(const RangeUI &rangeIn, unsigned int offset)
- : range(rangeIn), streamOffset(offset)
-{
-}
-
}
diff --git a/src/libANGLE/renderer/IndexRangeCache.h b/src/libANGLE/renderer/IndexRangeCache.h
index 9e27891..77249f5 100644
--- a/src/libANGLE/renderer/IndexRangeCache.h
+++ b/src/libANGLE/renderer/IndexRangeCache.h
@@ -23,10 +23,8 @@
class IndexRangeCache
{
public:
- void addRange(GLenum type, unsigned int offset, GLsizei count, const RangeUI &range,
- unsigned int streamOffset);
- bool findRange(GLenum type, unsigned int offset, GLsizei count, RangeUI *rangeOut,
- unsigned int *outStreamOffset) const;
+ void addRange(GLenum type, unsigned int offset, GLsizei count, const RangeUI &range);
+ bool findRange(GLenum type, unsigned int offset, GLsizei count, RangeUI *rangeOut) const;
void invalidateRange(unsigned int offset, unsigned int size);
void clear();
@@ -46,16 +44,7 @@
bool operator<(const IndexRange& rhs) const;
};
- struct IndexBounds
- {
- RangeUI range;
- unsigned int streamOffset;
-
- IndexBounds();
- IndexBounds(const RangeUI &range, unsigned int offset);
- };
-
- typedef std::map<IndexRange, IndexBounds> IndexRangeMap;
+ typedef std::map<IndexRange, RangeUI> IndexRangeMap;
IndexRangeMap mIndexRangeCache;
};
diff --git a/src/libANGLE/renderer/gl/VertexArrayGL.cpp b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
index 8de2201..996321d 100644
--- a/src/libANGLE/renderer/gl/VertexArrayGL.cpp
+++ b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
@@ -264,8 +264,7 @@
// Find the index range in the buffer
const IndexRangeCache *rangeCache = mElementArrayBuffer.get()->getIndexRangeCache();
- unsigned int streamOffset = 0;
- if (!rangeCache->findRange(type, elementArrayBufferOffset, count, outIndexRange, &streamOffset))
+ if (!rangeCache->findRange(type, elementArrayBufferOffset, count, outIndexRange))
{
// Need to compute the index range.
mStateManager->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementArrayBufferID);
@@ -274,7 +273,7 @@
*outIndexRange = IndexRangeCache::ComputeRange(type, elementArrayBufferPointer + elementArrayBufferOffset, count);
// TODO: Store the range cache at the impl level since the gl::Buffer object is supposed to remain constant
- const_cast<IndexRangeCache*>(rangeCache)->addRange(type, elementArrayBufferOffset, count, *outIndexRange, 0);
+ const_cast<IndexRangeCache*>(rangeCache)->addRange(type, elementArrayBufferOffset, count, *outIndexRange);
if (!mFunctions->unmapBuffer(GL_ELEMENT_ARRAY_BUFFER))
{
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index fa741b0..6469510 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -1599,7 +1599,7 @@
if (elementArrayBuffer)
{
uintptr_t offset = reinterpret_cast<uintptr_t>(indices);
- if (!elementArrayBuffer->getIndexRangeCache()->findRange(type, offset, count, indexRangeOut, NULL))
+ if (!elementArrayBuffer->getIndexRangeCache()->findRange(type, offset, count, indexRangeOut))
{
rx::BufferImpl *bufferImpl = elementArrayBuffer->getImplementation();
const uint8_t *dataPointer = NULL;
@@ -1612,7 +1612,7 @@
const uint8_t *offsetPointer = dataPointer + offset;
*indexRangeOut = rx::IndexRangeCache::ComputeRange(type, offsetPointer, count);
- elementArrayBuffer->getIndexRangeCache()->addRange(type, offset, count, *indexRangeOut, offset);
+ elementArrayBuffer->getIndexRangeCache()->addRange(type, offset, count, *indexRangeOut);
}
}
else