summaryrefslogtreecommitdiff
path: root/indra/llrender/llvertexbuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llvertexbuffer.cpp')
-rw-r--r--indra/llrender/llvertexbuffer.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 1312f6afda..e3035c7194 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -660,6 +660,9 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto
void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const
{
+ llassert(start < (U32)mNumVerts);
+ llassert(end < (U32)mNumVerts);
+
if (start >= (U32) mNumVerts ||
end >= (U32) mNumVerts)
{
@@ -679,6 +682,9 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
U16* idx = ((U16*) getIndicesPointer())+indices_offset;
for (U32 i = 0; i < count; ++i)
{
+ llassert(idx[i] >= start);
+ llassert(idx[i] <= end);
+
if (idx[i] < start || idx[i] > end)
{
LL_ERRS() << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << LL_ENDL;
@@ -697,6 +703,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
for (U32 i = start; i < end; i++)
{
S32 idx = (S32) (v[i][3]+0.25f);
+ llassert(idx >= 0);
if (idx < 0 || idx >= shader->mFeatures.mIndexedTextureChannels)
{
LL_ERRS() << "Bad texture index found in vertex data stream." << LL_ENDL;
@@ -942,15 +949,15 @@ S32 LLVertexBuffer::determineUsage(S32 usage)
{ //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default
if (ret_usage != GL_DYNAMIC_COPY_ARB)
{
- if (sDisableVBOMapping)
- { //always use stream draw if VBO mapping is disabled
- ret_usage = GL_STREAM_DRAW_ARB;
- }
- else
- {
- ret_usage = GL_DYNAMIC_DRAW_ARB;
- }
- }
+ if (sDisableVBOMapping)
+ { //always use stream draw if VBO mapping is disabled
+ ret_usage = GL_STREAM_DRAW_ARB;
+ }
+ else
+ {
+ ret_usage = GL_DYNAMIC_DRAW_ARB;
+ }
+ }
}
return ret_usage;
@@ -1506,10 +1513,10 @@ bool LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
llassert(newnverts >= 0);
llassert(newnindices >= 0);
- bool sucsess = true;
+ bool success = true;
- sucsess &= updateNumVerts(newnverts);
- sucsess &= updateNumIndices(newnindices);
+ success &= updateNumVerts(newnverts);
+ success &= updateNumIndices(newnindices);
if (useVBOs())
{
@@ -1521,7 +1528,7 @@ bool LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
}
}
- return sucsess;
+ return success;
}
bool LLVertexBuffer::useVBOs() const