Bug Report
Description
The DirectBRDFSpecular function in Runtime/Shaders/Scene/URP/Lighting.hlsl has an FP16 overflow protection guard that only covers mobile and Switch platforms:
#if defined (SHADER_API_MOBILE) || defined (SHADER_API_SWITCH)
specularTerm = specularTerm - HALF_MIN;
specularTerm = clamp(specularTerm, 0.0, 100.0); // Prevent FP16 overflow on mobiles
#endif
This condition is incomplete — Linux using Vulkan (SHADER_API_VULKAN) or OpenGL Core (SHADER_API_GLCORE) is not covered, yet those backends also use true 16-bit half-precision types and are susceptible to the same FP16 overflow.
Steps to Reproduce
- Run Decentraland on Linux (Vulkan or OpenGL Core)
- Observe broken specular highlights / rendering artifacts in scenes
Expected Behavior
Specular term is clamped to [0, 100] on all platforms where half is a true 16-bit type, including Linux.
Actual Behavior
On Linux, the clamp is skipped, causing FP16 overflow and visual artifacts in the specular BRDF.
Fix
Expand the #if guard to include SHADER_API_VULKAN and SHADER_API_GLCORE, or remove the guard entirely and apply the clamp unconditionally (safe, since it's a no-op on 32-bit float platforms).
Reported via Slack by Esteban Ordano
Bug Report
Description
The
DirectBRDFSpecularfunction inRuntime/Shaders/Scene/URP/Lighting.hlslhas an FP16 overflow protection guard that only covers mobile and Switch platforms:This condition is incomplete — Linux using Vulkan (
SHADER_API_VULKAN) or OpenGL Core (SHADER_API_GLCORE) is not covered, yet those backends also use true 16-bit half-precision types and are susceptible to the same FP16 overflow.Steps to Reproduce
Expected Behavior
Specular term is clamped to
[0, 100]on all platforms wherehalfis a true 16-bit type, including Linux.Actual Behavior
On Linux, the clamp is skipped, causing FP16 overflow and visual artifacts in the specular BRDF.
Fix
Expand the
#ifguard to includeSHADER_API_VULKANandSHADER_API_GLCORE, or remove the guard entirely and apply the clamp unconditionally (safe, since it's a no-op on 32-bit float platforms).Reported via Slack by Esteban Ordano