summaryrefslogtreecommitdiff
path: root/indra/llrender/llrender.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r--indra/llrender/llrender.cpp61
1 files changed, 13 insertions, 48 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 3e7c69611d..76f28bb43f 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1829,48 +1829,6 @@ void LLRender::flush()
{
if (mCount > 0)
{
-#if 0
- if (!glIsEnabled(GL_VERTEX_ARRAY))
- {
- LL_ERRS() << "foo 1" << LL_ENDL;
- }
-
- if (!glIsEnabled(GL_COLOR_ARRAY))
- {
- LL_ERRS() << "foo 2" << LL_ENDL;
- }
-
- if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY))
- {
- LL_ERRS() << "foo 3" << LL_ENDL;
- }
-
- if (glIsEnabled(GL_NORMAL_ARRAY))
- {
- LL_ERRS() << "foo 7" << LL_ENDL;
- }
-
- GLvoid* pointer;
-
- glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer);
- if (pointer != &(mBuffer[0].v))
- {
- LL_ERRS() << "foo 4" << LL_ENDL;
- }
-
- glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer);
- if (pointer != &(mBuffer[0].c))
- {
- LL_ERRS() << "foo 5" << LL_ENDL;
- }
-
- glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer);
- if (pointer != &(mBuffer[0].uv))
- {
- LL_ERRS() << "foo 6" << LL_ENDL;
- }
-#endif
-
if (!mUIOffset.empty())
{
sUICalls++;
@@ -2046,7 +2004,8 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count)
}
}
- mVerticesp[mCount] = mVerticesp[mCount-1];
+ if( mCount > 0 ) // ND: Guard against crashes if mCount is zero, yes it can happen
+ mVerticesp[mCount] = mVerticesp[mCount-1];
}
void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count)
@@ -2103,8 +2062,11 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 v
}
}
- mVerticesp[mCount] = mVerticesp[mCount-1];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+ if (mCount > 0)
+ {
+ mVerticesp[mCount] = mVerticesp[mCount - 1];
+ mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
+ }
}
void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count)
@@ -2162,9 +2124,12 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLCol
}
}
- mVerticesp[mCount] = mVerticesp[mCount-1];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
- mColorsp[mCount] = mColorsp[mCount-1];
+ if (mCount > 0)
+ {
+ mVerticesp[mCount] = mVerticesp[mCount - 1];
+ mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
+ mColorsp[mCount] = mColorsp[mCount - 1];
+ }
}
void LLRender::vertex2i(const GLint& x, const GLint& y)