summaryrefslogtreecommitdiff
path: root/indra/newview/llviewershadermgr.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2024-05-29 16:56:39 -0500
committerGitHub <noreply@github.com>2024-05-29 16:56:39 -0500
commit15fd13f83036ff781160957a21bb2d59771044bc (patch)
tree984601482bc6d7384796123bce39b7e50074ec5a /indra/newview/llviewershadermgr.cpp
parent2d0fe5ca7bf3bda62bf10a37a65f5859e6d1b095 (diff)
#1530 Increase joint limit for GLTF Assets (#1582)
* Migrate GLTF scene rendering to its own shaders * Add support for ambient occlusion map separate from metallic roughness map (or absent) * Use UBO's for GLTF joints * Better error handling of downloading GLTF assets
Diffstat (limited to 'indra/newview/llviewershadermgr.cpp')
-rw-r--r--indra/newview/llviewershadermgr.cpp48
1 files changed, 39 insertions, 9 deletions
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 0ca05b3460..e53e90b703 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -249,7 +249,7 @@ static bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader
}
-static bool make_gltf_variant(LLGLSLShader& shader, LLGLSLShader& variant, bool alpha_blend, bool rigged)
+static bool make_gltf_variant(LLGLSLShader& shader, LLGLSLShader& variant, bool alpha_blend, bool rigged, bool use_sun_shadow)
{
variant.mName = shader.mName.c_str();
variant.mFeatures = shader.mFeatures;
@@ -259,20 +259,50 @@ static bool make_gltf_variant(LLGLSLShader& shader, LLGLSLShader& variant, bool
variant.mDefines = shader.mDefines; // NOTE: Must come before addPermutation
+ variant.addPermutation("MAX_JOINTS_PER_GLTF_OBJECT", std::to_string(LLSkinningUtil::getMaxGLTFJointCount()));
+
+ if (rigged)
+ {
+ variant.addPermutation("HAS_SKIN", "1");
+ }
+
if (alpha_blend)
{
variant.addPermutation("ALPHA_BLEND", "1");
+
+ variant.mFeatures.calculatesLighting = false;
+ variant.mFeatures.hasLighting = false;
+ variant.mFeatures.isAlphaLighting = true;
+ variant.mFeatures.hasSrgb = true;
+ variant.mFeatures.calculatesAtmospherics = true;
+ variant.mFeatures.hasAtmospherics = true;
+ variant.mFeatures.hasGamma = true;
+ variant.mFeatures.hasShadows = use_sun_shadow;
+ variant.mFeatures.isDeferred = true; // include deferredUtils
+ variant.mFeatures.hasReflectionProbes = true;
+
+ if (use_sun_shadow)
+ {
+ variant.addPermutation("HAS_SUN_SHADOW", "1");
+ }
+
+ bool success = variant.createShader(NULL, NULL);
+ llassert(success);
+
+ // Alpha Shader Hack
+ // See: LLRender::syncMatrices()
+ variant.mFeatures.calculatesLighting = true;
+ variant.mFeatures.hasLighting = true;
+
+ return success;
}
- if (rigged)
+ else
{
- variant.addPermutation("HAS_SKIN", "1");
- variant.mFeatures.hasObjectSkinning = true;
+ return variant.createShader(NULL, NULL);
}
-
- return variant.createShader(NULL, NULL);
}
-static bool make_gltf_variants(LLGLSLShader& shader)
+static bool make_gltf_variants(LLGLSLShader& shader, bool use_sun_shadow)
{
shader.mFeatures.mGLTF = true;
shader.mGLTFVariants.resize(LLGLSLShader::NUM_GLTF_VARIANTS);
@@ -282,7 +312,7 @@ static bool make_gltf_variants(LLGLSLShader& shader)
bool alpha_blend = i & 1;
bool rigged = i & 2;
- if (!make_gltf_variant(shader, shader.mGLTFVariants[i], alpha_blend, rigged))
+ if (!make_gltf_variant(shader, shader.mGLTFVariants[i], alpha_blend, rigged, use_sun_shadow))
{
return false;
}
@@ -1269,7 +1299,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gGLTFPBRMetallicRoughnessProgram.clearPermutations();
- success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram);
+ success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);
llassert(success);
}