From 11afd7f86afd19fde8b577f57736d6d27542484e Mon Sep 17 00:00:00 2001 From: Brad Linden <46733234+brad-linden@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:57:49 -0700 Subject: Add error handling for intel crashes from GLTF Scene shader (#2456) fix secondlife/viewer#1856 --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/gltfscenemanager.cpp | 8 ++++++++ indra/newview/llviewermenu.cpp | 15 +++++++++++++-- indra/newview/llviewershadermgr.cpp | 9 ++++++++- indra/newview/skins/default/xui/en/notifications.xml | 11 +++++++++++ 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 @@ Value 0 + RenderCanUseGLTFPBROpaqueShaders + + Comment + Hardware has support for GLTF scene shaders + Persist + 0 + Type + Boolean + Value + 1 + RenderClass1MemoryBandwidth Comment 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 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 enablegltf(gSavedSettings, "GLTFEnabled", false); - return enablegltf; + static LLCachedControl 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 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"/> + + GLTF scenes are not yet supported on your graphics hardware. + fail + + + -- cgit v1.2.3