diff options
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llgl.cpp | 1 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 61 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 13 |
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 |