From 6091c3a758b400039bb98d720256260b8e37ff88 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 23 Aug 2010 17:32:26 -0600 Subject: fix for EXT-8101: [crashhunters] crash in LLVOSky::calcAtmospherics() --- indra/newview/llvosky.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvosky.cpp') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index d73850cb49..bb80988854 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -975,7 +975,10 @@ void LLVOSky::calcAtmospherics(void) } temp2.mV[1] = llmax(0.f, lighty); - temp2.mV[1] = 1.f / temp2.mV[1]; + if(temp2.mV[1] > 0.f) + { + temp2.mV[1] = 1.f / temp2.mV[1]; + } componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); // Distance -- cgit v1.2.3 From 162d467b4a8ca1dae6b16ece1728873d43a287ac Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 3 Mar 2011 16:14:52 -0600 Subject: SH-1085 Fix for crash when unchecking "mirror." Basically got LLFace to be paranoid about who gets to touch its LLVertexBuffer members. Reviewed by Nyx. --- indra/newview/llvosky.cpp | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'indra/newview/llvosky.cpp') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 80f43e51d2..288d335e1d 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -1182,7 +1182,7 @@ BOOL LLVOSky::updateSky() } } - if (mDrawable.notNull() && mDrawable->getFace(0) && mDrawable->getFace(0)->mVertexBuffer.isNull()) + if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) { gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); } @@ -1233,10 +1233,11 @@ void LLVOSky::createDummyVertexBuffer() mFace[FACE_DUMMY] = mDrawable->addFace(poolp, NULL); } - if(mFace[FACE_DUMMY]->mVertexBuffer.isNull()) + if(!mFace[FACE_DUMMY]->getVertexBuffer()) { - mFace[FACE_DUMMY]->mVertexBuffer = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW_ARB); - mFace[FACE_DUMMY]->mVertexBuffer->allocateBuffer(1, 1, TRUE); + LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW_ARB); + buff->allocateBuffer(1, 1, TRUE); + mFace[FACE_DUMMY]->setVertexBuffer(buff); } } @@ -1255,13 +1256,13 @@ void LLVOSky::updateDummyVertexBuffer() LLFastTimer t(FTM_RENDER_FAKE_VBO_UPDATE) ; - if(!mFace[FACE_DUMMY] || mFace[FACE_DUMMY]->mVertexBuffer.isNull()) + if(!mFace[FACE_DUMMY] || !mFace[FACE_DUMMY]->getVertexBuffer()) createDummyVertexBuffer() ; LLStrider vertices ; - mFace[FACE_DUMMY]->mVertexBuffer->getVertexStrider(vertices, 0); + mFace[FACE_DUMMY]->getVertexBuffer()->getVertexStrider(vertices, 0); *vertices = mCameraPosAgent ; - mFace[FACE_DUMMY]->mVertexBuffer->setBuffer(0) ; + mFace[FACE_DUMMY]->getVertexBuffer()->setBuffer(0) ; } //---------------------------------- //end of fake vertex buffer updating @@ -1304,14 +1305,15 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) { face = mFace[FACE_SIDE0 + side]; - if (face->mVertexBuffer.isNull()) + if (!face->getVertexBuffer()) { face->setSize(4, 6); face->setGeomIndex(0); face->setIndicesIndex(0); - face->mVertexBuffer = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); - face->mVertexBuffer->allocateBuffer(4, 6, TRUE); - + LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); + buff->allocateBuffer(4, 6, TRUE); + face->setVertexBuffer(buff); + index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); S32 vtx = 0; @@ -1344,7 +1346,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) *indicesp++ = index_offset + 3; *indicesp++ = index_offset + 2; - face->mVertexBuffer->setBuffer(0); + buff->setBuffer(0); } } @@ -1471,13 +1473,14 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons facep = mFace[f]; - if (facep->mVertexBuffer.isNull()) + if (!facep->getVertexBuffer()) { - facep->setSize(4, 6); - facep->mVertexBuffer = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); - facep->mVertexBuffer->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount(), TRUE); + facep->setSize(4, 6); + LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); + buff->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount(), TRUE); facep->setGeomIndex(0); facep->setIndicesIndex(0); + facep->setVertexBuffer(buff); } index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp); @@ -1506,7 +1509,7 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons *indicesp++ = index_offset + 2; *indicesp++ = index_offset + 3; - facep->mVertexBuffer->setBuffer(0); + facep->getVertexBuffer()->setBuffer(0); if (is_sun) { @@ -1875,13 +1878,14 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, LLFace *face = mFace[FACE_REFLECTION]; - if (face->mVertexBuffer.isNull() || quads*4 != face->getGeomCount()) + if (!face->getVertexBuffer() || quads*4 != face->getGeomCount()) { face->setSize(quads * 4, quads * 6); - face->mVertexBuffer = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); - face->mVertexBuffer->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE); + LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); + buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE); face->setIndicesIndex(0); face->setGeomIndex(0); + face->setVertexBuffer(buff); } LLStrider verticesp; @@ -2019,7 +2023,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, } } - face->mVertexBuffer->setBuffer(0); + face->getVertexBuffer()->setBuffer(0); } -- cgit v1.2.3