summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2023-10-13 10:43:18 -0700
committerCosmic Linden <cosmic@lindenlab.com>2023-10-13 10:43:18 -0700
commitcc0f831aaa960552b218da436da57b44cb2dfe0f (patch)
tree2f580ac1443f45a83b3792d339d60009c8a58084 /indra/newview
parent8d9933b37057a67652512d949cedb24b9b087810 (diff)
DRTVWR-592: Fix PBR terrain shader compile crash when emissive textures are disabled
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl8
-rw-r--r--indra/newview/llviewershadermgr.cpp2
2 files changed, 9 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
index 4bb9758224..db03e0885c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
@@ -258,9 +258,15 @@ void main()
tnorm *= gl_FrontFacing ? 1.0 : -1.0;
+
+#if (TERRAIN_PBR_DETAIL >= TERRAIN_PBR_DETAIL_EMISSIVE)
+#define emissive mix.emissive
+#else
+#define emissive vec3(0)
+#endif
frag_data[0] = max(vec4(mix.col.xyz, 0.0), vec4(0)); // Diffuse
frag_data[1] = max(vec4(mix.orm.rgb, base_color_factor_alpha), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
frag_data[2] = max(vec4(encode_normal(tnorm), base_color_factor_alpha, GBUFFER_FLAG_HAS_PBR), vec4(0)); // normal, environment intensity, flags
- frag_data[3] = max(vec4(mix.emissive,0), vec4(0)); // PBR sRGB Emissive
+ frag_data[3] = max(vec4(emissive,0), vec4(0)); // PBR sRGB Emissive
}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 5849f97e0e..d545ef97fd 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -695,6 +695,8 @@ std::string LLViewerShaderMgr::loadBasicShaders()
attribs["TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT"] = llformat("%d", mapping);
const F32 triplanar_factor = gSavedSettings.getF32("RenderTerrainPBRTriplanarBlendFactor");
attribs["TERRAIN_TRIPLANAR_BLEND_FACTOR"] = llformat("%.2f", triplanar_factor);
+ S32 detail = gSavedSettings.getS32("RenderTerrainPBRDetail");
+ attribs["TERRAIN_PBR_DETAIL"] = llformat("%d", detail);
}
LLGLSLShader::sGlobalDefines = attribs;