summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp234
1 files changed, 172 insertions, 62 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 3f44205109..2f2a28daff 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -84,6 +84,7 @@
#include "llinventorytype.h"
#include "llviewerinventory.h"
#include "llcallstack.h"
+#include "llsculptidsize.h"
const F32 FORCE_SIMPLE_RENDER_AREA = 512.f;
const F32 FORCE_CULL_AREA = 8.f;
@@ -256,6 +257,8 @@ void LLVOVolume::markDead()
{
if (!mDead)
{
+ LLSculptIDSize::instance().rem(getVolume()->getParams().getSculptID());
+
if(getMDCImplCount() > 0)
{
LLMediaDataClientObject::ptr_t obj = new LLMediaDataClientObjectImpl(const_cast<LLVOVolume*>(this), false);
@@ -967,13 +970,14 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bo
// if it's a mesh
if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
{ //meshes might not have all LODs, get the force detail to best existing LOD
- LLUUID mesh_id = volume_params.getSculptID();
-
- lod = gMeshRepo.getActualMeshLOD(volume_params, lod);
- if (lod == -1)
+ if (NO_LOD != lod)
{
- is404 = TRUE;
- lod = 0;
+ lod = gMeshRepo.getActualMeshLOD(volume_params, lod);
+ if (lod == -1)
+ {
+ is404 = TRUE;
+ lod = 0;
+ }
}
}
}
@@ -1070,12 +1074,13 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bo
LLFace::cacheFaceInVRAM(face);
}
}
-
return TRUE;
}
-
-
+ else if (NO_LOD == lod)
+ {
+ LLSculptIDSize::instance().resetSizeSum(volume_params.getSculptID());
+ }
return FALSE;
}
@@ -1248,19 +1253,19 @@ void LLVOVolume::sculpt()
}
}
-S32 LLVOVolume::computeLODDetail(F32 distance, F32 radius)
+S32 LLVOVolume::computeLODDetail(F32 distance, F32 radius, F32 lod_factor)
{
S32 cur_detail;
- if (LLPipeline::sDynamicLOD)
- {
- // We've got LOD in the profile, and in the twist. Use radius.
- F32 tan_angle = (LLVOVolume::sLODFactor*radius)/distance;
- cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f));
- }
- else
- {
- cur_detail = llclamp((S32) (sqrtf(radius)*LLVOVolume::sLODFactor*4.f), 0, 3);
- }
+ if (LLPipeline::sDynamicLOD)
+ {
+ // We've got LOD in the profile, and in the twist. Use radius.
+ F32 tan_angle = (lod_factor*radius)/distance;
+ cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f));
+ }
+ else
+ {
+ cur_detail = llclamp((S32) (sqrtf(radius)*lod_factor*4.f), 0, 3);
+ }
return cur_detail;
}
@@ -1275,6 +1280,7 @@ BOOL LLVOVolume::calcLOD()
F32 radius;
F32 distance;
+ F32 lod_factor = LLVOVolume::sLODFactor;
if (mDrawable->isState(LLDrawable::RIGGED))
{
@@ -1320,11 +1326,16 @@ BOOL LLVOVolume::calcLOD()
distance *= rampDist;
}
- // DON'T Compensate for field of view changing on FOV zoom.
+
distance *= F_PI/3.f;
- cur_detail = computeLODDetail(ll_round(distance, 0.01f),
- ll_round(radius, 0.01f));
+ static LLCachedControl<bool> ignore_fov_zoom(gSavedSettings,"IgnoreFOVZoomForLODs");
+ if(!ignore_fov_zoom)
+ {
+ lod_factor *= DEFAULT_FIELD_OF_VIEW / LLViewerCamera::getInstance()->getDefaultFOV();
+ }
+
+ cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor);
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT) && mDrawable->getFace(0))
{
@@ -1367,7 +1378,16 @@ BOOL LLVOVolume::updateLOD()
return FALSE;
}
- BOOL lod_changed = calcLOD();
+ BOOL lod_changed = FALSE;
+
+ if (!LLSculptIDSize::instance().isUnloaded(getVolume()->getParams().getSculptID()))
+ {
+ lod_changed = calcLOD();
+ }
+ else
+ {
+ return FALSE;
+ }
if (lod_changed)
{
@@ -1868,6 +1888,11 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)
dirtySpatialGroup(drawable->isState(LLDrawable::IN_REBUILD_Q1));
compiled = TRUE;
lodOrSculptChanged(drawable, compiled);
+
+ if(drawable->isState(LLDrawable::REBUILD_RIGGED | LLDrawable::RIGGED))
+ {
+ updateRiggedVolume(false);
+ }
genBBoxes(FALSE);
}
// it has its own drawable (it's moved) or it has changed UVs or it has changed xforms from global<->local
@@ -2286,7 +2311,7 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
//setup new materials
for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it)
{
- LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second);
+ LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), it->second);
LLViewerObject::setTEMaterialParams(it->first, it->second);
}
@@ -2389,7 +2414,7 @@ S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialPa
if(new_material) {
pMaterial = new_material;
- LLMaterialMgr::getInstance()->put(getID(),te,*pMaterial);
+ LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), pMaterial);
}
}
@@ -4651,7 +4676,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
LLVector4a* pos = dst_face.mPositions;
- if( pos && weight && dst_face.mExtents )
+ if (pos && dst_face.mExtents)
{
LL_RECORD_BLOCK_TIME(FTM_SKIN_RIGGED);
@@ -4852,7 +4877,9 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
LL_WARNS_ONCE("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL;
}
- if (facep->getViewerObject()->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects)
+ bool selected = facep->getViewerObject()->isSelected();
+
+ if (selected && LLSelectMgr::getInstance()->mHideSelectedObjects)
{
return;
}
@@ -4949,7 +4976,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
batchable = true;
}
}
-
+
if (idx >= 0 &&
draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() &&
draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
@@ -4965,7 +4992,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
(!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different
draw_vec[idx]->mTextureMatrix == tex_mat &&
draw_vec[idx]->mModelMatrix == model_mat &&
- draw_vec[idx]->mShaderMask == shader_mask)
+ draw_vec[idx]->mShaderMask == shader_mask &&
+ draw_vec[idx]->mSelected == selected)
{
draw_vec[idx]->mCount += facep->getIndicesCount();
draw_vec[idx]->mEnd += facep->getGeomCount();
@@ -4987,7 +5015,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
U32 offset = facep->getIndicesStart();
U32 count = facep->getIndicesCount();
LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset, tex,
- facep->getVertexBuffer(), fullbright, bump);
+ facep->getVertexBuffer(), selected, fullbright, bump);
draw_info->mGroup = group;
draw_info->mVSize = facep->getVirtualSize();
draw_vec.push_back(draw_info);
@@ -5014,26 +5042,25 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
if (mat)
{
- draw_info->mMaterialID = mat_id;
+ draw_info->mMaterialID = mat_id;
- // We have a material. Update our draw info accordingly.
+ // We have a material. Update our draw info accordingly.
- if (!mat->getSpecularID().isNull())
- {
- LLVector4 specColor;
- specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f);
- specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f);
- specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f);
- specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f);
- draw_info->mSpecColor = specColor;
- draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f);
- draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset());
- }
+ if (!mat->getSpecularID().isNull())
+ {
+ LLVector4 specColor;
+ specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f);
+ specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f);
+ specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f);
+ specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f);
+ draw_info->mSpecColor = specColor;
+ draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f);
+ draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset());
+ }
- draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f);
- draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode();
- draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset());
-
+ draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f);
+ draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode();
+ draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset());
}
else
{
@@ -5104,6 +5131,81 @@ static LLDrawPoolAvatar* get_avatar_drawpool(LLViewerObject* vobj)
return NULL;
}
+void handleRenderAutoMuteByteLimitChanged(const LLSD& new_value)
+{
+ static LLCachedControl<U32> render_auto_mute_byte_limit(gSavedSettings, "RenderAutoMuteByteLimit", 0U);
+
+ if (0 != render_auto_mute_byte_limit)
+ {
+ //for unload
+ LLSculptIDSize::container_BY_SIZE_view::iterator
+ itL = LLSculptIDSize::instance().getSizeInfo().get<LLSculptIDSize::tag_BY_SIZE>().lower_bound(render_auto_mute_byte_limit),
+ itU = LLSculptIDSize::instance().getSizeInfo().get<LLSculptIDSize::tag_BY_SIZE>().end();
+
+ for (; itL != itU; ++itL)
+ {
+ const LLSculptIDSize::Info &nfo = *itL;
+ LLVOVolume *pVVol = nfo.getPtrLLDrawable()->getVOVolume();
+ if (pVVol
+ && !pVVol->isDead()
+ && pVVol->isAttachment()
+ && !pVVol->getAvatar()->isSelf()
+ && LLVOVolume::NO_LOD != pVVol->getLOD()
+ )
+ {
+ //postponed
+ pVVol->markForUnload();
+ LLSculptIDSize::instance().addToUnloaded(nfo.getSculptId());
+ }
+ }
+
+ //for load if it was unload
+ itL = LLSculptIDSize::instance().getSizeInfo().get<LLSculptIDSize::tag_BY_SIZE>().begin();
+ itU = LLSculptIDSize::instance().getSizeInfo().get<LLSculptIDSize::tag_BY_SIZE>().upper_bound(render_auto_mute_byte_limit);
+
+ for (; itL != itU; ++itL)
+ {
+ const LLSculptIDSize::Info &nfo = *itL;
+ LLVOVolume *pVVol = nfo.getPtrLLDrawable()->getVOVolume();
+ if (pVVol
+ && !pVVol->isDead()
+ && pVVol->isAttachment()
+ && !pVVol->getAvatar()->isSelf()
+ && LLVOVolume::NO_LOD == pVVol->getLOD()
+ )
+ {
+ LLSculptIDSize::instance().remFromUnloaded(nfo.getSculptId());
+ pVVol->updateLOD();
+ pVVol->markForUpdate(TRUE);
+ }
+ }
+ }
+ else
+ {
+ LLSculptIDSize::instance().clearUnloaded();
+
+ LLSculptIDSize::container_BY_SIZE_view::iterator
+ itL = LLSculptIDSize::instance().getSizeInfo().get<LLSculptIDSize::tag_BY_SIZE>().begin(),
+ itU = LLSculptIDSize::instance().getSizeInfo().get<LLSculptIDSize::tag_BY_SIZE>().end();
+
+ for (; itL != itU; ++itL)
+ {
+ const LLSculptIDSize::Info &nfo = *itL;
+ LLVOVolume *pVVol = nfo.getPtrLLDrawable()->getVOVolume();
+ if (pVVol
+ && !pVVol->isDead()
+ && pVVol->isAttachment()
+ && !pVVol->getAvatar()->isSelf()
+ && LLVOVolume::NO_LOD == pVVol->getLOD()
+ )
+ {
+ pVVol->updateLOD();
+ pVVol->markForUpdate(TRUE);
+ }
+ }
+ }
+}
+
void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (group->changeLOD())
@@ -5679,13 +5781,19 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
}
- genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sSimpleFaces, simple_count, FALSE, batch_textures, FALSE);
- genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sFullbrightFaces, fullbright_count, FALSE, batch_textures);
- genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sAlphaFaces, alpha_count, TRUE, batch_textures);
- genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sBumpFaces, bump_count, FALSE, FALSE);
- genDrawInfo(group, norm_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sNormFaces, norm_count, FALSE, FALSE);
- genDrawInfo(group, spec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sSpecFaces, spec_count, FALSE, FALSE);
- genDrawInfo(group, normspec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sNormSpecFaces, normspec_count, FALSE, FALSE);
+ group->mGeometryBytes = 0;
+
+ U32 geometryBytes = 0;
+
+ geometryBytes += genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sSimpleFaces, simple_count, FALSE, batch_textures, FALSE);
+ geometryBytes += genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sFullbrightFaces, fullbright_count, FALSE, batch_textures);
+ geometryBytes += genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sAlphaFaces, alpha_count, TRUE, batch_textures);
+ geometryBytes += genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sBumpFaces, bump_count, FALSE, FALSE);
+ geometryBytes += genDrawInfo(group, norm_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sNormFaces, norm_count, FALSE, FALSE);
+ geometryBytes += genDrawInfo(group, spec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sSpecFaces, spec_count, FALSE, FALSE);
+ geometryBytes += genDrawInfo(group, normspec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sNormSpecFaces, normspec_count, FALSE, FALSE);
+
+ group->mGeometryBytes = geometryBytes;
if (!LLPipeline::sDelayVBUpdate)
{
@@ -5738,7 +5846,6 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL) && !drawablep->isState(LLDrawable::RIGGED) )
{
LLVOVolume* vobj = drawablep->getVOVolume();
-
if (debugLoggingEnabled("AnimatedObjectsLinkset"))
{
if (vobj->isAnimatedObject() && vobj->isRiggedMesh())
@@ -5748,6 +5855,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
LL_DEBUGS("AnimatedObjectsLinkset") << vobj_name << " rebuildMesh, tris " << est_tris << LL_ENDL;
}
}
+ if (vobj->isNoLOD()) continue;
vobj->preRebuild();
@@ -5881,10 +5989,11 @@ static LLTrace::BlockTimerStatHandle FTM_GEN_DRAW_INFO_RESIZE_VB("Resize VB");
-void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort, BOOL batch_textures, BOOL no_materials)
+U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort, BOOL batch_textures, BOOL no_materials)
{
LL_RECORD_BLOCK_TIME(FTM_REBUILD_VOLUME_GEN_DRAW_INFO);
+ U32 geometryBytes = 0;
U32 buffer_usage = group->mBufferUsage;
static LLCachedControl<bool> use_transform_feedback(gSavedSettings, "RenderUseTransformFeedback", false);
@@ -6134,7 +6243,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
if (buffer)
{
- group->mGeometryBytes += buffer->getSize() + buffer->getIndicesSize();
+ geometryBytes += buffer->getSize() + buffer->getIndicesSize();
buffer_map[mask][*face_iter].push_back(buffer);
}
@@ -6422,7 +6531,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
}
else
{
- registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
+ registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
}
if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && use_legacy_bump)
{ //if this is the deferred render and a bump map is present, register in post deferred bump
@@ -6444,8 +6553,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
}
else
{
- registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
- }
+ registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
+ }
}
}
@@ -6490,6 +6599,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
{
group->mBufferMap[mask][i->first] = i->second;
}
+
+ return geometryBytes;
}
void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count)
@@ -6556,4 +6667,3 @@ void LLHUDPartition::shift(const LLVector4a &offset)
{
//HUD objects don't shift with region crossing. That would be silly.
}
-