diff options
author | Ptolemy <ptolemy@lindenlab.com> | 2022-09-09 03:28:12 -0700 |
---|---|---|
committer | Ptolemy <ptolemy@lindenlab.com> | 2022-09-09 03:28:12 -0700 |
commit | 049fc419d1d1f41ac05e424d599a89366cee7ca7 (patch) | |
tree | ea2f275d9f35346cac4e14f9e11ff954d6a9ce58 /indra/newview/llviewershadermgr.cpp | |
parent | a3dff0db26c5faa1613b29721498baf530f12fed (diff) |
SL-17701: PBR: WIP Alpha Blending
Diffstat (limited to 'indra/newview/llviewershadermgr.cpp')
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 0d9670d9ca..8ec51b3856 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -265,6 +265,7 @@ LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; LLGLSLShader gDeferredMaterialWaterProgram[LLMaterial::SHADER_COUNT*2]; LLGLSLShader gDeferredPBROpaqueProgram; LLGLSLShader gDeferredSkinnedPBROpaqueProgram; +LLGLSLShader gDeferredPBRAlphaProgram[2]; // not skinned, skinned //helper for making a rigged variant of a given shader bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader) @@ -1283,6 +1284,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredPBROpaqueProgram.unload(); gDeferredSkinnedPBROpaqueProgram.unload(); + gDeferredPBRAlphaProgram[0].unload(); + gDeferredPBRAlphaProgram[1].unload(); return TRUE; } @@ -1616,6 +1619,80 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() } llassert(success); } + + if (success) + { + for (int rigged = 0; rigged < 2 && success; ++rigged) + { + LLGLSLShader* shader = &gDeferredPBRAlphaProgram[rigged]; + shader->mName = rigged + ? "Skinned Deferred PBR Alpha Shader" + : "Deferred PBR Alpha Shader"; + shader->mRiggedVariant = rigged + ? &gDeferredPBRAlphaProgram[1] + : nullptr; + shader->mFeatures.hasObjectSkinning = (bool)rigged; + shader->mFeatures.calculatesLighting = false; + shader->mFeatures.hasLighting = false; + shader->mFeatures.isAlphaLighting = true; + shader->mFeatures.hasSrgb = true; + shader->mFeatures.encodesNormal = true; + shader->mFeatures.calculatesAtmospherics = true; + shader->mFeatures.hasAtmospherics = true; + shader->mFeatures.hasGamma = true; + shader->mFeatures.hasTransport = true; + shader->mFeatures.hasShadows = use_sun_shadow; + shader->mFeatures.isDeferred = true; // include deferredUtils + shader->mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED]; + + shader->mShaderFiles.clear(); + shader->mShaderFiles.push_back(make_pair("deferred/pbralphaV.glsl", GL_VERTEX_SHADER_ARB)); + shader->mShaderFiles.push_back(make_pair("deferred/pbralphaF.glsl", GL_FRAGMENT_SHADER_ARB)); + + shader->clearPermutations(); + + U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + shader->addPermutation("DIFFUSE_ALPHA_MODE", llformat("%d", alpha_mode)); + shader->addPermutation("HAS_NORMAL_MAP", "1"); + shader->addPermutation("HAS_SPECULAR_MAP", "1"); // PBR: Packed: Occlusion, Metal, Roughness + shader->addPermutation("HAS_EMISSIVE_MAP", "1"); + shader->addPermutation("USE_VERTEX_COLOR", "1"); + if (use_sun_shadow) + { + shader->addPermutation("HAS_SHADOW", "1"); + } + + if (ambient_kill) + { + shader->addPermutation("AMBIENT_KILL", "1"); + } + + if (sunlight_kill) + { + shader->addPermutation("SUNLIGHT_KILL", "1"); + } + + if (local_light_kill) + { + shader->addPermutation("LOCAL_LIGHT_KILL", "1"); + } + + if (rigged) + { + shader->addPermutation("HAS_SKIN", "1"); + } + + shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + + success = shader->createShader(NULL, NULL); + llassert(success); + + // Alpha Shader Hack + shader->mFeatures.calculatesLighting = true; + shader->mFeatures.hasLighting = true; + } + } + if (success) { |