Skip to content

Commit 199e75c

Browse files
jrs-unityEvergreen
authored andcommitted
UUM-48035: Fixed compiler error when using single precision caused from LightingSpecular
This PR fixes the compiler error, described in UUM-48035, when using `single` precision: ``` Shader error in 'Lights Receiver URP/LightsReceiver': Program 'frag', error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Incompatible min precision type for operand #3 of opcode #40 (counts are 1-based). Expected int or uint. at line 47 (on metal) ```
1 parent a22dba4 commit 199e75c

File tree

1 file changed

+2
-1
lines changed
  • Packages/com.unity.render-pipelines.universal/ShaderLibrary

1 file changed

+2
-1
lines changed

Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ half3 LightingSpecular(half3 lightColor, half3 lightDir, half3 normal, half3 vie
3737
float3 halfVec = SafeNormalize(float3(lightDir) + float3(viewDir));
3838
half NdotH = half(saturate(dot(normal, halfVec)));
3939
half modifier = pow(float(NdotH), float(smoothness)); // Half produces banding, need full precision
40-
half3 specularReflection = specular.rgb * modifier;
40+
// NOTE: In order to fix internal compiler error on mobile platforms, this needs to be float3
41+
float3 specularReflection = specular.rgb * modifier;
4142
return lightColor * specularReflection;
4243
}
4344

0 commit comments

Comments
 (0)