From 0940e8871894e08da80730d11c31cbd252a05b35 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 24 May 2022 10:34:47 -0500 Subject: SL-17472 Add checkbox to preferences for enabling "PBR" that uses "class3" deferred shaders. Move reflection probe shaders to class3 and restore class2 shaders to non-reflection probe versions. --- indra/newview/llvopartgroup.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 068e8a131d..04e9a4f179 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -756,6 +756,7 @@ LLHUDParticlePartition::LLHUDParticlePartition(LLViewerRegion* regionp) : void LLParticlePartition::rebuildGeom(LLSpatialGroup* group) { LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_GPU_ZONE("particle vbo"); if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY)) { return; -- cgit v1.2.3 From 0d9c23372bf8b34387b7d9de89234d3e9a5fd879 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 9 Jun 2022 14:09:33 -0500 Subject: SL-17551 Add "Select Reflection Probes" menu option and make invisible objects less annoying when alt-zooming in edit mode. --- indra/newview/llvopartgroup.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 04e9a4f179..cb4315a774 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -485,6 +485,7 @@ BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector S32 face, BOOL pick_transparent, BOOL pick_rigged, + BOOL pick_unselectable, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, -- cgit v1.2.3 From 01d03edd8512580575da515401a42021577c3c57 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Thu, 1 Sep 2022 13:38:22 -0700 Subject: SL-17967 - _ARB constant removal --- indra/newview/llvopartgroup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index cb4315a774..2047e0a726 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -65,7 +65,7 @@ void LLVOPartGroup::restoreGL() { //TODO: optimize out binormal mask here. Specular and normal coords as well. - sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW_ARB); + sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW); U32 count = LL_MAX_PARTICLE_COUNT; if (!sVB->allocateBuffer(count*4, count*6, true)) { @@ -738,7 +738,7 @@ U32 LLVOPartGroup::getPartitionType() const } LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp) -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB, regionp) +: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW, regionp) { mRenderPass = LLRenderPass::PASS_ALPHA; mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES; -- cgit v1.2.3 From 8aa65f67975fc362d1fcf1d085d646f5fa68798d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 22 Nov 2022 16:01:18 -0600 Subject: SL-18697 Fix for particle textures not loading. --- indra/newview/llvopartgroup.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 08f10a2028..0c09cbf2c2 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -916,7 +916,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) BOOL fullbright = facep->isState(LLFace::FULLBRIGHT); F32 vsize = facep->getVirtualSize(); - + bool batched = false; U32 bf_src = LLRender::BF_SOURCE_ALPHA; @@ -961,7 +961,6 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) U32 offset = facep->getIndicesStart(); U32 count = facep->getIndicesCount(); LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(), - //facep->getTexture(), buffer, object->isSelected(), fullbright); const LLVector4a* exts = group->getObjectExtents(); -- cgit v1.2.3 From a710bf9067bd4c4217b9febc0ad277a1636ec882 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 9 Jan 2023 15:18:57 -0600 Subject: SL-18869 Optimizations -- Use _mm_prefetch to cut down on cache misses when iterating over render batches. --- indra/newview/llvopartgroup.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 0c09cbf2c2..a5c65d6ed4 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -963,9 +963,6 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(), buffer, object->isSelected(), fullbright); - const LLVector4a* exts = group->getObjectExtents(); - info->mExtents[0] = exts[0]; - info->mExtents[1] = exts[1]; info->mVSize = vsize; info->mBlendFuncDst = bf_dst; info->mBlendFuncSrc = bf_src; -- cgit v1.2.3 From 7bd9d21e19b923096ba2b5ea3cbc8be3e13d7aa0 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 19 Jan 2023 09:13:45 -0600 Subject: Optimizations, decruft, and intel compatibility pass (#53) SL-18869, SL-18772 Overhaul VBO management, restore occlusion culling, intel compatibility pass, etc --- indra/newview/llvopartgroup.cpp | 196 ++++++++++++++++++---------------------- 1 file changed, 89 insertions(+), 107 deletions(-) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index a5c65d6ed4..ac302ef421 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -46,18 +46,8 @@ extern U64MicrosecondsImplicit gFrameTime; -LLPointer LLVOPartGroup::sVB = NULL; -S32 LLVOPartGroup::sVBSlotFree[]; -S32* LLVOPartGroup::sVBSlotCursor = NULL; - void LLVOPartGroup::initClass() { - for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i) - { - sVBSlotFree[i] = i; - } - - sVBSlotCursor = sVBSlotFree; } //static @@ -65,9 +55,10 @@ void LLVOPartGroup::restoreGL() { //TODO: optimize out binormal mask here. Specular and normal coords as well. - sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW); +#if 0 + sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2); U32 count = LL_MAX_PARTICLE_COUNT; - if (!sVB->allocateBuffer(count*4, count*6, true)) + if (!sVB->allocateBuffer(count*4, count*6)) { LL_WARNS() << "Failed to allocate Vertex Buffer to " << count*4 << " vertices and " @@ -117,27 +108,14 @@ void LLVOPartGroup::restoreGL() *texcoordsp++ = LLVector2(1.f, 0.f); } - sVB->flush(); + sVB->unmapBuffer(); +#endif } //static void LLVOPartGroup::destroyGL() { - sVB = NULL; -} - -//static -S32 LLVOPartGroup::findAvailableVBSlot() -{ - if (sVBSlotCursor >= sVBSlotFree + LL_MAX_PARTICLE_COUNT) - { //no more available slots - return -1; - } - - S32 ret = *sVBSlotCursor; - sVBSlotCursor++; - return ret; } bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end) @@ -155,20 +133,6 @@ bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end) return false; } -//static -void LLVOPartGroup::freeVBSlot(S32 idx) -{ - llassert(idx < LL_MAX_PARTICLE_COUNT && idx >= 0); - //llassert(sVBSlotCursor > sVBSlotFree); - //llassert(ll_is_part_idx_allocated(idx, sVBSlotCursor, sVBSlotFree+LL_MAX_PARTICLE_COUNT)); - - if (sVBSlotCursor > sVBSlotFree) - { - sVBSlotCursor--; - *sVBSlotCursor = idx; - } -} - LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) : LLAlphaObject(id, pcode, regionp), mViewerPartGroupp(NULL) @@ -291,13 +255,13 @@ F32 LLVOPartGroup::getPartSize(S32 idx) return 0.f; } -void LLVOPartGroup::getBlendFunc(S32 idx, U32& src, U32& dst) +void LLVOPartGroup::getBlendFunc(S32 idx, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst) { if (idx < (S32) mViewerPartGroupp->mParticles.size()) { LLViewerPart* part = mViewerPartGroupp->mParticles[idx]; - src = part->mBlendFuncSource; - dst = part->mBlendFuncDest; + src = (LLRender::eBlendFactor) part->mBlendFuncSource; + dst = (LLRender::eBlendFactor) part->mBlendFuncDest; } } @@ -738,7 +702,7 @@ U32 LLVOPartGroup::getPartitionType() const } LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp) -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW, regionp) +: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, regionp) { mRenderPass = LLRenderPass::PASS_ALPHA; mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES; @@ -758,32 +722,68 @@ void LLParticlePartition::rebuildGeom(LLSpatialGroup* group) { LL_PROFILE_ZONE_SCOPED; LL_PROFILE_GPU_ZONE("particle vbo"); - if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY)) - { - return; - } + if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY)) + { + return; + } - if (group->changeLOD()) - { - group->mLastUpdateDistance = group->mDistance; - group->mLastUpdateViewAngle = group->mViewAngle; - } - - group->clearDrawMap(); - - //get geometry count - U32 index_count = 0; - U32 vertex_count = 0; + if (group->changeLOD()) + { + group->mLastUpdateDistance = group->mDistance; + group->mLastUpdateViewAngle = group->mViewAngle; + } - addGeometryCount(group, vertex_count, index_count); - + group->clearDrawMap(); + + //get geometry count + U32 index_count = 0; + U32 vertex_count = 0; + + addGeometryCount(group, vertex_count, index_count); - if (vertex_count > 0 && index_count > 0 && LLVOPartGroup::sVB) - { - group->mBuilt = 1.f; - //use one vertex buffer for all groups - group->mVertexBuffer = LLVOPartGroup::sVB; - getGeometry(group); + + if (vertex_count > 0 && index_count > 0) + { + group->mBuilt = 1.f; + if (group->mVertexBuffer.isNull() || + group->mVertexBuffer->getNumVerts() < vertex_count || group->mVertexBuffer->getNumIndices() < index_count) + { + group->mVertexBuffer = new LLVertexBuffer(LLVOPartGroup::VERTEX_DATA_MASK); + group->mVertexBuffer->allocateBuffer(vertex_count, index_count); + + // initialize index and texture coordinates only when buffer is reallocated + U16* indicesp = (U16*)group->mVertexBuffer->mapIndexBuffer(0, index_count); + + U16 geom_idx = 0; + for (U32 i = 0; i < index_count; i += 6) + { + *indicesp++ = geom_idx + 0; + *indicesp++ = geom_idx + 1; + *indicesp++ = geom_idx + 2; + + *indicesp++ = geom_idx + 1; + *indicesp++ = geom_idx + 3; + *indicesp++ = geom_idx + 2; + + geom_idx += 4; + } + + LLStrider texcoordsp; + + group->mVertexBuffer->getTexCoord0Strider(texcoordsp); + + for (U32 i = 0; i < vertex_count; i += 4) + { + *texcoordsp++ = LLVector2(0.f, 1.f); + *texcoordsp++ = LLVector2(0.f, 0.f); + *texcoordsp++ = LLVector2(1.f, 1.f); + *texcoordsp++ = LLVector2(1.f, 0.f); + } + + } + + + getGeometry(group); } else { @@ -797,8 +797,6 @@ void LLParticlePartition::rebuildGeom(LLSpatialGroup* group) void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count) { - group->mBufferUsage = mBufferUsage; - mFaceList.clear(); LLViewerCamera* camera = LLViewerCamera::getInstance(); @@ -851,10 +849,8 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) LLVertexBuffer* buffer = group->mVertexBuffer; - LLStrider indicesp; LLStrider verticesp; LLStrider normalsp; - LLStrider texcoordsp; LLStrider colorsp; LLStrider emissivep; @@ -863,7 +859,9 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) buffer->getColorStrider(colorsp); buffer->getEmissiveStrider(emissivep); - + S32 geom_idx = 0; + S32 indices_idx = 0; + LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[mRenderPass]; for (std::vector::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i) @@ -871,56 +869,44 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) LLFace* facep = *i; LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject(); - if (!facep->isState(LLFace::PARTICLE)) - { //set the indices of this face - S32 idx = LLVOPartGroup::findAvailableVBSlot(); - if (idx >= 0) - { - facep->setGeomIndex(idx*4); - facep->setIndicesIndex(idx*6); - facep->setVertexBuffer(LLVOPartGroup::sVB); - facep->setPoolType(LLDrawPool::POOL_ALPHA); - facep->setState(LLFace::PARTICLE); - } - else - { - continue; //out of space in particle buffer - } - } - - S32 geom_idx = (S32) facep->getGeomIndex(); + facep->setGeomIndex(geom_idx); + facep->setIndicesIndex(indices_idx); - LLStrider cur_idx = indicesp + facep->getIndicesStart(); LLStrider cur_vert = verticesp + geom_idx; LLStrider cur_norm = normalsp + geom_idx; - LLStrider cur_tc = texcoordsp + geom_idx; LLStrider cur_col = colorsp + geom_idx; LLStrider cur_glow = emissivep + geom_idx; + // not actually used + LLStrider cur_tc; + LLStrider cur_idx; + + + geom_idx += 4; + indices_idx += 6; + LLColor4U* start_glow = cur_glow.get(); object->getGeometry(facep->getTEOffset(), cur_vert, cur_norm, cur_tc, cur_col, cur_glow, cur_idx); - BOOL has_glow = FALSE; + bool has_glow = FALSE; if (cur_glow.get() != start_glow) { - has_glow = TRUE; + has_glow = true; } llassert(facep->getGeomCount() == 4); llassert(facep->getIndicesCount() == 6); - - + S32 idx = draw_vec.size()-1; - BOOL fullbright = facep->isState(LLFace::FULLBRIGHT); - F32 vsize = facep->getVirtualSize(); + bool fullbright = facep->isState(LLFace::FULLBRIGHT); bool batched = false; - U32 bf_src = LLRender::BF_SOURCE_ALPHA; - U32 bf_dst = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; + LLRender::eBlendFactor bf_src = LLRender::BF_SOURCE_ALPHA; + LLRender::eBlendFactor bf_dst = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; object->getBlendFunc(facep->getTEOffset(), bf_src, bf_dst); @@ -940,7 +926,6 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) batched = true; info->mCount += facep->getIndicesCount(); info->mEnd += facep->getGeomCount(); - info->mVSize = llmax(draw_vec[idx]->mVSize, vsize); } else if (draw_vec[idx]->mStart == facep->getGeomIndex()+facep->getGeomCount()+1) { @@ -948,12 +933,10 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) info->mCount += facep->getIndicesCount(); info->mStart -= facep->getGeomCount(); info->mOffset = facep->getIndicesStart(); - info->mVSize = llmax(draw_vec[idx]->mVSize, vsize); } } } - if (!batched) { U32 start = facep->getGeomIndex(); @@ -961,19 +944,18 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) U32 offset = facep->getIndicesStart(); U32 count = facep->getIndicesCount(); LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(), - buffer, object->isSelected(), fullbright); + buffer, fullbright); - info->mVSize = vsize; info->mBlendFuncDst = bf_dst; info->mBlendFuncSrc = bf_src; info->mHasGlow = has_glow; - info->mParticle = TRUE; draw_vec.push_back(info); //for alpha sorting facep->setDrawInfo(info); } } + buffer->unmapBuffer(); mFaceList.clear(); } -- cgit v1.2.3 From 6f5f16e0319bde183534a779839299dca7fe50ab Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 17 May 2023 13:40:33 -0500 Subject: SL-19655 Remove concept of "low priority" updates (RenderDebugGLSession assertion stomping pass). Remove a couple unused debug settings and related code. --- indra/newview/llvopartgroup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index ac302ef421..3ac04cf665 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -287,7 +287,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) if (group && group->isVisible()) { - dirtySpatialGroup(TRUE); + dirtySpatialGroup(); } if (!num_parts) -- cgit v1.2.3 From f7e6b2e2e1335a0086ccaa2cf435c388a9858236 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Sat, 2 Sep 2023 12:35:35 +0200 Subject: SL-20236 BugSplat Crash in LLVertexBuffer::validateRange(708) --- indra/newview/llvopartgroup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 3ac04cf665..99874b8185 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -572,7 +572,7 @@ void LLVOPartGroup::getGeometry(const LLViewerPart& part, up.setCross3(right, at); up.normalize3fast(); - if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK) + if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK && !part.mVelocity.isExactlyZero()) { LLVector4a normvel; normvel.load3(part.mVelocity.mV); -- cgit v1.2.3