Add error handling for intel crashes from GLTF Scene shader (#2456)

fix secondlife/viewer#1856
master
Brad Linden 2024-08-29 12:57:49 -07:00 committed by GitHub
parent f15228023f
commit 11afd7f86a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 51 additions and 3 deletions

View File

@ -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>

View File

@ -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];

View File

@ -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;
}
};

View File

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

View File

@ -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>