Commit b23fc091 by Geoff Lang

Change the offset variable to an unsigned int since it cannot be negative and is…

Change the offset variable to an unsigned int since it cannot be negative and is assigned to streamOffset which is an unsigned int. TRAC #23671 Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods Author: Geoff Lang
parent 78568ba9
...@@ -115,13 +115,19 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer ...@@ -115,13 +115,19 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer
} }
GLenum destinationIndexType = (type == GL_UNSIGNED_INT) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT; GLenum destinationIndexType = (type == GL_UNSIGNED_INT) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT;
intptr_t offset = reinterpret_cast<intptr_t>(indices); unsigned int offset = 0;
bool alignedOffset = false; bool alignedOffset = false;
BufferStorage *storage = NULL; BufferStorage *storage = NULL;
if (buffer != NULL) if (buffer != NULL)
{ {
if (reinterpret_cast<uintptr_t>(indices) > std::numeric_limits<unsigned int>::max())
{
return GL_OUT_OF_MEMORY;
}
offset = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(indices));
storage = buffer->getStorage(); storage = buffer->getStorage();
switch (type) switch (type)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
namespace rx namespace rx
{ {
void IndexRangeCache::addRange(GLenum type, intptr_t offset, GLsizei count, unsigned int minIdx, unsigned int maxIdx, void IndexRangeCache::addRange(GLenum type, unsigned int offset, GLsizei count, unsigned int minIdx, unsigned int maxIdx,
unsigned int streamOffset) unsigned int streamOffset)
{ {
mIndexRangeCache[IndexRange(type, offset, count)] = IndexBounds(minIdx, maxIdx, streamOffset); mIndexRangeCache[IndexRange(type, offset, count)] = IndexBounds(minIdx, maxIdx, streamOffset);
...@@ -44,7 +44,7 @@ void IndexRangeCache::invalidateRange(unsigned int offset, unsigned int size) ...@@ -44,7 +44,7 @@ void IndexRangeCache::invalidateRange(unsigned int offset, unsigned int size)
} }
} }
bool IndexRangeCache::findRange(GLenum type, intptr_t offset, GLsizei count, unsigned int *outMinIndex, bool IndexRangeCache::findRange(GLenum type, unsigned int offset, GLsizei count, unsigned int *outMinIndex,
unsigned int *outMaxIndex, unsigned int *outStreamOffset) const unsigned int *outMaxIndex, unsigned int *outStreamOffset) const
{ {
IndexRangeMap::const_iterator i = mIndexRangeCache.find(IndexRange(type, offset, count)); IndexRangeMap::const_iterator i = mIndexRangeCache.find(IndexRange(type, offset, count));
......
...@@ -18,9 +18,9 @@ namespace rx ...@@ -18,9 +18,9 @@ namespace rx
class IndexRangeCache class IndexRangeCache
{ {
public: public:
void addRange(GLenum type, intptr_t offset, GLsizei count, unsigned int minIdx, unsigned int maxIdx, void addRange(GLenum type, unsigned int offset, GLsizei count, unsigned int minIdx, unsigned int maxIdx,
unsigned int streamOffset); unsigned int streamOffset);
bool findRange(GLenum type, intptr_t offset, GLsizei count, unsigned int *outMinIndex, bool findRange(GLenum type, unsigned int offset, GLsizei count, unsigned int *outMinIndex,
unsigned int *outMaxIndex, unsigned int *outStreamOffset) const; unsigned int *outMaxIndex, unsigned int *outStreamOffset) const;
void invalidateRange(unsigned int offset, unsigned int size); void invalidateRange(unsigned int offset, unsigned int size);
...@@ -30,7 +30,7 @@ class IndexRangeCache ...@@ -30,7 +30,7 @@ class IndexRangeCache
struct IndexRange struct IndexRange
{ {
GLenum type; GLenum type;
intptr_t offset; unsigned int offset;
GLsizei count; GLsizei count;
IndexRange(); IndexRange();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment