summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Linden <46733234+brad-linden@users.noreply.github.com>2024-08-29 12:57:49 -0700
committerGitHub <noreply@github.com>2024-08-29 12:57:49 -0700
commit11afd7f86afd19fde8b577f57736d6d27542484e (patch)
tree563f78cf13dc296835102e34fbf5cea0be368e3f
parentf15228023f3a1094f69891a5f431cff3d895515a (diff)
Add error handling for intel crashes from GLTF Scene shader (#2456)
fix secondlife/viewer#1856
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/gltfscenemanager.cpp8
-rw-r--r--indra/newview/llviewermenu.cpp15
-rw-r--r--indra/newview/llviewershadermgr.cpp9
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml11
5 files changed, 51 insertions, 3 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 483c8774a7..5e7ae32b81 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7172,6 +7172,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>RenderCanUseGLTFPBROpaqueShaders</key>
+ <map>
+ <key>Comment</key>
+ <string>Hardware has support for GLTF scene 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/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp
index 086f41c1cb..e55d630940 100644
--- a/indra/newview/gltfscenemanager.cpp
+++ b/indra/newview/gltfscenemanager.cpp
@@ -45,6 +45,7 @@
#include "llfloaterreg.h"
#include "llagentbenefits.h"
#include "llfilesystem.h"
+#include "llviewercontrol.h"
#include "boost/json.hpp"
#define GLTF_SIM_SUPPORT 1
@@ -618,6 +619,13 @@ void GLTFSceneManager::render(Asset& asset, U8 variant)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF;
+ static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+ if (!can_use_shaders)
+ {
+ // user should already have been notified of unsupported hardware
+ return;
+ }
+
for (U32 ds = 0; ds < 2; ++ds)
{
RenderData& rd = asset.mRenderData[ds];
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 97d5781566..e1664752e7 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -3414,7 +3414,9 @@ bool enable_os_exception()
bool enable_gltf()
{
static LLCachedControl<bool> enablegltf(gSavedSettings, "GLTFEnabled", false);
- return enablegltf;
+ static LLCachedControl<bool> can_use(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+
+ return enablegltf && can_use;
}
bool enable_gltf_save_as()
@@ -8207,7 +8209,16 @@ class LLAdvancedClickGLTFOpen: public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- LL::GLTFSceneManager::instance().load();
+ static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+ if (can_use_shaders)
+ {
+ LL::GLTFSceneManager::instance().load();
+ }
+ else
+ {
+ LLNotificationsUtil::add("NoSupportGLTFShader");
+ }
+
return true;
}
};
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 073a1787d5..c98bd9b7e2 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -1336,7 +1336,14 @@ bool LLViewerShaderMgr::loadShadersDeferred()
success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);
- llassert(success);
+ //llassert(success);
+ if (!success)
+ {
+ LL_WARNS() << "Failed to create GLTF PBR Metallic Roughness Shader, disabling!" << LL_ENDL;
+ gSavedSettings.setBOOL("RenderCanUseGLTFPBROpaqueShaders", false);
+ // continue as if this shader never happened
+ success = true;
+ }
}
if (success)
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index e539388735..5ce73b2cfa 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -12572,4 +12572,15 @@ are wearing now.
yestext="OK"/>
</notification>
+ <notification
+ icon="alertmodal.tga"
+ name="NoSupportGLTFShader"
+ type="notify">
+ GLTF scenes are not yet supported on your graphics hardware.
+ <tag>fail</tag>
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
</notifications>