diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-11-26 12:05:25 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-11-26 12:05:25 +0800 |
commit | a40795bd6ffcfff71bead4869d79cf5a73d5a7af (patch) | |
tree | 6c4c1fbb421f737c0b62fcda51ca7ca0ce8294f4 /indra/newview/llviewershadermgr.cpp | |
parent | 30842e230e2b3d365e8415f0350f8d10ce8b0637 (diff) | |
parent | d65fb7cec8ce36ce7f6ff082f8d04bdd8bc0208c (diff) |
Merge remote-tracking branch 'secondlife/release/2024.09-ExtraFPS' into 2024.09-ExtraFPS
Diffstat (limited to 'indra/newview/llviewershadermgr.cpp')
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 146 |
1 files changed, 143 insertions, 3 deletions
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index cdebb08b18..83386eb1ec 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -256,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) { @@ -772,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"); @@ -852,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) ); @@ -1175,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(); } @@ -1187,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(); } @@ -1199,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(); } @@ -1210,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); } @@ -1221,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); } @@ -1232,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); @@ -1297,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; @@ -1340,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) { @@ -1361,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); @@ -1383,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) { @@ -1402,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; @@ -1438,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"); @@ -1475,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); @@ -1507,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); } @@ -1519,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(); } @@ -1554,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); } @@ -1562,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; @@ -1572,6 +1617,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredLightProgram.clearPermutations(); + add_common_permutations(&gDeferredLightProgram); + success = gDeferredLightProgram.createShader(); llassert(success); } @@ -1582,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; @@ -1592,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); } @@ -1603,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(); @@ -1610,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); } @@ -1619,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(); @@ -1628,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); } @@ -1655,6 +1711,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER)); gDeferredSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredSunProgram); + success = gDeferredSunProgram.createShader(); llassert(success); } @@ -1670,6 +1728,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() 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); } @@ -1684,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); } @@ -1738,6 +1800,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() shader->addPermutation("HAS_SUN_SHADOW", "1"); } + add_common_permutations(shader); + if (rigged) { shader->addPermutation("HAS_SKIN", "1"); @@ -1803,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) @@ -1831,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); } @@ -1847,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); @@ -1866,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); } @@ -1884,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); @@ -1903,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); @@ -1923,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(); @@ -1945,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); @@ -1963,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); @@ -1983,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); } @@ -1998,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); @@ -2012,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)); @@ -2052,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(); @@ -2076,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(); @@ -2105,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); @@ -2136,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(); @@ -2165,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); @@ -2178,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); @@ -2231,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); @@ -2244,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); } @@ -2277,6 +2397,8 @@ bool LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + add_common_permutations(&gDeferredAvatarAlphaProgram); + success = gDeferredAvatarAlphaProgram.createShader(); llassert(success); @@ -2419,7 +2541,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() } } - if (success) + if (gGLManager.mGLVersion > 3.15f && success) { std::vector<std::pair<std::string, std::string>> quality_levels = { {"SMAA_PRESET_LOW", "Low"}, {"SMAA_PRESET_MEDIUM", "Medium"}, @@ -2586,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]; @@ -2609,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); } @@ -2627,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); } @@ -2644,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); } @@ -2663,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); } @@ -2676,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); } @@ -2718,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(); } |