From 891219dcef44583070e7487d0b6a4e57ad954667 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 3 Sep 2024 19:47:32 -0500 Subject: #1852 Fix for some visual corruption caused by divide by zero in lighting functions (#2488) --- .../app_settings/shaders/class1/deferred/deferredUtil.glsl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index ab0e4fd4d8..3319e32cdf 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); } -- cgit v1.2.3 From cb9f3dcfe9a55789b757bf5a7d9af3d93710c20f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 4 Sep 2024 11:34:44 -0500 Subject: #2482 Low end NVIDIA compatibility pass (#2486) - Use GL_NVX_gpu_memory_info when available - Disable transparent water on Mid+ and lower - Adjust GPU benchmark to better tell the truth - Texture bias tune up - viewer-private/#277 - Report foreground_time in viewer stats --- indra/llrender/llgl.cpp | 12 +++++++++ indra/llrender/llgl.h | 1 + indra/newview/featuretable.txt | 4 +-- indra/newview/featuretable_mac.txt | 8 +++--- indra/newview/llglsandbox.cpp | 6 ++++- indra/newview/llviewerstats.cpp | 3 +++ indra/newview/llviewertexture.cpp | 50 ++++++++++++++++++++--------------- indra/newview/llviewertexturelist.cpp | 2 +- 8 files changed, 57 insertions(+), 29 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 7959b3bb57..0afe78a30c 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1038,6 +1038,7 @@ void LLGLManager::initWGL() GLH_EXT_NAME(wglGetGPUIDsAMD) = (PFNWGLGETGPUIDSAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUIDsAMD"); GLH_EXT_NAME(wglGetGPUInfoAMD) = (PFNWGLGETGPUINFOAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUInfoAMD"); } + mHasNVXGpuMemoryInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts); if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts)) { @@ -1205,6 +1206,17 @@ bool LLGLManager::initGL() LL_WARNS("RenderInit") << "VRAM Detected (AMDAssociations):" << mVRAM << LL_ENDL; } } + else if (mHasNVXGpuMemoryInfo) + { + GLint mem_kb = 0; + glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &mem_kb); + mVRAM = mem_kb / 1024; + + if (mVRAM != 0) + { + LL_WARNS("RenderInit") << "VRAM Detected (NVXGpuMemoryInfo):" << mVRAM << LL_ENDL; + } + } #endif #if LL_WINDOWS diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index be1c0a532a..cd1ba55b16 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -97,6 +97,7 @@ public: // Vendor-specific extensions bool mHasAMDAssociations = false; + bool mHasNVXGpuMemoryInfo = false; bool mIsAMD; bool mIsNVIDIA; 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 008e4c8882..7e1313c05d 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 @@ -131,7 +131,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 @@ -166,7 +166,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 @@ -201,7 +201,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/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/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index d1ee9ea17c..5b96d351ef 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..15b4a3aab3 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 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; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index a5700ab264..0a82a9990f 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -949,7 +949,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; -- cgit v1.2.3 From 2a188ab306041f28dc40877da1e93ad13f36f8a5 Mon Sep 17 00:00:00 2001 From: Brad Linden <46733234+brad-linden@users.noreply.github.com> Date: Wed, 4 Sep 2024 10:42:59 -0700 Subject: Fix another 1856 crash on startup case when Terrain Bake shaders are unsupported (#2491) fixes secondlife/viewer#1856 --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llviewermenu.cpp | 7 +++++++ indra/newview/llviewershadermgr.cpp | 9 ++++++++- indra/newview/skins/default/xui/en/menu_viewer.xml | 3 ++- 4 files changed, 28 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5e7ae32b81..56cd58d88e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7183,6 +7183,17 @@ Value 1 + RenderCanUseTerrainBakeShaders + + Comment + Hardware has support for Terrain Bake shaders + Persist + 0 + Type + Boolean + Value + 1 + RenderClass1MemoryBandwidth Comment diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e1664752e7..35b7cb2763 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3446,6 +3446,12 @@ bool enable_gltf_upload() return enable_gltf_save_as(); } +bool enable_terrain_local_paintmap() +{ + static LLCachedControl can_use_shaders(gSavedSettings, "RenderCanUseTerrainBakeShaders", true); + return can_use_shaders; +} + class LLSelfRemoveAllAttachments : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -10217,6 +10223,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/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 40f3e51fca..56dcf15583 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3672,9 +3672,10 @@ function="World.EnvPreset" + -- cgit v1.2.3 From e16859804561272fb257b73f4d7558a74045ca2b Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 3 Sep 2024 17:53:21 -0700 Subject: secondlife/viewer#2490: Fix PBR terrain texture transform feature flag handled by viewer in unpredictable manner --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloaterregioninfo.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 56cd58d88e..0d194288e8 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9402,7 +9402,7 @@ Comment EXPERIMENTAL: Enable PBR Terrain texture transforms. Persist - 1 + 0 Type Boolean Value diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 7869abf66d..7bece051fd 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -268,7 +268,7 @@ bool LLFloaterRegionInfo::postBuild() mInfoPanels.push_back(panel); static LLCachedControl feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false); static LLCachedControl 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 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 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) -- cgit v1.2.3 From a861e86398e5d3fde9ffb388b2ccfc3624b3a5f7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 5 Sep 2024 12:08:47 -0500 Subject: #2482 Fix for Quadro GPUs claiming to have infinite VRAM (#2511) --- indra/llwindow/llwindowwin32.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 76abf5eaa2..eaee59d92c 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4638,6 +4638,12 @@ void LLWindowWin32::LLWindowWin32Thread::checkDXMem() { if (!mGLReady || mGotGLBuffer) { return; } + if ((gGLManager.mHasAMDAssociations || gGLManager.mHasNVXGpuMemoryInfo) && gGLManager.mVRAM != 0) + { // OpenGL already told us the memory budget, don't ask DX + mGotGLBuffer = true; + return; + } + IDXGIFactory4* p_factory = nullptr; HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory4), (void**)&p_factory); @@ -4734,7 +4740,7 @@ void LLWindowWin32::LLWindowWin32Thread::run() { LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32; - // Check memory budget using DirectX + // Check memory budget using DirectX if OpenGL doesn't have the means to tell us checkDXMem(); if (mWindowHandleThrd != 0) -- cgit v1.2.3 From 1f754e50908ba325c132b8d83383f7f0dbbdf793 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 6 Sep 2024 16:39:58 -0500 Subject: #2467 Fix for sim surrounds not fully loading (#2524) Also fixes some sculpts getting wrong LoD --- indra/newview/llviewertexture.cpp | 19 ++++++++++++++++--- indra/newview/llvovolume.cpp | 15 +++------------ indra/newview/llvovolume.h | 1 + 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 15b4a3aab3..99f8db00f2 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1553,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; @@ -2647,7 +2658,7 @@ void LLViewerFetchedTexture::destroyRawImage() if (mAuxRawImage.notNull() && !needsToSaveRawImage()) { sAuxCount--; - mAuxRawImage = NULL; + mAuxRawImage = nullptr; } if (mRawImage.notNull()) @@ -2662,7 +2673,7 @@ void LLViewerFetchedTexture::destroyRawImage() } } - mRawImage = NULL; + mRawImage = nullptr; mIsRawImageValid = false; mRawDiscardLevel = INVALID_DISCARD_LEVEL; @@ -2774,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/llvovolume.cpp b/indra/newview/llvovolume.cpp index 669ccb0924..6cd38078bf 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; -- cgit v1.2.3