clang 22.0.0git
hlsl_intrinsics.h
Go to the documentation of this file.
1//===----- hlsl_intrinsics.h - HLSL definitions for intrinsics ----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _HLSL_HLSL_INTRINSICS_H_
10#define _HLSL_HLSL_INTRINSICS_H_
11
13
14namespace hlsl {
15
16//===----------------------------------------------------------------------===//
17// asfloat builtins
18//===----------------------------------------------------------------------===//
19
20/// \fn float asfloat(T Val)
21/// \brief Interprets the bit pattern of x as float point number.
22/// \param Val The input value.
23
24template <typename T, int N>
25constexpr vector<float, N> asfloat(vector<T, N> V) {
27}
28
29template <typename T> constexpr float asfloat(T F) {
31}
32
33//===----------------------------------------------------------------------===//
34// asint builtins
35//===----------------------------------------------------------------------===//
36
37/// \fn int asint(T Val)
38/// \brief Interprets the bit pattern of x as an integer.
39/// \param Val The input value.
40
41template <typename T, int N> constexpr vector<int, N> asint(vector<T, N> V) {
43}
44
45template <typename T> constexpr int asint(T F) {
47}
48
49//===----------------------------------------------------------------------===//
50// asint16 builtins
51//===----------------------------------------------------------------------===//
52
53/// \fn int16_t asint16(T X)
54/// \brief Interprets the bit pattern of \a X as an 16-bit integer.
55/// \param X The input value.
56
57#ifdef __HLSL_ENABLE_16_BIT
58
59template <typename T, int N>
60_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
61constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
62 __detail::is_same<uint16_t, T>::value ||
63 __detail::is_same<half, T>::value,
64 vector<int16_t, N>> asint16(vector<T, N> V) {
66}
67
68template <typename T>
69_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
70constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
71 __detail::is_same<uint16_t, T>::value ||
72 __detail::is_same<half, T>::value,
73 int16_t> asint16(T F) {
75}
76#endif
77
78//===----------------------------------------------------------------------===//
79// asuint builtins
80//===----------------------------------------------------------------------===//
81
82/// \fn uint asuint(T Val)
83/// \brief Interprets the bit pattern of x as an unsigned integer.
84/// \param Val The input value.
85
86template <typename T, int N> constexpr vector<uint, N> asuint(vector<T, N> V) {
88}
89
90template <typename T> constexpr uint asuint(T F) {
92}
93
94//===----------------------------------------------------------------------===//
95// asuint splitdouble builtins
96//===----------------------------------------------------------------------===//
97
98/// \fn void asuint(double D, out uint lowbits, out int highbits)
99/// \brief Split and interprets the lowbits and highbits of double D into uints.
100/// \param D The input double.
101/// \param lowbits The output lowbits of D.
102/// \param highbits The output highbits of D.
103_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_splitdouble)
104void asuint(double, out uint, out uint);
105_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_splitdouble)
106void asuint(double2, out uint2, out uint2);
107_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_splitdouble)
108void asuint(double3, out uint3, out uint3);
109_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_splitdouble)
110void asuint(double4, out uint4, out uint4);
111
112//===----------------------------------------------------------------------===//
113// asuint16 builtins
114//===----------------------------------------------------------------------===//
115
116/// \fn uint16_t asuint16(T X)
117/// \brief Interprets the bit pattern of \a X as an 16-bit unsigned integer.
118/// \param X The input value.
119
120#ifdef __HLSL_ENABLE_16_BIT
121
122template <typename T, int N>
123_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
124constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
125 __detail::is_same<uint16_t, T>::value ||
126 __detail::is_same<half, T>::value,
127 vector<uint16_t, N>> asuint16(vector<T, N> V) {
129}
130
131template <typename T>
132_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
133constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
134 __detail::is_same<uint16_t, T>::value ||
135 __detail::is_same<half, T>::value,
136 uint16_t> asuint16(T F) {
138}
139#endif
140
141//===----------------------------------------------------------------------===//
142// distance builtins
143//===----------------------------------------------------------------------===//
144
145/// \fn K distance(T X, T Y)
146/// \brief Returns a distance scalar between \a X and \a Y.
147/// \param X The X input value.
148/// \param Y The Y input value.
149
150template <typename T>
151_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
152const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
153 __detail::is_same<half, T>::value,
154 T> distance(T X, T Y) {
155 return __detail::distance_impl(X, Y);
156}
157
158template <typename T>
159const inline __detail::enable_if_t<
161distance(T X, T Y) {
162 return __detail::distance_impl(X, Y);
163}
164
165template <int N>
166_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
167const inline half distance(__detail::HLSL_FIXED_VECTOR<half, N> X,
168 __detail::HLSL_FIXED_VECTOR<half, N> Y) {
170}
171
172template <int N>
177
178//===----------------------------------------------------------------------===//
179// dot2add builtins
180//===----------------------------------------------------------------------===//
181
182/// \fn float dot2add(half2 A, half2 B, float C)
183/// \brief Dot product of 2 vector of type half and add a float scalar value.
184/// \param A The first input value to dot product.
185/// \param B The second input value to dot product.
186/// \param C The input value added to the dot product.
187
188_HLSL_AVAILABILITY(shadermodel, 6.4)
189const inline float dot2add(half2 A, half2 B, float C) {
190 return __detail::dot2add_impl(A, B, C);
191}
192
193//===----------------------------------------------------------------------===//
194// dst builtins
195//===----------------------------------------------------------------------===//
196
197/// \fn vector<T, 4> dst(vector<T, 4>, vector<T, 4>)
198/// \brief Calculates a distance vector.
199/// \param Src0 [in] Contains the squared distance
200/// \param Src1 [in] Contains the reciprocal distance
201///
202/// Return the computed distance vector
203
204_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
205const inline half4 dst(half4 Src0, half4 Src1) {
206 return __detail::dst_impl(Src0, Src1);
207}
208
209const inline float4 dst(float4 Src0, float4 Src1) {
210 return __detail::dst_impl(Src0, Src1);
211}
212
213const inline double4 dst(double4 Src0, double4 Src1) {
214 return __detail::dst_impl(Src0, Src1);
215}
216
217//===----------------------------------------------------------------------===//
218// faceforward builtin
219//===----------------------------------------------------------------------===//
220
221/// \fn T faceforward(T N, T I, T Ng)
222/// \brief Flips the surface-normal (if needed) to face in a direction opposite
223/// to \a I. Returns the result in terms of \a N.
224/// \param N The resulting floating-point surface-normal vector.
225/// \param I A floating-point, incident vector that points from the view
226/// position to the shading position.
227/// \param Ng A floating-point surface-normal vector.
228///
229/// Return a floating-point, surface normal vector that is facing the view
230/// direction.
231
232template <typename T>
233_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
234const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
235 __detail::is_same<half, T>::value,
236 T> faceforward(T N, T I, T Ng) {
237 return __detail::faceforward_impl(N, I, Ng);
238}
239
240template <typename T>
241const inline __detail::enable_if_t<
243faceforward(T N, T I, T Ng) {
244 return __detail::faceforward_impl(N, I, Ng);
245}
246
247template <int L>
248_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
249const inline __detail::HLSL_FIXED_VECTOR<half, L> faceforward(
250 __detail::HLSL_FIXED_VECTOR<half, L> N,
251 __detail::HLSL_FIXED_VECTOR<half, L> I,
252 __detail::HLSL_FIXED_VECTOR<half, L> Ng) {
253 return __detail::faceforward_impl(N, I, Ng);
254}
255
256template <int L>
263
264//===----------------------------------------------------------------------===//
265// firstbithigh builtins
266//===----------------------------------------------------------------------===//
267
268/// \fn T firstbithigh(T Val)
269/// \brief Returns the location of the first set bit starting from the lowest
270/// order bit and working upward, per component.
271/// \param Val the input value.
272
273#ifdef __HLSL_ENABLE_16_BIT
274
275template <typename T>
276_HLSL_AVAILABILITY(shadermodel, 6.2)
277const inline __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
278 __detail::is_same<uint16_t, T>::value,
279 uint> firstbithigh(T X) {
281}
282
283template <typename T, int N>
284_HLSL_AVAILABILITY(shadermodel, 6.2)
285const
286 inline __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
287 __detail::is_same<uint16_t, T>::value,
288 vector<uint, N>> firstbithigh(vector<T, N> X) {
289 return __detail::firstbithigh_impl<vector<uint, N>, vector<T, N>, 16>(X);
290}
291
292#endif
293
294template <typename T>
295const inline __detail::enable_if_t<
300
301template <typename T, int N>
302const inline __detail::enable_if_t<__detail::is_same<int, T>::value ||
304 vector<uint, N>>
305firstbithigh(vector<T, N> X) {
306 return __detail::firstbithigh_impl<vector<uint, N>, vector<T, N>, 32>(X);
307}
308
309template <typename T>
310const inline __detail::enable_if_t<__detail::is_same<int64_t, T>::value ||
312 uint>
316
317template <typename T, int N>
318const inline __detail::enable_if_t<__detail::is_same<int64_t, T>::value ||
320 vector<uint, N>>
321firstbithigh(vector<T, N> X) {
322 return __detail::firstbithigh_impl<vector<uint, N>, vector<T, N>, 64>(X);
323}
324
325//===----------------------------------------------------------------------===//
326// fmod builtins
327//===----------------------------------------------------------------------===//
328
329/// \fn T fmod(T x, T y)
330/// \brief Returns the linear interpolation of x to y.
331/// \param x [in] The dividend.
332/// \param y [in] The divisor.
333///
334/// Return the floating-point remainder of the x parameter divided by the y
335/// parameter.
336
337template <typename T>
338_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
339const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
340 __detail::is_same<half, T>::value,
341 T> fmod(T X, T Y) {
342 return __detail::fmod_impl(X, Y);
343}
344
345template <typename T>
346const inline __detail::enable_if_t<
348fmod(T X, T Y) {
349 return __detail::fmod_impl(X, Y);
350}
351
352template <int N>
353_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
354const inline __detail::HLSL_FIXED_VECTOR<half, N> fmod(
355 __detail::HLSL_FIXED_VECTOR<half, N> X,
356 __detail::HLSL_FIXED_VECTOR<half, N> Y) {
357 return __detail::fmod_vec_impl(X, Y);
358}
359
360template <int N>
366
367//===----------------------------------------------------------------------===//
368// ldexp builtins
369//===----------------------------------------------------------------------===//
370
371/// \fn T ldexp(T X, T Exp)
372/// \brief Returns the result of multiplying the specified value by two raised
373/// to the power of the specified exponent.
374/// \param X [in] The specified value.
375/// \param Exp [in] The specified exponent.
376///
377/// This function uses the following formula: X * 2^Exp
378
379template <typename T>
380_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
381const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
382 __detail::is_same<half, T>::value,
383 T> ldexp(T X, T Exp) {
384 return __detail::ldexp_impl(X, Exp);
385}
386
387template <typename T>
388const inline __detail::enable_if_t<
390ldexp(T X, T Exp) {
391 return __detail::ldexp_impl(X, Exp);
392}
393
394template <int N>
395_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
396const inline __detail::HLSL_FIXED_VECTOR<half, N> ldexp(
397 __detail::HLSL_FIXED_VECTOR<half, N> X,
398 __detail::HLSL_FIXED_VECTOR<half, N> Exp) {
399 return __detail::ldexp_impl(X, Exp);
400}
401
402template <int N>
408
409//===----------------------------------------------------------------------===//
410// length builtins
411//===----------------------------------------------------------------------===//
412
413/// \fn T length(T x)
414/// \brief Returns the length of the specified floating-point vector.
415/// \param x [in] The vector of floats, or a scalar float.
416///
417/// Length is based on the following formula: sqrt(x[0]^2 + x[1]^2 + ...).
418
419template <typename T>
420_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
421const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
422 __detail::is_same<half, T>::value,
423 T> length(T X) {
424 return __detail::length_impl(X);
425}
426
427template <typename T>
428const inline __detail::enable_if_t<
431 return __detail::length_impl(X);
432}
433
434template <int N>
435_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
436const inline half length(__detail::HLSL_FIXED_VECTOR<half, N> X) {
438}
439
440template <int N>
444
445//===----------------------------------------------------------------------===//
446// lit builtins
447//===----------------------------------------------------------------------===//
448
449/// \fn vector<T, 4> lit(T NDotL, T NDotH, T M)
450/// \brief Returns a lighting coefficient vector.
451/// \param NDotL The dot product of the normalized surface normal and the
452/// light vector.
453/// \param NDotH The dot product of the half-angle vector and the surface
454/// normal.
455/// \param M A specular exponent.
456///
457/// This function returns a lighting coefficient vector (ambient, diffuse,
458/// specular, 1).
459
460_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
461const inline half4 lit(half NDotL, half NDotH, half M) {
462 return __detail::lit_impl(NDotL, NDotH, M);
463}
464
465const inline float4 lit(float NDotL, float NDotH, float M) {
466 return __detail::lit_impl(NDotL, NDotH, M);
467}
468
469//===----------------------------------------------------------------------===//
470// D3DCOLORtoUBYTE4 builtin
471//===----------------------------------------------------------------------===//
472
473/// \fn T D3DCOLORtoUBYTE4(T x)
474/// \brief Converts a floating-point, 4D vector set by a D3DCOLOR to a UBYTE4.
475/// \param x [in] The floating-point vector4 to convert.
476///
477/// The return value is the UBYTE4 representation of the \a x parameter.
478///
479/// This function swizzles and scales components of the \a x parameter. Use this
480/// function to compensate for the lack of UBYTE4 support in some hardware.
481
485
486//===----------------------------------------------------------------------===//
487// NonUniformResourceIndex builtin
488//===----------------------------------------------------------------------===//
489
490/// \fn uint NonUniformResourceIndex(uint I)
491/// \brief A compiler hint to indicate that a resource index varies across
492/// threads within a wave (i.e., it is non-uniform).
493/// \param I [in] Resource array index
494///
495/// The return value is the \Index parameter.
496///
497/// When indexing into an array of shader resources (e.g., textures, buffers),
498/// some GPU hardware and drivers require the compiler to know whether the index
499/// is uniform (same for all threads) or non-uniform (varies per thread).
500///
501/// Using NonUniformResourceIndex explicitly marks an index as non-uniform,
502/// disabling certain assumptions or optimizations that could lead to incorrect
503/// behavior when dynamically accessing resource arrays with non-uniform
504/// indices.
505
507 return __builtin_hlsl_resource_nonuniformindex(Index);
508}
509
510//===----------------------------------------------------------------------===//
511// reflect builtin
512//===----------------------------------------------------------------------===//
513
514/// \fn T reflect(T I, T N)
515/// \brief Returns a reflection using an incident ray, \a I, and a surface
516/// normal, \a N.
517/// \param I The incident ray.
518/// \param N The surface normal.
519///
520/// The return value is a floating-point vector that represents the reflection
521/// of the incident ray, \a I, off a surface with the normal \a N.
522///
523/// This function calculates the reflection vector using the following formula:
524/// V = I - 2 * N * dot(I N) .
525///
526/// N must already be normalized in order to achieve the desired result.
527///
528/// The operands must all be a scalar or vector whose component type is
529/// floating-point.
530///
531/// Result type and the type of all operands must be the same type.
532
533template <typename T>
534_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
535const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
536 __detail::is_same<half, T>::value,
537 T> reflect(T I, T N) {
538 return __detail::reflect_impl(I, N);
539}
540
541template <typename T>
542const inline __detail::enable_if_t<
544reflect(T I, T N) {
545 return __detail::reflect_impl(I, N);
546}
547
548template <int L>
549_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
550const inline __detail::HLSL_FIXED_VECTOR<half, L> reflect(
551 __detail::HLSL_FIXED_VECTOR<half, L> I,
552 __detail::HLSL_FIXED_VECTOR<half, L> N) {
553 return __detail::reflect_vec_impl(I, N);
554}
555
556template <int L>
562
563//===----------------------------------------------------------------------===//
564// refract builtin
565//===----------------------------------------------------------------------===//
566
567/// \fn T refract(T I, T N, T eta)
568/// \brief Returns a refraction using an entering ray, \a I, a surface
569/// normal, \a N and refraction index \a eta
570/// \param I The entering ray.
571/// \param N The surface normal.
572/// \param eta The refraction index.
573///
574/// The return value is a floating-point vector that represents the refraction
575/// using the refraction index, \a eta, for the direction of the entering ray,
576/// \a I, off a surface with the normal \a N.
577///
578/// This function calculates the refraction vector using the following formulas:
579/// k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I))
580/// if k < 0.0 the result is 0.0
581/// otherwise, the result is eta * I - (eta * dot(N, I) + sqrt(k)) * N
582///
583/// I and N must already be normalized in order to achieve the desired result.
584///
585/// I and N must be a scalar or vector whose component type is
586/// floating-point.
587///
588/// eta must be a 16-bit or 32-bit floating-point scalar.
589///
590/// Result type, the type of I, and the type of N must all be the same type.
591
592template <typename T>
593_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
594const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
595 __detail::is_same<half, T>::value,
596 T> refract(T I, T N, T eta) {
597 return __detail::refract_impl(I, N, eta);
598}
599
600template <typename T>
601const inline __detail::enable_if_t<
603refract(T I, T N, T eta) {
604 return __detail::refract_impl(I, N, eta);
605}
606
607template <int L>
608_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
609const inline __detail::HLSL_FIXED_VECTOR<half, L> refract(
610 __detail::HLSL_FIXED_VECTOR<half, L> I,
611 __detail::HLSL_FIXED_VECTOR<half, L> N, half eta) {
612 return __detail::refract_impl(I, N, eta);
613}
614
615template <int L>
621
622//===----------------------------------------------------------------------===//
623// smoothstep builtin
624//===----------------------------------------------------------------------===//
625
626/// \fn T smoothstep(T Min, T Max, T X)
627/// \brief Returns a smooth Hermite interpolation between 0 and 1, if \a X is in
628/// the range [\a Min, \a Max].
629/// \param Min The minimum range of the x parameter.
630/// \param Max The maximum range of the x parameter.
631/// \param X The specified value to be interpolated.
632///
633/// The return value is 0.0 if \a X ≤ \a Min and 1.0 if \a X ≥ \a Max. When \a
634/// Min < \a X < \a Max, the function performs smooth Hermite interpolation
635/// between 0 and 1.
636
637template <typename T>
638_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
639const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
640 __detail::is_same<half, T>::value,
641 T> smoothstep(T Min, T Max, T X) {
642 return __detail::smoothstep_impl(Min, Max, X);
643}
644
645template <typename T>
646const inline __detail::enable_if_t<
648smoothstep(T Min, T Max, T X) {
649 return __detail::smoothstep_impl(Min, Max, X);
650}
651
652template <int N>
653_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
654const inline __detail::HLSL_FIXED_VECTOR<half, N> smoothstep(
655 __detail::HLSL_FIXED_VECTOR<half, N> Min,
656 __detail::HLSL_FIXED_VECTOR<half, N> Max,
657 __detail::HLSL_FIXED_VECTOR<half, N> X) {
658 return __detail::smoothstep_vec_impl(Min, Max, X);
659}
660
661template <int N>
668
669inline bool CheckAccessFullyMapped(uint Status) {
670 return static_cast<bool>(Status);
671}
672
673//===----------------------------------------------------------------------===//
674// fwidth builtin
675//===----------------------------------------------------------------------===//
676
677/// \fn T fwidth(T x)
678/// \brief Computes the sum of the absolute values of the partial derivatives
679/// with regard to the x and y screen space coordinates.
680/// \param x [in] The floating-point scalar or vector to process.
681///
682/// The return value is a floating-point scalar or vector where each element
683/// holds the computation of the matching element in the input.
684
685template <typename T>
686_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
687const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
688 __detail::is_same<half, T>::value,
689 T> fwidth(T input) {
690 return __detail::fwidth_impl(input);
691}
692
693template <typename T>
694const inline __detail::enable_if_t<
696fwidth(T input) {
697 return __detail::fwidth_impl(input);
698}
699
700template <int N>
701_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
702const inline __detail::HLSL_FIXED_VECTOR<half, N> fwidth(
703 __detail::HLSL_FIXED_VECTOR<half, N> input) {
704 return __detail::fwidth_impl(input);
705}
706
707template <int N>
712
713} // namespace hlsl
714#endif //_HLSL_HLSL_INTRINSICS_H_
#define V(N, I)
#define X(type, name)
Definition Value.h:97
#define _HLSL_BUILTIN_ALIAS(builtin)
#define _HLSL_AVAILABILITY(platform, version)
#define _HLSL_16BIT_AVAILABILITY(environment, version)
constexpr vector< T, N > smoothstep_vec_impl(vector< T, N > Min, vector< T, N > Max, vector< T, N > X)
constexpr T length_impl(T X)
constexpr vector< T, 4 > dst_impl(vector< T, 4 > Src0, vector< T, 4 > Src1)
constexpr T faceforward_impl(T N, T I, T Ng)
constexpr T fwidth_impl(T input)
constexpr vector< T, L > reflect_vec_impl(vector< T, L > I, vector< T, L > N)
constexpr T distance_impl(T X, T Y)
constexpr K firstbithigh_impl(T X)
constexpr T reflect_impl(T I, T N)
constexpr T ldexp_impl(T X, T Exp)
constexpr enable_if_t< is_same< float, T >::value||is_same< half, T >::value, T > distance_vec_impl(vector< T, N > X, vector< T, N > Y)
constexpr T fmod_impl(T X, T Y)
typename enable_if< B, T >::Type enable_if_t
Definition hlsl_detail.h:31
constexpr int4 d3d_color_to_ubyte4_impl(float4 V)
constexpr T smoothstep_impl(T Min, T Max, T X)
constexpr enable_if_t< is_same< float, T >::value||is_same< half, T >::value, T > length_vec_impl(vector< T, N > X)
constexpr T refract_impl(T I, T N, U Eta)
constexpr float dot2add_impl(half2 a, half2 b, float c)
vector< __detail::enable_if_t<(N > 1 &&N<=4), T >, N > HLSL_FIXED_VECTOR
Definition hlsl_detail.h:49
constexpr vector< T, N > fmod_vec_impl(vector< T, N > X, vector< T, N > Y)
constexpr enable_if_t< sizeof(U)==sizeof(T), vector< U, N > > bit_cast(vector< T, N > V)
Definition hlsl_detail.h:35
constexpr vector< T, 4 > lit_impl(T NDotL, T NDotH, T M)
unsigned int uint
An unsigned 32-bit integer.
vector< half, 4 > half4
constexpr int4 D3DCOLORtoUBYTE4(float4 V)
constexpr uint32_t NonUniformResourceIndex(uint32_t Index)
A compiler hint to indicate that a resource index varies across threads within a wave (i....
vector< half, 2 > half2
vector< uint, 2 > uint2
bool CheckAccessFullyMapped(uint Status)
vector< float, 4 > float4
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > smoothstep(T Min, T Max, T X)
Returns a smooth Hermite interpolation between 0 and 1, if X is in the range [Min,...
const half4 lit(half NDotL, half NDotH, half M)
const __detail::enable_if_t< __detail::is_same< int, T >::value||__detail::is_same< uint, T >::value, uint > firstbithigh(T X)
Returns the location of the first set bit starting from the lowest order bit and working upward,...
vector< int, 4 > int4
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > fwidth(T input)
Computes the sum of the absolute values of the partial derivatives with regard to the x and y screen ...
constexpr vector< uint, N > asuint(vector< T, N > V)
vector< double, 3 > double3
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > refract(T I, T N, T eta)
Returns a refraction using an entering ray, I, a surface normal, N and refraction index eta.
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > length(T X)
Returns the length of the specified floating-point vector.
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > ldexp(T X, T Exp)
Returns the result of multiplying the specified value by two raised to the power of the specified exp...
vector< uint, 3 > uint3
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > reflect(T I, T N)
Returns a reflection using an incident ray, I, and a surface normal, N.
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > distance(T X, T Y)
Returns a distance scalar between X and Y.
vector< double, 4 > double4
vector< double, 2 > double2
unsigned int uint32_t
vector< uint, 4 > uint4
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > faceforward(T N, T I, T Ng)
Flips the surface-normal (if needed) to face in a direction opposite to I.
const half4 dst(half4 Src0, half4 Src1)
constexpr vector< int, N > asint(vector< T, N > V)
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > fmod(T X, T Y)
Returns the linear interpolation of x to y.
constexpr vector< float, N > asfloat(vector< T, N > V)
const float dot2add(half2 A, half2 B, float C)
Dot product of 2 vector of type half and add a float scalar value.
static const bool value
Definition hlsl_detail.h:17
#define ldexp(__x, __y)
Definition tgmath.h:868
#define fmod(__x, __y)
Definition tgmath.h:798