diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 13 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl | 11 | ||||
-rw-r--r-- | indra/newview/featuretable.txt | 4 | ||||
-rw-r--r-- | indra/newview/featuretable_mac.txt | 8 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llglsandbox.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llviewerstats.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 69 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llvovolume.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 3 |
14 files changed, 104 insertions, 55 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8b5e92f704..bd49f003c5 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7227,6 +7227,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>RenderCanUseTerrainBakeShaders</key> + <map> + <key>Comment</key> + <string>Hardware has support for Terrain Bake shaders</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>RenderClass1MemoryBandwidth</key> <map> <key>Comment</key> @@ -9435,7 +9446,7 @@ <key>Comment</key> <string>EXPERIMENTAL: Enable PBR Terrain texture transforms.</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>Boolean</string> <key>Value</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index 5193a46ac2..8588a93648 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -99,10 +99,13 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v, { l = normalize(lv); h = normalize(l + v); - nh = clamp(dot(n, h), 0.0, 1.0); - nl = clamp(dot(n, l), 0.0, 1.0); - nv = clamp(dot(n, v), 0.0, 1.0); - vh = clamp(dot(v, h), 0.0, 1.0); + + // lower bound to avoid divide by zero + float eps = 0.000001; + nh = clamp(dot(n, h), eps, 1.0); + nl = clamp(dot(n, l), eps, 1.0); + nv = clamp(dot(n, v), eps, 1.0); + vh = clamp(dot(v, h), eps, 1.0); lightDist = length(lv); } diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 213f0ab845..131d995339 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 62 +version 63 // The version number above should be incremented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -200,7 +200,7 @@ RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 RenderMaxPartCount 1 4096 RenderLocalLightCount 1 1024 -RenderTransparentWater 1 1 +RenderTransparentWater 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTerrainPBRDetail 1 0 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 2f7f60a05e..43d0f7cd7d 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 59 +version 60 // The version number above should be incremented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -133,7 +133,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 RenderTerrainPBRDetail 1 -1 RenderTerrainPBRPlanarSampleCount 1 1 -RenderTransparentWater 1 1 +RenderTransparentWater 1 0 RenderTreeLODFactor 1 0.5 RenderVolumeLODFactor 1 1.125 RenderDeferredSSAO 1 0 @@ -168,7 +168,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTerrainPBRDetail 1 0 RenderTerrainPBRPlanarSampleCount 1 1 -RenderTransparentWater 1 1 +RenderTransparentWater 1 0 RenderTreeLODFactor 1 0.5 RenderVolumeLODFactor 1 1.25 RenderDeferredSSAO 1 0 @@ -203,7 +203,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTerrainPBRDetail 1 0 RenderTerrainPBRPlanarSampleCount 1 1 -RenderTransparentWater 1 1 +RenderTransparentWater 1 0 RenderTreeLODFactor 1 0.5 RenderVolumeLODFactor 1 1.375 RenderDeferredSSAO 1 0 diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index e90e8ae48a..2fdde670fc 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -268,7 +268,7 @@ bool LLFloaterRegionInfo::postBuild() mInfoPanels.push_back(panel); static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false); static LLCachedControl<bool> feature_pbr_terrain_transforms_enabled(gSavedSettings, "RenderTerrainPBRTransformsEnabled", false); - if (!feature_pbr_terrain_transforms_enabled || !feature_pbr_terrain_enabled) + if (!feature_pbr_terrain_transforms_enabled() || !feature_pbr_terrain_enabled()) { panel->buildFromFile("panel_region_terrain.xml"); } @@ -1694,7 +1694,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false); const bool textures_ready = compp->makeTexturesReady(false, false); - const bool materials_ready = feature_pbr_terrain_enabled && compp->makeMaterialsReady(false, false); + const bool materials_ready = feature_pbr_terrain_enabled() && compp->makeMaterialsReady(false, false); bool set_texture_swatches; bool set_material_swatches; @@ -1724,7 +1724,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { material_type_to_ctrl(mMaterialTypeCtrl, material_type); updateForMaterialType(); - mMaterialTypeCtrl->setVisible(feature_pbr_terrain_enabled); + mMaterialTypeCtrl->setVisible(feature_pbr_terrain_enabled()); } if (set_texture_swatches) @@ -1938,7 +1938,7 @@ bool LLPanelRegionTerrainInfo::sendUpdate() // POST to ModifyRegion endpoint, if enabled static LLCachedControl<bool> feature_pbr_terrain_transforms_enabled(gSavedSettings, "RenderTerrainPBRTransformsEnabled", false); - if (material_type == LLTerrainMaterials::Type::PBR && feature_pbr_terrain_transforms_enabled) + if (material_type == LLTerrainMaterials::Type::PBR && feature_pbr_terrain_transforms_enabled()) { LLTerrainMaterials composition; for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 19cb4d04e2..930a8c28d9 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -1075,6 +1075,9 @@ F32 gpu_benchmark() return -1.f; } LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RGBA, res,res,GL_RGBA, GL_UNSIGNED_BYTE, pixels); + // disable mipmaps and use point filtering to cause cache misses + gGL.getTexUnit(0)->setHasMipMaps(false); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); if (alloc_timer.getElapsedTimeF32() > time_limit) { @@ -1191,7 +1194,8 @@ F32 gpu_benchmark() F32 seconds = ms/1000.f; F64 samples_drawn = (F64)gBenchmarkProgram.mSamplesDrawn; - F32 samples_sec = (F32)((samples_drawn/1000000000.0)/seconds); + F64 gpixels_drawn = samples_drawn / 1000000000.0; + F32 samples_sec = (F32)(gpixels_drawn/seconds); gbps = samples_sec*4; // 4 bytes per sample LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9c40216ad6..5a1228768c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3447,6 +3447,12 @@ bool enable_gltf_upload() return enable_gltf_save_as(); } +bool enable_terrain_local_paintmap() +{ + static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseTerrainBakeShaders", true); + return can_use_shaders; +} + class LLSelfRemoveAllAttachments : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -10238,6 +10244,7 @@ void initialize_menus() enable.add("EnableGLTF", boost::bind(&enable_gltf)); enable.add("EnableGLTFSaveAs", boost::bind(&enable_gltf_save_as)); enable.add("EnableGLTFUpload", boost::bind(&enable_gltf_upload)); + enable.add("EnableTerrainLocalPaintMap", std::bind(&enable_terrain_local_paintmap)); view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible"); view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel"); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index c98bd9b7e2..6b0fc4f5e8 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2993,7 +2993,14 @@ bool LLViewerShaderMgr::loadShadersInterface() const U32 value_range = (1 << bit_depth) - 1; shader->addPermutation("TERRAIN_PAINT_PRECISION", llformat("%d", value_range)); success = success && shader->createShader(); - llassert(success); + //llassert(success); + if (!success) + { + LL_WARNS() << "Failed to create shader '" << shader->mName << "', disabling!" << LL_ENDL; + gSavedSettings.setBOOL("RenderCanUseTerrainBakeShaders", false); + // continue as if this shader never happened + success = true; + } } if (success) diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index b351f3e12f..fcffb96735 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -597,6 +597,9 @@ void send_viewer_stats(bool include_preferences) agent["run_time"] = run_time; } + // report time the viewer has spent in the foreground + agent["foreground_time"] = gForegroundTime.getElapsedTimeF32(); + // send fps only for time app spends in foreground agent["fps"] = (F32)gForegroundFrameCount / gForegroundTime.getElapsedTimeF32(); agent["version"] = LLVersionInfo::instance().getChannelAndVersion(); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 452d6f2c04..99f8db00f2 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -511,44 +511,52 @@ void LLViewerTexture::updateClass() F32 over_pct = (used - target) / target; - bool is_low = over_pct > 0.f; + bool is_sys_low = isSystemMemoryLow(); + bool is_low = is_sys_low || over_pct > 0.f; - if (isSystemMemoryLow()) + static bool was_low = false; + static bool was_sys_low = false; + + if (is_low && !was_low) + { + // slam to 1.5 bias the moment we hit low memory (discards off screen textures immediately) + sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.5f); + + if (is_sys_low) + { // if we're low on system memory, emergency purge off screen textures to avoid a death spiral + LL_WARNS() << "Low system memory detected, emergency downrezzing off screen textures" << LL_ENDL; + for (auto& image : gTextureList) + { + gTextureList.updateImageDecodePriority(image, false /*will modify gTextureList otherwise!*/); + } + } + } + + was_low = is_low; + was_sys_low = is_sys_low; + + if (is_low) { - is_low = true; - // System RAM is low -> ramp up discard bias over time to free memory + // ramp up discard bias over time to free memory if (sEvaluationTimer.getElapsedTimeF32() > MEMORY_CHECK_WAIT_TIME) { static LLCachedControl<F32> low_mem_min_discard_increment(gSavedSettings, "RenderLowMemMinDiscardIncrement", .1f); - sDesiredDiscardBias += (F32) low_mem_min_discard_increment * (F32) gFrameIntervalSeconds; + sDesiredDiscardBias += (F32)low_mem_min_discard_increment * (F32)gFrameIntervalSeconds; sEvaluationTimer.reset(); } } else { - sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.f + over_pct); + // don't execute above until the slam to 1.5 has a chance to take effect + sEvaluationTimer.reset(); + // lower discard bias over time when free memory is available if (sDesiredDiscardBias > 1.f && over_pct < 0.f) { sDesiredDiscardBias -= gFrameIntervalSeconds * 0.01f; } } - static bool was_low = false; - if (is_low && !was_low) - { - LL_WARNS() << "Low system memory detected, emergency downrezzing off screen textures" << LL_ENDL; - sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.5f); - - for (auto& image : gTextureList) - { - gTextureList.updateImageDecodePriority(image, false /*will modify gTextureList otherwise!*/); - } - } - - was_low = is_low; - - // set to max discard bias if the window has been backgrounded for a while static bool was_backgrounded = false; static LLFrameTimer backgrounded_timer; @@ -1545,6 +1553,17 @@ void LLViewerFetchedTexture::postCreateTexture() setActive(); + // rebuild any volumes that are using this texture for sculpts in case their LoD has changed + for (U32 i = 0; i < mNumVolumes[LLRender::SCULPT_TEX]; ++i) + { + LLVOVolume* volume = mVolumeList[LLRender::SCULPT_TEX][i]; + if (volume) + { + volume->mSculptChanged = true; + gPipeline.markRebuild(volume->mDrawable); + } + } + if (!needsToSaveRawImage()) { mNeedsAux = false; @@ -2639,7 +2658,7 @@ void LLViewerFetchedTexture::destroyRawImage() if (mAuxRawImage.notNull() && !needsToSaveRawImage()) { sAuxCount--; - mAuxRawImage = NULL; + mAuxRawImage = nullptr; } if (mRawImage.notNull()) @@ -2654,7 +2673,7 @@ void LLViewerFetchedTexture::destroyRawImage() } } - mRawImage = NULL; + mRawImage = nullptr; mIsRawImageValid = false; mRawDiscardLevel = INVALID_DISCARD_LEVEL; @@ -2766,7 +2785,9 @@ void LLViewerFetchedTexture::readbackRawImage() { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 && mRawImage.isNull()) + // readback the raw image from vram if the current raw image is null or smaller than the texture + if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 && + (mRawImage.isNull() || mRawImage->getWidth() < mGLTexturep->getWidth() || mRawImage->getHeight() < mGLTexturep->getHeight() )) { mRawImage = new LLImageRaw(); if (!mGLTexturep->readBackRaw(-1, mRawImage, false)) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index aad19a658f..38e35b3d58 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -959,7 +959,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag // this is an alternative to decaying mMaxVirtualSize over time // that keeps textures from continously downrezzing and uprezzing in the background - if (LLViewerTexture::sDesiredDiscardBias > 2.f || + if (LLViewerTexture::sDesiredDiscardBias > 1.5f || (!on_screen && LLViewerTexture::sDesiredDiscardBias > 1.f)) { imagep->mMaxVirtualSize = 0.f; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 89e15785c8..9b63875ffe 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1149,7 +1149,7 @@ void LLVOVolume::updateSculptTexture() { mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_SCULPTED, LLViewerTexture::LOD_TEXTURE); mSculptTexture->forceToSaveRawImage(0, F32_MAX); - mSculptTexture->addTextureStats(256.f*256.f); + mSculptTexture->setKnownDrawSize(256, 256); } mSkinInfoUnavaliable = false; @@ -1251,7 +1251,7 @@ void LLVOVolume::sculpt() discard_level = mSculptTexture->getSavedRawImageLevel(); } - if (!raw_image) + if (!raw_image || raw_image->getWidth() < mSculptTexture->getWidth() || raw_image->getHeight() < mSculptTexture->getHeight()) { // last resort, read back from GL mSculptTexture->readbackRawImage(); @@ -1338,17 +1338,8 @@ void LLVOVolume::sculpt() mSculptTexture->updateBindStatsForTester() ; } } - getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset()); - //notify rebuild any other VOVolumes that reference this sculpty volume - for (S32 i = 0; i < mSculptTexture->getNumVolumes(LLRender::SCULPT_TEX); ++i) - { - LLVOVolume* volume = (*(mSculptTexture->getVolumeList(LLRender::SCULPT_TEX)))[i]; - if (volume != this && volume->getVolume() == getVolume()) - { - gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY); - } - } + getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset()); } } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 6241bf42d6..97a5131260 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -451,6 +451,7 @@ public: private: friend class LLDrawable; friend class LLFace; + friend class LLViewerFetchedTexture; bool mFaceMappingChanged; LLFrameTimer mTextureUpdateTimer; diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 89d20a831e..50a8d248f8 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3673,9 +3673,10 @@ function="World.EnvPreset" <menu_item_separator/> <menu_item_call - enabled="true" label="Create Local Paintmap" name="Create Local Paintmap"> + <menu_item_call.on_enable + function="EnableTerrainLocalPaintMap"/> <menu_item_call.on_click function="Advanced.TerrainCreateLocalPaintMap" /> </menu_item_call> |