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(-) 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