[clang] [llvm] [HLSL][DXIL] Implement `refract` intrinsic (PR #147342)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 07:54:02 PDT 2025


================
@@ -71,6 +71,17 @@ constexpr vector<T, L> reflect_vec_impl(vector<T, L> I, vector<T, L> N) {
 #endif
 }
 
+template <typename T, typename U> constexpr T refract_impl(T I, T N, U Eta) {
+#if (__has_builtin(__builtin_spirv_refract))
+  if (is_vector<T>::value)
----------------
farzonl wrote:

It looks like SPIRV refract does support scalars so you can remove this vector check if statement.
https://godbolt.org/z/ssEh5Mneb
Just please confirm that this still passes through  `spirv-val`

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


More information about the llvm-commits mailing list