================ @@ -253,6 +253,37 @@ const inline float length(__detail::HLSL_FIXED_VECTOR<float, N> X) { return __detail::length_vec_impl(X); } +//===----------------------------------------------------------------------===// +// lit builtins +//===----------------------------------------------------------------------===// + +/// \fn vector<T, 4> lit(T NDotL, T NDotH, T M) +/// \brief Returns a lighting coefficient vector. +/// \param NDotL The dot product of the normalized surface normal and the +/// light vector. +/// \param NDotH The dot product of the half-angle vector and the surface +/// normal. +/// \param M A specular exponent. +/// +/// This function returns a lighting coefficient vector (ambient, diffuse, +/// specular, 1). + +template <typename T> +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) +const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value && ---------------- farzonl wrote:
> @farzonl The template is needed for the `__detail::is_arithmetic<T>` check > since `lit` is only supposed to accept scalars as inputs. Without the check, > it would allow types like float4 as input as it would be implicitly truncated > to a float. I understand that logic makes sense. That said i think the decision should fall to what DXC does. If DXC doesn’t implicit cast then i think we should aswell. https://github.com/llvm/llvm-project/pull/134171 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits