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

Deric C. via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 3 15:15:34 PDT 2025


================
@@ -101,6 +101,16 @@ constexpr vector<T, N> smoothstep_vec_impl(vector<T, N> Min, vector<T, N> Max,
 #endif
 }
 
+template <typename T> constexpr vector<T, 4> lit_impl(T NDotL, T NDotH, T M) {
+  bool DiffuseCond = NDotL < 0;
+  T Diffuse = select<T>(DiffuseCond, 0, NDotL);
+  vector<T, 4> Result = {1, Diffuse, 0, 1};
+  bool SpecularCond = or (DiffuseCond, (NDotH < 0));
----------------
Icohedron wrote:

Oh wait. Add this above the line
```
// clang-format off
```

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


More information about the cfe-commits mailing list