diff options
author | RunitaiLinden <davep@lindenlab.com> | 2024-09-10 18:27:45 -0500 |
---|---|---|
committer | RunitaiLinden <davep@lindenlab.com> | 2024-09-10 18:27:45 -0500 |
commit | cde5d29faf84c5cb7fc1b0d0ff6d03f3b7354c8f (patch) | |
tree | a0e1eec0a22e1c818463a0d756796bd001c2cf91 /indra/newview | |
parent | 33116ea35ec9a925c1601c8f1833e4d1e9f8390b (diff) |
Profile guided optimizations
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llface.cpp | 77 | ||||
-rw-r--r-- | indra/newview/llskinningutil.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 45 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 23 |
5 files changed, 63 insertions, 102 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index ccfef09b09..a1ec75e34b 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1741,7 +1741,7 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, { //bump mapped or has material, just do the whole expensive loop LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - texgen default"); - std::vector<LLVector2> bump_tc; + LLStrider<LLVector2> bump_tc; if (mat && !mat->getNormalID().isNull()) { //writing out normal and specular texture coordinates, not bump offsets @@ -1803,49 +1803,70 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, } const bool do_xform = (xforms & xform_channel) != XFORM_NONE; + // hold onto strider to front of TC array for use later + bump_tc = dst; - for (S32 i = 0; i < num_vertices; i++) { - LLVector2 tc(vf.mTexCoords[i]); - - LLVector4a& norm = vf.mNormals[i]; - - LLVector4a& center = *(vf.mCenter); - - if (texgen != LLTextureEntry::TEX_GEN_DEFAULT) + // NOTE: split TEX_GEN_PLANAR implementation to reduce branchiness of inner loop + // These are per-vertex operations and every little bit counts + if (texgen == LLTextureEntry::TEX_GEN_PLANAR) { - LLVector4a vec = vf.mPositions[i]; + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("tgd - planar"); + for (S32 i = 0; i < num_vertices; i++) + { + LLVector2 tc(vf.mTexCoords[i]); + LLVector4a& norm = vf.mNormals[i]; + LLVector4a& center = *(vf.mCenter); + LLVector4a vec = vf.mPositions[i]; - vec.mul(scalea); + vec.mul(scalea); - if (texgen == LLTextureEntry::TEX_GEN_PLANAR) - { planarProjection(tc, norm, center, vec); - } - } - if (tex_mode && mTextureMatrix) - { - LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f); - tmp = tmp * *mTextureMatrix; - tc.mV[0] = tmp.mV[0]; - tc.mV[1] = tmp.mV[1]; + if (tex_mode && mTextureMatrix) + { + LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f); + tmp = tmp * *mTextureMatrix; + tc.mV[0] = tmp.mV[0]; + tc.mV[1] = tmp.mV[1]; + } + else if (do_xform) + { + xform(tc, cos_ang, sin_ang, os, ot, ms, mt); + } + + *dst++ = tc; + } } - else if (do_xform) + else { - xform(tc, cos_ang, sin_ang, os, ot, ms, mt); - } + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("tgd - transform"); - *dst++ = tc; - if (do_bump) - { - bump_tc.push_back(tc); + for (S32 i = 0; i < num_vertices; i++) + { + LLVector2 tc(vf.mTexCoords[i]); + + if (tex_mode && mTextureMatrix) + { + LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f); + tmp = tmp * *mTextureMatrix; + tc.mV[0] = tmp.mV[0]; + tc.mV[1] = tmp.mV[1]; + } + else if (do_xform) + { + xform(tc, cos_ang, sin_ang, os, ot, ms, mt); + } + + *dst++ = tc; + } } } } if ((!mat && !gltf_mat) && do_bump) { + LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("tgd - do bump"); mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount); mVObjp->getVolume()->genTangents(face_index); diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 9b4ed4c946..1c92e06700 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -315,11 +315,9 @@ void LLSkinningUtil::initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar) } } -static LLTrace::BlockTimerStatHandle FTM_FACE_RIGGING_INFO("Face Rigging Info"); - void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face) { - LL_RECORD_BLOCK_TIME(FTM_FACE_RIGGING_INFO); + LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; if (vol_face.mJointRiggingInfoTab.needsUpdate()) { diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 681d91c945..9e1cb84bd1 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1361,51 +1361,6 @@ void LLViewerFetchedTexture::addToCreateTexture() } else { - LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; -#if 1 - // - //if mRequestedDiscardLevel > mDesiredDiscardLevel, we assume the required image res keep going up, - //so do not scale down the over qualified image. - //Note: scaling down image is expensensive. Do it only when very necessary. - // - if(mRequestedDiscardLevel <= mDesiredDiscardLevel && !mForceToSaveRawImage) - { - U32 w = mFullWidth >> mRawDiscardLevel; - U32 h = mFullHeight >> mRawDiscardLevel; - - //if big image, do not load extra data - //scale it down to size >= LLViewerTexture::sMinLargeImageSize - if(w * h > LLViewerTexture::sMinLargeImageSize) - { - S32 d_level = llmin(mRequestedDiscardLevel, (S32)mDesiredDiscardLevel) - mRawDiscardLevel; - - if(d_level > 0) - { - S32 i = 0; - while((d_level > 0) && ((w >> i) * (h >> i) > LLViewerTexture::sMinLargeImageSize)) - { - i++; - d_level--; - } - if(i > 0) - { - mRawDiscardLevel += i; - if(mRawDiscardLevel >= getDiscardLevel() && getDiscardLevel() > 0) - { - mNeedsCreateTexture = false; - destroyRawImage(); - return; - } - - { - //make a duplicate in case somebody else is using this raw image - mRawImage = mRawImage->scaled(w >> i, h >> i); - } - } - } - } - } -#endif scheduleCreateTexture(); } return; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b04bb99b97..26cb2a573a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -10684,14 +10684,18 @@ void LLVOAvatar::updateRiggingInfo() std::map<LLUUID, S32> curr_rigging_info_key; - // Get current rigging info key - for (LLVOVolume* vol : volumes) { - if (vol->isMesh() && vol->getVolume()) + LL_PROFILE_ZONE_NAMED_CATEGORY_AVATAR("update rig info - get key") + + // Get current rigging info key + for (LLVOVolume* vol : volumes) { - const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID(); - S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD); - curr_rigging_info_key[mesh_id] = max_lod; + if (vol->isMesh() && vol->getVolume()) + { + const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID(); + S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD); + curr_rigging_info_key[mesh_id] = max_lod; + } } } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 4b63354893..4f48a070e3 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -6028,8 +6028,8 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) group->mBuilt = 1.f; - const U32 MAX_BUFFER_COUNT = 4096; - LLVertexBuffer* locked_buffer[MAX_BUFFER_COUNT]; + static std::vector<LLVertexBuffer*> locked_buffer; + locked_buffer.resize(0); U32 buffer_count = 0; @@ -6074,8 +6074,6 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) group->dirtyGeom(); gPipeline.markRebuild(group); } - - buff->unmapBuffer(); } } } @@ -6091,17 +6089,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) { LL_PROFILE_ZONE_NAMED("rebuildMesh - flush"); - for (LLVertexBuffer** iter = locked_buffer, ** end_iter = locked_buffer+buffer_count; iter != end_iter; ++iter) - { - (*iter)->unmapBuffer(); - } - - // don't forget alpha - if(group != NULL && - !group->mVertexBuffer.isNull()) - { - group->mVertexBuffer->unmapBuffer(); - } + LLVertexBuffer::flushBuffers(); } group->clearState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO); @@ -6783,11 +6771,6 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace ++face_iter; } - - if (buffer) - { - buffer->unmapBuffer(); - } } group->mBufferMap[mask].clear(); |