summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2017-04-21 16:43:56 -0400
committerNat Goodspeed <nat@lindenlab.com>2017-04-21 16:43:56 -0400
commit5f6bcaf456469f07d23a5599a1fed59420fd6ae7 (patch)
treeaff6d5b13b69121919433f80103e0594b3525c9d /indra/llrender
parentf62b5503285d828813d87779fa0658ee5f122ac5 (diff)
parent7a6a2db289581e43c509ca7dfff7d9b72897a10e (diff)
Automated merge with ssh://bitbucket.org/lindenlab/viewer-release
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llgl.cpp1
-rw-r--r--indra/llrender/llrender.cpp61
-rw-r--r--indra/llrender/llvertexbuffer.cpp13
3 files changed, 24 insertions, 51 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 7757198af5..18063e9700 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -55,7 +55,6 @@
BOOL gDebugSession = FALSE;
-BOOL gDebugGL = FALSE;
BOOL gClothRipple = FALSE;
BOOL gHeadlessClient = FALSE;
BOOL gGLActive = FALSE;
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)
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 31dffdd545..3851669360 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1436,13 +1436,22 @@ void LLVertexBuffer::setupVertexArray()
//glVertexattribIPointer requires GLSL 1.30 or later
if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
{
- glVertexAttribIPointer(i, attrib_size[i], attrib_type[i], sTypeSize[i], (void*) mOffsets[i]);
+ glVertexAttribIPointer(i, attrib_size[i], attrib_type[i], sTypeSize[i], (const GLvoid*) mOffsets[i]);
}
#endif
}
else
{
- glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], (void*) mOffsets[i]);
+ // nat 2016-12-16: With 64-bit clang compile, the compiler
+ // produces an error if we simply cast mOffsets[i] -- an S32
+ // -- to (GLvoid *), the type of the parameter. It correctly
+ // points out that there's no way an S32 could fit a real
+ // pointer value. Ruslan asserts that in this case the last
+ // param is interpreted as an array data offset within the VBO
+ // rather than as an actual pointer, so it's okay.
+ glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i],
+ attrib_normalized[i], sTypeSize[i],
+ reinterpret_cast<GLvoid*>(mOffsets[i]));
}
}
else