diff options
Diffstat (limited to 'indra/newview/llviewershadermgr.cpp')
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 387 |
1 files changed, 349 insertions, 38 deletions
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index ee071b51fc..83386eb1ec 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -158,6 +158,7 @@ LLGLSLShader gDeferredMultiLightProgram[16]; LLGLSLShader gDeferredSpotLightProgram; LLGLSLShader gDeferredMultiSpotLightProgram; LLGLSLShader gDeferredSunProgram; +LLGLSLShader gDeferredSunProbeProgram; LLGLSLShader gHazeProgram; LLGLSLShader gHazeWaterProgram; LLGLSLShader gDeferredBlurLightProgram; @@ -193,14 +194,20 @@ LLGLSLShader gDeferredSkinnedEmissiveProgram; LLGLSLShader gDeferredPostProgram; LLGLSLShader gDeferredCoFProgram; LLGLSLShader gDeferredDoFCombineProgram; +LLGLSLShader gDeferredPostTonemapProgram; +LLGLSLShader gNoPostTonemapProgram; LLGLSLShader gDeferredPostGammaCorrectProgram; -LLGLSLShader gNoPostGammaCorrectProgram; LLGLSLShader gLegacyPostGammaCorrectProgram; LLGLSLShader gExposureProgram; LLGLSLShader gExposureProgramNoFade; LLGLSLShader gLuminanceProgram; -LLGLSLShader gFXAAProgram; +LLGLSLShader gFXAAProgram[4]; +LLGLSLShader gSMAAEdgeDetectProgram[4]; +LLGLSLShader gSMAABlendWeightsProgram[4]; +LLGLSLShader gSMAANeighborhoodBlendProgram[4]; +LLGLSLShader gCASProgram; LLGLSLShader gDeferredPostNoDoFProgram; +LLGLSLShader gDeferredPostNoDoFNoiseProgram; LLGLSLShader gDeferredWLSkyProgram; LLGLSLShader gEnvironmentMapProgram; LLGLSLShader gDeferredWLCloudProgram; @@ -249,6 +256,16 @@ static bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader return riggedShader.createShader(); } +static void add_common_permutations(LLGLSLShader* shader) +{ + LLCachedControl<bool> emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false); + + if (emissive) + { + shader->addPermutation("HAS_EMISSIVE", "1"); + } +} + static bool make_gltf_variant(LLGLSLShader& shader, LLGLSLShader& variant, bool alpha_blend, bool rigged, bool unlit, bool multi_uv, bool use_sun_shadow) { @@ -400,6 +417,7 @@ void LLViewerShaderMgr::finalizeShaderList() mShaderList.push_back(&gObjectAlphaMaskNoColorProgram); mShaderList.push_back(&gUnderWaterProgram); mShaderList.push_back(&gDeferredSunProgram); + mShaderList.push_back(&gDeferredSunProbeProgram); mShaderList.push_back(&gHazeProgram); mShaderList.push_back(&gHazeWaterProgram); mShaderList.push_back(&gDeferredSoftenProgram); @@ -424,8 +442,9 @@ void LLViewerShaderMgr::finalizeShaderList() mShaderList.push_back(&gDeferredWLSunProgram); mShaderList.push_back(&gDeferredPBRAlphaProgram); mShaderList.push_back(&gHUDPBRAlphaProgram); + mShaderList.push_back(&gDeferredPostTonemapProgram); + mShaderList.push_back(&gNoPostTonemapProgram); mShaderList.push_back(&gDeferredPostGammaCorrectProgram); // for gamma - mShaderList.push_back(&gNoPostGammaCorrectProgram); mShaderList.push_back(&gLegacyPostGammaCorrectProgram); mShaderList.push_back(&gDeferredDiffuseProgram); mShaderList.push_back(&gDeferredBumpProgram); @@ -608,6 +627,7 @@ void LLViewerShaderMgr::setShaders() LLError::setDefaultLevel(LLError::LEVEL_DEBUG); loadBasicShaders(); LLError::setDefaultLevel(lvl); + gGLManager.printGLInfoString(); LL_ERRS() << "Unable to load basic shader " << shader_name << ", verify graphics driver installed and current." << LL_ENDL; reentrance = false; // For hygiene only, re-try probably helps nothing return; @@ -762,6 +782,13 @@ std::string LLViewerShaderMgr::loadBasicShaders() attribs["MAX_JOINTS_PER_MESH_OBJECT"] = std::to_string(LLSkinningUtil::getMaxJointCount()); + LLCachedControl<bool> emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false); + + if (emissive) + { + attribs["HAS_EMISSIVE"] = "1"; + } + bool ssr = gSavedSettings.getBOOL("RenderScreenSpaceReflections"); bool mirrors = gSavedSettings.getBOOL("RenderMirrors"); @@ -842,6 +869,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mShaderLevel[SHADER_WATER] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "environment/srgbF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", 1) ); + index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/gbufferUtil.glsl", 1) ); index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/globalF.glsl", 1)); index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/shadowUtil.glsl", 1) ); index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/aoUtil.glsl", 1) ); @@ -1106,9 +1134,17 @@ bool LLViewerShaderMgr::loadShadersDeferred() gExposureProgramNoFade.unload(); gLuminanceProgram.unload(); gDeferredPostGammaCorrectProgram.unload(); - gNoPostGammaCorrectProgram.unload(); gLegacyPostGammaCorrectProgram.unload(); - gFXAAProgram.unload(); + gDeferredPostTonemapProgram.unload(); + gNoPostTonemapProgram.unload(); + for (auto i = 0; i < 4; ++i) + { + gFXAAProgram[i].unload(); + gSMAAEdgeDetectProgram[i].unload(); + gSMAABlendWeightsProgram[i].unload(); + gSMAANeighborhoodBlendProgram[i].unload(); + } + gCASProgram.unload(); gEnvironmentMapProgram.unload(); gDeferredWLSkyProgram.unload(); gDeferredWLCloudProgram.unload(); @@ -1157,6 +1193,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER)); gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER)); gDeferredHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE]; + add_common_permutations(&gDeferredHighlightProgram); success = gDeferredHighlightProgram.createShader(); } @@ -1169,6 +1206,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER)); gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredDiffuseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredDiffuseProgram); success = make_rigged_variant(gDeferredDiffuseProgram, gDeferredSkinnedDiffuseProgram); success = success && gDeferredDiffuseProgram.createShader(); } @@ -1181,6 +1219,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER)); gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredDiffuseAlphaMaskProgram); success = make_rigged_variant(gDeferredDiffuseAlphaMaskProgram, gDeferredSkinnedDiffuseAlphaMaskProgram); success = success && gDeferredDiffuseAlphaMaskProgram.createShader(); } @@ -1192,6 +1231,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER)); gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskF.glsl", GL_FRAGMENT_SHADER)); gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredNonIndexedDiffuseAlphaMaskProgram); success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(); llassert(success); } @@ -1203,6 +1243,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER)); gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER)); gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram); success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(); llassert(success); } @@ -1214,6 +1255,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpV.glsl", GL_VERTEX_SHADER)); gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpF.glsl", GL_FRAGMENT_SHADER)); gDeferredBumpProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredBumpProgram); success = make_rigged_variant(gDeferredBumpProgram, gDeferredSkinnedBumpProgram); success = success && gDeferredBumpProgram.createShader(); llassert(success); @@ -1279,6 +1321,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredMaterialProgram[i].addPermutation("HAS_SUN_SHADOW", "1"); } + add_common_permutations(&gDeferredMaterialProgram[i]); gDeferredMaterialProgram[i].mFeatures.hasSrgb = true; gDeferredMaterialProgram[i].mFeatures.calculatesAtmospherics = true; @@ -1322,6 +1365,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredPBROpaqueProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredPBROpaqueProgram.clearPermutations(); + add_common_permutations(&gDeferredPBROpaqueProgram); + success = make_rigged_variant(gDeferredPBROpaqueProgram, gDeferredSkinnedPBROpaqueProgram); if (success) { @@ -1343,6 +1388,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gGLTFPBRMetallicRoughnessProgram.clearPermutations(); + add_common_permutations(&gGLTFPBRMetallicRoughnessProgram); + success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow); //llassert(success); @@ -1365,6 +1412,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gPBRGlowProgram.mShaderFiles.push_back(make_pair("deferred/pbrglowF.glsl", GL_FRAGMENT_SHADER)); gPBRGlowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gPBRGlowProgram); + success = make_rigged_variant(gPBRGlowProgram, gPBRGlowSkinnedProgram); if (success) { @@ -1384,13 +1433,13 @@ bool LLViewerShaderMgr::loadShadersDeferred() gHUDPBROpaqueProgram.clearPermutations(); gHUDPBROpaqueProgram.addPermutation("IS_HUD", "1"); + add_common_permutations(&gHUDPBROpaqueProgram); + success = gHUDPBROpaqueProgram.createShader(); llassert(success); } - - if (success) { LLGLSLShader* shader = &gDeferredPBRAlphaProgram; @@ -1420,6 +1469,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("HAS_EMISSIVE_MAP", "1"); shader->addPermutation("USE_VERTEX_COLOR", "1"); + add_common_permutations(shader); + if (use_sun_shadow) { shader->addPermutation("HAS_SUN_SHADOW", "1"); @@ -1457,6 +1508,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("IS_HUD", "1"); + add_common_permutations(shader); + shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = shader->createShader(); llassert(success); @@ -1489,6 +1542,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("TERRAIN_PBR_DETAIL", llformat("%d", detail)); shader->addPermutation("TERRAIN_PAINT_TYPE", llformat("%d", paint_type)); shader->addPermutation("TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT", llformat("%d", mapping)); + + add_common_permutations(shader); + success = success && shader->createShader(); llassert(success); } @@ -1501,6 +1557,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeV.glsl", GL_VERTEX_SHADER)); gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeF.glsl", GL_FRAGMENT_SHADER)); gDeferredTreeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredTreeProgram); + success = gDeferredTreeProgram.createShader(); } @@ -1536,6 +1595,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorV.glsl", GL_VERTEX_SHADER)); gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorF.glsl", GL_FRAGMENT_SHADER)); gDeferredImpostorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredImpostorProgram); + success = gDeferredImpostorProgram.createShader(); llassert(success); } @@ -1544,6 +1606,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() { gDeferredLightProgram.mName = "Deferred Light Shader"; gDeferredLightProgram.mFeatures.isDeferred = true; + gDeferredLightProgram.mFeatures.hasFullGBuffer = true; gDeferredLightProgram.mFeatures.hasShadows = true; gDeferredLightProgram.mFeatures.hasSrgb = true; @@ -1554,6 +1617,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredLightProgram.clearPermutations(); + add_common_permutations(&gDeferredLightProgram); + success = gDeferredLightProgram.createShader(); llassert(success); } @@ -1564,6 +1629,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() { gDeferredMultiLightProgram[i].mName = llformat("Deferred MultiLight Shader %d", i); gDeferredMultiLightProgram[i].mFeatures.isDeferred = true; + gDeferredMultiLightProgram[i].mFeatures.hasFullGBuffer = true; gDeferredMultiLightProgram[i].mFeatures.hasShadows = true; gDeferredMultiLightProgram[i].mFeatures.hasSrgb = true; @@ -1574,6 +1640,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredMultiLightProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1)); + add_common_permutations(&gDeferredMultiLightProgram[i]); + success = gDeferredMultiLightProgram[i].createShader(); llassert(success); } @@ -1585,6 +1653,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredSpotLightProgram.mShaderFiles.clear(); gDeferredSpotLightProgram.mFeatures.hasSrgb = true; gDeferredSpotLightProgram.mFeatures.isDeferred = true; + gDeferredSpotLightProgram.mFeatures.hasFullGBuffer = true; gDeferredSpotLightProgram.mFeatures.hasShadows = true; gDeferredSpotLightProgram.clearPermutations(); @@ -1592,6 +1661,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER)); gDeferredSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredSpotLightProgram); + success = gDeferredSpotLightProgram.createShader(); llassert(success); } @@ -1601,6 +1672,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader"; gDeferredMultiSpotLightProgram.mFeatures.hasSrgb = true; gDeferredMultiSpotLightProgram.mFeatures.isDeferred = true; + gDeferredMultiSpotLightProgram.mFeatures.hasFullGBuffer = true; gDeferredMultiSpotLightProgram.mFeatures.hasShadows = true; gDeferredMultiSpotLightProgram.clearPermutations(); @@ -1610,6 +1682,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER)); gDeferredMultiSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredMultiSpotLightProgram); + success = gDeferredMultiSpotLightProgram.createShader(); llassert(success); } @@ -1617,10 +1691,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() if (success) { std::string fragment; - std::string vertex = "deferred/sunLightV.glsl"; - bool use_ao = gSavedSettings.getBOOL("RenderDeferredSSAO"); - if (use_ao) { fragment = "deferred/sunLightSSAOF.glsl"; @@ -1628,10 +1699,6 @@ bool LLViewerShaderMgr::loadShadersDeferred() else { fragment = "deferred/sunLightF.glsl"; - if (mShaderLevel[SHADER_DEFERRED] == 1) - { //no shadows, no SSAO, no frag coord - vertex = "deferred/sunLightNoFragCoordV.glsl"; - } } gDeferredSunProgram.mName = "Deferred Sun Shader"; @@ -1640,16 +1707,35 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredSunProgram.mFeatures.hasAmbientOcclusion = use_ao; gDeferredSunProgram.mShaderFiles.clear(); - gDeferredSunProgram.mShaderFiles.push_back(make_pair(vertex, GL_VERTEX_SHADER)); + gDeferredSunProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER)); gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER)); gDeferredSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredSunProgram); + success = gDeferredSunProgram.createShader(); llassert(success); } if (success) { + gDeferredSunProbeProgram.mName = "Deferred Sun Probe Shader"; + gDeferredSunProbeProgram.mFeatures.isDeferred = true; + gDeferredSunProbeProgram.mFeatures.hasShadows = true; + + gDeferredSunProbeProgram.mShaderFiles.clear(); + gDeferredSunProbeProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER)); + gDeferredSunProbeProgram.mShaderFiles.push_back(make_pair("deferred/sunLightF.glsl", GL_FRAGMENT_SHADER)); + gDeferredSunProbeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredSunProbeProgram); + + success = gDeferredSunProbeProgram.createShader(); + llassert(success); + } + + if (success) + { gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader"; gDeferredBlurLightProgram.mFeatures.isDeferred = true; @@ -1658,6 +1744,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER)); gDeferredBlurLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredBlurLightProgram); + success = gDeferredBlurLightProgram.createShader(); llassert(success); } @@ -1712,6 +1800,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("HAS_SUN_SHADOW", "1"); } + add_common_permutations(shader); + if (rigged) { shader->addPermutation("HAS_SKIN", "1"); @@ -1777,6 +1867,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("HAS_SUN_SHADOW", "1"); } + add_common_permutations(shader); + shader->mRiggedVariant = &gDeferredSkinnedAlphaImpostorProgram; shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; if (!rigged) @@ -1805,6 +1897,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER)); gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER)); gDeferredAvatarEyesProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredAvatarEyesProgram); + success = gDeferredAvatarEyesProgram.createShader(); llassert(success); } @@ -1821,6 +1916,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER)); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER)); gDeferredFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredFullbrightProgram); + success = make_rigged_variant(gDeferredFullbrightProgram, gDeferredSkinnedFullbrightProgram); success = gDeferredFullbrightProgram.createShader(); llassert(success); @@ -1840,6 +1938,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gHUDFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gHUDFullbrightProgram.clearPermutations(); gHUDFullbrightProgram.addPermutation("IS_HUD", "1"); + + add_common_permutations(&gHUDFullbrightProgram); + success = gHUDFullbrightProgram.createShader(); llassert(success); } @@ -1858,6 +1959,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightAlphaMaskProgram.clearPermutations(); gDeferredFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK","1"); gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredFullbrightAlphaMaskProgram); + success = make_rigged_variant(gDeferredFullbrightAlphaMaskProgram, gDeferredSkinnedFullbrightAlphaMaskProgram); success = success && gDeferredFullbrightAlphaMaskProgram.createShader(); llassert(success); @@ -1877,6 +1981,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gHUDFullbrightAlphaMaskProgram.clearPermutations(); gHUDFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK", "1"); gHUDFullbrightAlphaMaskProgram.addPermutation("IS_HUD", "1"); + + add_common_permutations(&gHUDFullbrightAlphaMaskProgram); + gHUDFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = gHUDFullbrightAlphaMaskProgram.createShader(); llassert(success); @@ -1897,6 +2004,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightAlphaMaskAlphaProgram.clearPermutations(); gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("HAS_ALPHA_MASK", "1"); gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1"); + + add_common_permutations(&gDeferredFullbrightAlphaMaskAlphaProgram); + gDeferredFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredFullbrightAlphaMaskAlphaProgram, gDeferredSkinnedFullbrightAlphaMaskAlphaProgram); success = success && gDeferredFullbrightAlphaMaskAlphaProgram.createShader(); @@ -1919,6 +2029,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("HAS_ALPHA_MASK", "1"); gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1"); gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_HUD", "1"); + + add_common_permutations(&gHUDFullbrightAlphaMaskAlphaProgram); + gHUDFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = success && gHUDFullbrightAlphaMaskAlphaProgram.createShader(); llassert(success); @@ -1937,6 +2050,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER)); gDeferredFullbrightShinyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredFullbrightShinyProgram.mFeatures.hasReflectionProbes = true; + + add_common_permutations(&gDeferredFullbrightShinyProgram); + success = make_rigged_variant(gDeferredFullbrightShinyProgram, gDeferredSkinnedFullbrightShinyProgram); success = success && gDeferredFullbrightShinyProgram.createShader(); llassert(success); @@ -1957,6 +2073,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gHUDFullbrightShinyProgram.mFeatures.hasReflectionProbes = true; gHUDFullbrightShinyProgram.clearPermutations(); gHUDFullbrightShinyProgram.addPermutation("IS_HUD", "1"); + + add_common_permutations(&gHUDFullbrightShinyProgram); + success = gHUDFullbrightShinyProgram.createShader(); llassert(success); } @@ -1972,6 +2091,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER)); gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER)); gDeferredEmissiveProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredEmissiveProgram); + success = make_rigged_variant(gDeferredEmissiveProgram, gDeferredSkinnedEmissiveProgram); success = success && gDeferredEmissiveProgram.createShader(); llassert(success); @@ -1986,10 +2108,12 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredSoftenProgram.mFeatures.hasAtmospherics = true; gDeferredSoftenProgram.mFeatures.hasGamma = true; gDeferredSoftenProgram.mFeatures.isDeferred = true; + gDeferredSoftenProgram.mFeatures.hasFullGBuffer = true; gDeferredSoftenProgram.mFeatures.hasShadows = use_sun_shadow; gDeferredSoftenProgram.mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED] > 2; gDeferredSoftenProgram.clearPermutations(); + add_common_permutations(&gDeferredSoftenProgram); gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER)); gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER)); @@ -2026,6 +2150,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gHazeProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER)); gHazeProgram.mShaderFiles.push_back(make_pair("deferred/hazeF.glsl", GL_FRAGMENT_SHADER)); + add_common_permutations(&gHazeProgram); + gHazeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = gHazeProgram.createShader(); @@ -2050,6 +2176,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gHazeWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterHazeV.glsl", GL_VERTEX_SHADER)); gHazeWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterHazeF.glsl", GL_FRAGMENT_SHADER)); + add_common_permutations(&gHazeWaterProgram); + gHazeWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = gHazeWaterProgram.createShader(); @@ -2079,6 +2207,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowSkinnedV.glsl", GL_VERTEX_SHADER)); gDeferredSkinnedShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER)); gDeferredSkinnedShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredSkinnedShadowProgram); + // gDeferredSkinnedShadowProgram.addPermutation("DEPTH_CLAMP", "1"); // disable depth clamp for now success = gDeferredSkinnedShadowProgram.createShader(); llassert(success); @@ -2110,6 +2241,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowFullbrightAlphaMaskProgram.clearPermutations(); gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("DEPTH_CLAMP", "1"); gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("IS_FULLBRIGHT", "1"); + + add_common_permutations(&gDeferredShadowFullbrightAlphaMaskProgram); + gDeferredShadowFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = make_rigged_variant(gDeferredShadowFullbrightAlphaMaskProgram, gDeferredSkinnedShadowFullbrightAlphaMaskProgram); success = success && gDeferredShadowFullbrightAlphaMaskProgram.createShader(); @@ -2139,6 +2273,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowGLTFAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/pbrShadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER)); gDeferredShadowGLTFAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredShadowGLTFAlphaMaskProgram.clearPermutations(); + + add_common_permutations(&gDeferredShadowGLTFAlphaMaskProgram); + success = make_rigged_variant(gDeferredShadowGLTFAlphaMaskProgram, gDeferredSkinnedShadowGLTFAlphaMaskProgram); success = success && gDeferredShadowGLTFAlphaMaskProgram.createShader(); llassert(success); @@ -2152,6 +2289,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowGLTFAlphaBlendProgram.mShaderFiles.push_back(make_pair("deferred/pbrShadowAlphaBlendF.glsl", GL_FRAGMENT_SHADER)); gDeferredShadowGLTFAlphaBlendProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredShadowGLTFAlphaBlendProgram.clearPermutations(); + + add_common_permutations(&gDeferredShadowGLTFAlphaBlendProgram); + success = make_rigged_variant(gDeferredShadowGLTFAlphaBlendProgram, gDeferredSkinnedShadowGLTFAlphaBlendProgram); success = success && gDeferredShadowGLTFAlphaBlendProgram.createShader(); llassert(success); @@ -2205,6 +2345,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredTerrainProgram.mShaderFiles.clear(); gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER)); gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER)); + + add_common_permutations(&gDeferredTerrainProgram); + gDeferredTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; success = gDeferredTerrainProgram.createShader(); llassert(success); @@ -2218,6 +2361,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER)); gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER)); gDeferredAvatarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredAvatarProgram); + success = gDeferredAvatarProgram.createShader(); llassert(success); } @@ -2251,6 +2397,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredAvatarAlphaProgram); + success = gDeferredAvatarAlphaProgram.createShader(); llassert(success); @@ -2315,21 +2463,6 @@ bool LLViewerShaderMgr::loadShadersDeferred() if (success) { - gNoPostGammaCorrectProgram.mName = "No Post Gamma Correction Post Process"; - gNoPostGammaCorrectProgram.mFeatures.hasSrgb = true; - gNoPostGammaCorrectProgram.mFeatures.isDeferred = true; - gNoPostGammaCorrectProgram.mShaderFiles.clear(); - gNoPostGammaCorrectProgram.clearPermutations(); - gNoPostGammaCorrectProgram.addPermutation("NO_POST", "1"); - gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); - gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER)); - gNoPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gNoPostGammaCorrectProgram.createShader(); - llassert(success); - } - - if (success) - { gLegacyPostGammaCorrectProgram.mName = "Legacy Gamma Correction Post Process"; gLegacyPostGammaCorrectProgram.mFeatures.hasSrgb = true; gLegacyPostGammaCorrectProgram.mFeatures.isDeferred = true; @@ -2343,19 +2476,163 @@ bool LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success) + { + gDeferredPostTonemapProgram.mName = "Deferred Tonemap Post Process"; + gDeferredPostTonemapProgram.mFeatures.hasSrgb = true; + gDeferredPostTonemapProgram.mFeatures.isDeferred = true; + gDeferredPostTonemapProgram.mShaderFiles.clear(); + gDeferredPostTonemapProgram.clearPermutations(); + gDeferredPostTonemapProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); + gDeferredPostTonemapProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredTonemap.glsl", GL_FRAGMENT_SHADER)); + gDeferredPostTonemapProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gDeferredPostTonemapProgram.createShader(); + llassert(success); + } - if (success && gGLManager.mGLVersion > 3.9f) + if (success) { - gFXAAProgram.mName = "FXAA Shader"; - gFXAAProgram.mFeatures.isDeferred = true; - gFXAAProgram.mShaderFiles.clear(); - gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER)); - gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER)); - gFXAAProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gFXAAProgram.createShader(); + gNoPostTonemapProgram.mName = "No Post Tonemap Post Process"; + gNoPostTonemapProgram.mFeatures.hasSrgb = true; + gNoPostTonemapProgram.mFeatures.isDeferred = true; + gNoPostTonemapProgram.mShaderFiles.clear(); + gNoPostTonemapProgram.clearPermutations(); + gNoPostTonemapProgram.addPermutation("NO_POST", "1"); + gNoPostTonemapProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); + gNoPostTonemapProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredTonemap.glsl", GL_FRAGMENT_SHADER)); + gNoPostTonemapProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gNoPostTonemapProgram.createShader(); llassert(success); } + if (success && gGLManager.mGLVersion > 3.9f) + { + std::vector<std::pair<std::string, std::string>> quality_levels = { {"12", "Low"}, + {"23", "Medium"}, + {"28", "High"}, + {"39", "Ultra"} }; + int i = 0; + for (const auto& quality_pair : quality_levels) + { + if (success) + { + gFXAAProgram[i].mName = llformat("FXAA Shader (%s)", quality_pair.second.c_str()); + gFXAAProgram[i].mFeatures.isDeferred = true; + gFXAAProgram[i].mShaderFiles.clear(); + gFXAAProgram[i].mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER)); + gFXAAProgram[i].mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER)); + + gFXAAProgram[i].clearPermutations(); + gFXAAProgram[i].addPermutation("FXAA_QUALITY__PRESET", quality_pair.first); + if (gGLManager.mGLVersion > 3.9) + { + gFXAAProgram[i].addPermutation("FXAA_GLSL_400", "1"); + } + else + { + gFXAAProgram[i].addPermutation("FXAA_GLSL_130", "1"); + } + + gFXAAProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gFXAAProgram[i].createShader(); + llassert(success); + } + ++i; + } + } + + if (gGLManager.mGLVersion > 3.15f && success) + { + 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"} }; + int i = 0; + for (const auto& smaa_pair : quality_levels) + { + std::map<std::string, std::string> defines; + if (gGLManager.mGLVersion >= 4.f) + defines.emplace("SMAA_GLSL_4", "1"); + else if (gGLManager.mGLVersion >= 3.1f) + defines.emplace("SMAA_GLSL_3", "1"); + else + defines.emplace("SMAA_GLSL_2", "1"); + defines.emplace("SMAA_PREDICATION", "0"); + defines.emplace("SMAA_REPROJECTION", "0"); + defines.emplace(smaa_pair.first, "1"); + + if (success) + { + gSMAAEdgeDetectProgram[i].mName = llformat("SMAA Edge Detection (%s)", smaa_pair.second.c_str()); + gSMAAEdgeDetectProgram[i].mFeatures.isDeferred = true; + + gSMAAEdgeDetectProgram[i].clearPermutations(); + gSMAAEdgeDetectProgram[i].addPermutations(defines); + + gSMAAEdgeDetectProgram[i].mShaderFiles.clear(); + gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAAEdgeDetectF.glsl", GL_FRAGMENT_SHADER_ARB)); + gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAAEdgeDetectV.glsl", GL_VERTEX_SHADER_ARB)); + gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_FRAGMENT_SHADER_ARB)); + gSMAAEdgeDetectProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB)); + gSMAAEdgeDetectProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gSMAAEdgeDetectProgram[i].createShader(); + } + + if (success) + { + gSMAABlendWeightsProgram[i].mName = llformat("SMAA Blending Weights (%s)", smaa_pair.second.c_str()); + gSMAABlendWeightsProgram[i].mFeatures.isDeferred = true; + + gSMAABlendWeightsProgram[i].clearPermutations(); + gSMAABlendWeightsProgram[i].addPermutations(defines); + + gSMAABlendWeightsProgram[i].mShaderFiles.clear(); + gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAABlendWeightsF.glsl", GL_FRAGMENT_SHADER_ARB)); + gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAABlendWeightsV.glsl", GL_VERTEX_SHADER_ARB)); + gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_FRAGMENT_SHADER_ARB)); + gSMAABlendWeightsProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB)); + gSMAABlendWeightsProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gSMAABlendWeightsProgram[i].createShader(); + } + + if (success) + { + gSMAANeighborhoodBlendProgram[i].mName = llformat("SMAA Neighborhood Blending (%s)", smaa_pair.second.c_str()); + gSMAANeighborhoodBlendProgram[i].mFeatures.isDeferred = true; + + gSMAANeighborhoodBlendProgram[i].clearPermutations(); + gSMAANeighborhoodBlendProgram[i].addPermutations(defines); + + gSMAANeighborhoodBlendProgram[i].mShaderFiles.clear(); + gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAANeighborhoodBlendF.glsl", GL_FRAGMENT_SHADER_ARB)); + gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAANeighborhoodBlendV.glsl", GL_VERTEX_SHADER_ARB)); + gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_FRAGMENT_SHADER_ARB)); + gSMAANeighborhoodBlendProgram[i].mShaderFiles.push_back(make_pair("deferred/SMAA.glsl", GL_VERTEX_SHADER_ARB)); + gSMAANeighborhoodBlendProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gSMAANeighborhoodBlendProgram[i].createShader(); + } + ++i; + } + } + + if (success && gGLManager.mGLVersion > 4.05f) + { + gCASProgram.mName = "Contrast Adaptive Sharpening Shader"; + gCASProgram.mFeatures.hasSrgb = true; + gCASProgram.mShaderFiles.clear(); + gCASProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); + gCASProgram.mShaderFiles.push_back(make_pair("deferred/CASF.glsl", GL_FRAGMENT_SHADER)); + gCASProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gCASProgram.createShader(); + // llassert(success); + if (!success) + { + LL_WARNS() << "Failed to create shader '" << gCASProgram.mName << "', disabling!" << LL_ENDL; + // continue as if this shader never happened + success = true; + } + } + if (success) { gDeferredPostProgram.mName = "Deferred Post Shader"; @@ -2406,6 +2683,22 @@ bool LLViewerShaderMgr::loadShadersDeferred() if (success) { + gDeferredPostNoDoFNoiseProgram.mName = "Deferred Post NoDoF Noise Shader"; + gDeferredPostNoDoFNoiseProgram.mFeatures.isDeferred = true; + gDeferredPostNoDoFNoiseProgram.mShaderFiles.clear(); + gDeferredPostNoDoFNoiseProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); + gDeferredPostNoDoFNoiseProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER)); + + gDeferredPostNoDoFNoiseProgram.clearPermutations(); + gDeferredPostNoDoFNoiseProgram.addPermutation("HAS_NOISE", "1"); + + gDeferredPostNoDoFNoiseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gDeferredPostNoDoFNoiseProgram.createShader(); + llassert(success); + } + + if (success) + { gEnvironmentMapProgram.mName = "Environment Map Program"; gEnvironmentMapProgram.mShaderFiles.clear(); gEnvironmentMapProgram.mFeatures.calculatesAtmospherics = true; @@ -2415,6 +2708,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gEnvironmentMapProgram.clearPermutations(); gEnvironmentMapProgram.addPermutation("HAS_HDRI", "1"); + add_common_permutations(&gEnvironmentMapProgram); gEnvironmentMapProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER)); gEnvironmentMapProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER)); gEnvironmentMapProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; @@ -2438,6 +2732,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; + add_common_permutations(&gDeferredWLSkyProgram); + success = gDeferredWLSkyProgram.createShader(); llassert(success); } @@ -2456,6 +2752,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; gDeferredWLCloudProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 + + add_common_permutations(&gDeferredWLCloudProgram); + success = gDeferredWLCloudProgram.createShader(); llassert(success); } @@ -2473,6 +2772,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSunProgram.mShaderFiles.push_back(make_pair("deferred/sunDiscF.glsl", GL_FRAGMENT_SHADER)); gDeferredWLSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLSunProgram.mShaderGroup = LLGLSLShader::SG_SKY; + + add_common_permutations(&gDeferredWLSunProgram); + success = gDeferredWLSunProgram.createShader(); llassert(success); } @@ -2492,6 +2794,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredWLMoonProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY; gDeferredWLMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113 + + add_common_permutations(&gDeferredWLMoonProgram); + success = gDeferredWLMoonProgram.createShader(); llassert(success); } @@ -2505,6 +2810,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredStarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY; gDeferredStarProgram.addConstant( LLGLSLShader::SHADER_CONST_STAR_DEPTH ); // SL-14113 + + add_common_permutations(&gDeferredWLSkyProgram); + success = gDeferredStarProgram.createShader(); llassert(success); } @@ -2547,6 +2855,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredVisualizeBuffers.glsl", GL_FRAGMENT_SHADER)); gDeferredBufferVisualProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + add_common_permutations(&gDeferredBufferVisualProgram); + success = gDeferredBufferVisualProgram.createShader(); } |