diff options
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llfloaterpreferencesgraphicsadvanced.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 59 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 9 |
4 files changed, 77 insertions, 15 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 47f1032c34..254ead2bd8 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -580,7 +580,8 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev } else { - if (type == GL_GEOMETRY_SHADER) + // OpenGL 3.2 had GLSL version 1.50. anything after that the version numbers match. + if (type == GL_GEOMETRY_SHADER || minor_version >= 50) { //set version to 1.50 shader_code_text[shader_code_count++] = strdup("#version 150\n"); diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index cf5b2d033b..8e8967ee3d 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -63,17 +63,24 @@ LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() bool LLFloaterPreferenceGraphicsAdvanced::postBuild() { - // Don't do this on Mac as their braindead GL versioning - // sets this when 8x and 16x are indeed available + // Disable FSAA combo when shaders are not loaded // -#if !LL_DARWIN - if (gGLManager.mIsIntel || gGLManager.mGLVersion < 3.f) - { //remove FSAA settings above "4x" + { LLComboBox* combo = getChild<LLComboBox>("fsaa"); - combo->remove("8x"); - combo->remove("16x"); + if (!gFXAAProgram[0].isComplete()) + combo->remove("FXAA"); + + if (!gSMAAEdgeDetectProgram[0].isComplete()) + combo->remove("SMAA"); + + if (!gFXAAProgram[0].isComplete() && !gSMAAEdgeDetectProgram[0].isComplete()) + { + combo->setEnabled(false); + getChild<LLComboBox>("fsaa quality")->setEnabled(false); + } } +#if !LL_DARWIN LLCheckBoxCtrl *use_HiDPI = getChild<LLCheckBoxCtrl>("use HiDPI"); use_HiDPI->setVisible(false); #endif 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) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a86c69b924..1ca67dd88a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7396,8 +7396,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) { { llassert(!gCubeSnapshot); - bool multisample = RenderFSAAType == 1 && mFXAAMap.isComplete(); - LLGLSLShader* shader = &gGlowCombineProgram; + bool multisample = RenderFSAAType == 1 && gFXAAProgram[0].isComplete() && mFXAAMap.isComplete(); // Present everything. if (multisample) @@ -7410,7 +7409,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) mFXAAMap.bindTarget(); mFXAAMap.clear(GL_COLOR_BUFFER_BIT); - shader = &gGlowCombineFXAAProgram; + LLGLSLShader* shader = &gGlowCombineFXAAProgram; shader->bind(); S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); @@ -7481,7 +7480,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) void LLPipeline::generateSMAABuffers(LLRenderTarget* src) { llassert(!gCubeSnapshot); - bool multisample = RenderFSAAType == 2 && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete(); + bool multisample = RenderFSAAType == 2 && gSMAAEdgeDetectProgram[0].isComplete() && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete(); // Present everything. if (multisample) @@ -7599,7 +7598,7 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src) void LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst) { llassert(!gCubeSnapshot); - bool multisample = RenderFSAAType == 2 && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete(); + bool multisample = RenderFSAAType == 2 && gSMAAEdgeDetectProgram[0].isComplete() && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete(); // Present everything. if (multisample) |