diff options
Diffstat (limited to 'indra/newview/llviewershadermgr.cpp')
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 7ce9c02e8d..5b4648a0bf 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2512,6 +2512,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() {"28", "High"}, {"39", "Ultra"} }; int i = 0; + bool failed = false; for (const auto& quality_pair : quality_levels) { if (success) @@ -2535,10 +2536,26 @@ bool LLViewerShaderMgr::loadShadersDeferred() gFXAAProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = gFXAAProgram[i].createShader(); - llassert(success); + // llassert(success); + if (!success) + { + LL_WARNS() << "Failed to create shader '" << gFXAAProgram[i].mName << "', disabling!" << LL_ENDL; + // continue as if this shader never happened + failed = true; + success = true; + break; + } } ++i; } + + if (failed) + { + for (auto i = 0; i < 4; ++i) + { + gFXAAProgram[i].unload(); + } + } } if (gGLManager.mGLVersion > 3.15f && success) @@ -2546,8 +2563,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() std::vector<std::pair<std::string, std::string>> quality_levels = { {"SMAA_PRESET_LOW", "Low"}, {"SMAA_PRESET_MEDIUM", "Medium"}, {"SMAA_PRESET_HIGH", "High"}, - {"SMAA_PRESET_ULTRA", "Ultra"} }; + {"SMAA_PRESET_ULTRA", "Ultra"} }; int i = 0; + bool failed = false; for (const auto& smaa_pair : quality_levels) { std::map<std::string, std::string> defines; @@ -2576,6 +2594,15 @@ bool LLViewerShaderMgr::loadShadersDeferred() gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB)); gSMAAEdgeDetectProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = gSMAAEdgeDetectProgram[i].createShader(); + // llassert(success); + if (!success) + { + LL_WARNS() << "Failed to create shader '" << gSMAAEdgeDetectProgram[i].mName << "', disabling!" << LL_ENDL; + // continue as if this shader never happened + failed = true; + success = true; + break; + } } if (success) @@ -2593,6 +2620,15 @@ bool LLViewerShaderMgr::loadShadersDeferred() gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB)); gSMAABlendWeightsProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = gSMAABlendWeightsProgram[i].createShader(); + // llassert(success); + if (!success) + { + LL_WARNS() << "Failed to create shader '" << gSMAABlendWeightsProgram[i].mName << "', disabling!" << LL_ENDL; + // continue as if this shader never happened + failed = true; + success = true; + break; + } } if (success) @@ -2610,9 +2646,28 @@ bool LLViewerShaderMgr::loadShadersDeferred() gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB)); gSMAANeighborhoodBlendProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = gSMAANeighborhoodBlendProgram[i].createShader(); + // llassert(success); + if (!success) + { + LL_WARNS() << "Failed to create shader '" << gSMAANeighborhoodBlendProgram[i].mName << "', disabling!" << LL_ENDL; + // continue as if this shader never happened + failed = true; + success = true; + break; + } } ++i; } + + if (failed) + { + for (auto i = 0; i < 4; ++i) + { + gSMAAEdgeDetectProgram[i].unload(); + gSMAABlendWeightsProgram[i].unload(); + gSMAANeighborhoodBlendProgram[i].unload(); + } + } } if (success && gGLManager.mGLVersion > 4.05f) |