[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 09:06:20 PDT 2025


================
@@ -280,6 +280,17 @@ constexpr bool4 isinf(double4 V) { return isinf((float4)V); }
 _DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp)
 _DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp)
 
+//===----------------------------------------------------------------------===//
+// lit builtins overloads
+//===----------------------------------------------------------------------===//
+
+template <typename T>
+const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value,
+                                   vector<T, 4>>
+lit(T NDotL, T NDotH, T M) {
+  return lit<float>((float)NDotL, (float)NDotH, (float)M);
----------------
farzonl wrote:

There are two for half and float. so there will be. this was just the compat overload. The supported overloads were type specialized. Anyways none of that is relevevant anymore. After our chat yesterday I have recommended to @kmpeng that we remove the templates and just do a half and float function overload in `hlsl_intrinsics.h` where the two template specialization functions are currently.

https://github.com/llvm/llvm-project/pull/134171


More information about the cfe-commits mailing list