summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Linden <46733234+brad-linden@users.noreply.github.com>2024-09-04 10:42:59 -0700
committerGitHub <noreply@github.com>2024-09-04 10:42:59 -0700
commit2a188ab306041f28dc40877da1e93ad13f36f8a5 (patch)
tree11641f5d5151f49a020de17e5bee27d6dc0d9ec3
parentcb9f3dcfe9a55789b757bf5a7d9af3d93710c20f (diff)
Fix another 1856 crash on startup case when Terrain Bake shaders are unsupported (#2491)
fixes secondlife/viewer#1856
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llviewermenu.cpp7
-rw-r--r--indra/newview/llviewershadermgr.cpp9
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml3
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 @@
<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>
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<bool> 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"
<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>