You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[SPIR-V] lit computes specular as n_dot_h * m and fails for half #9123
The specular term is computed as n_dot_h * m instead of pow(n_dot_h, m). DXIL is correct.
The half overload fails to compile.
Repro
dxc -T cs_6_5 -E main -spirv repro.hlsl
RWStructuredBuffer<float4> Out : register(u0);
StructuredBuffer<float> In : register(t1);
[numthreads(1,1,1)]
voidmain() {
Out[0] = lit(In[0], In[1], In[2]);
}
Output contains OpFMul %float %n_dot_h %m instead of a Pow. For example, lit(0.5, 0.25, 2) returns (1, 0.5, 0.5, 1) instead of (1, 0.5, 0.0625, 1).
Replacing float with half and adding -enable-16bit-types fails with:
fatal error: generated SPIR-V is invalid: GLSL.std.450 FMax: expected types of all operands to be equal to Result Type
%34 = OpExtInst %float %1 FMax %float_0 %29
With constant half arguments (lit((half)0.25, (half)0.5, (half)3.0)), it fails with Internal compiler error: LLVM Assert.
changed the title [-][SPIR-V] lit intrinsic computes specular as n_dot_h * m and fails to compile for half[/-][+][SPIR-V] lit computes specular as n_dot_h * m and fails for half[/+]on Nov 13, 2026
Activity
[-][SPIR-V] lit intrinsic computes specular as n_dot_h * m and fails to compile for half[/-][+][SPIR-V] lit computes specular as n_dot_h * m and fails for half[/+]