9#ifndef _HLSL_HLSL_INTRINSICS_H_
10#define _HLSL_HLSL_INTRINSICS_H_
17#include "hlsl_inline_intrinsics_gen.inc"
27template <
typename T,
int N>
28constexpr vector<float, N>
asfloat(vector<T, N>
V) {
32template <
typename T>
constexpr float asfloat(T F) {
44template <
typename T,
int N>
constexpr vector<int, N>
asint(vector<T, N>
V) {
48template <
typename T>
constexpr int asint(T F) {
60#ifdef __HLSL_ENABLE_16_BIT
62template <
typename T,
int N>
64constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
65 __detail::is_same<uint16_t, T>::value ||
66 __detail::is_same<half, T>::value,
67 vector<int16_t, N>> asint16(vector<T, N>
V) {
74 __detail::is_same<uint16_t, T>::value ||
76 int16_t> asint16(T F) {
89template <
typename T,
int N>
constexpr vector<uint, N>
asuint(vector<T, N>
V) {
123#ifdef __HLSL_ENABLE_16_BIT
125template <
typename T,
int N>
128 __detail::is_same<uint16_t, T>::value ||
130 vector<uint16_t, N>> asuint16(vector<T, N>
V) {
136constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
137 __detail::is_same<uint16_t, T>::value ||
138 __detail::is_same<half, T>::value,
139 uint16_t> asuint16(T F) {
171 __detail::HLSL_FIXED_VECTOR<half, N> Y) {
237const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
238 __detail::is_same<half, T>::value,
253 __detail::HLSL_FIXED_VECTOR<half, L> N,
254 __detail::HLSL_FIXED_VECTOR<half, L> I,
255 __detail::HLSL_FIXED_VECTOR<half, L> Ng) {
276#ifdef __HLSL_ENABLE_16_BIT
280const inline __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
281 __detail::is_same<uint16_t, T>::value,
286template <
typename T,
int N>
290 __detail::is_same<uint16_t, T>::value,
304template <
typename T,
int N>
305const inline __detail::enable_if_t<__detail::is_same<int, T>::value ||
313const inline __detail::enable_if_t<__detail::is_same<int64_t, T>::value ||
320template <
typename T,
int N>
321const inline __detail::enable_if_t<__detail::is_same<int64_t, T>::value ||
342const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
343 __detail::is_same<half, T>::value,
359 __detail::HLSL_FIXED_VECTOR<half, N> Y) {
384const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
385 __detail::is_same<half, T>::value,
401 __detail::HLSL_FIXED_VECTOR<half, N> Exp) {
424const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
425 __detail::is_same<half, T>::value,
464const inline
half4 lit(half NDotL, half NDotH, half M) {
468const inline float4 lit(
float NDotL,
float NDotH,
float M) {
510 return __builtin_hlsl_resource_nonuniformindex(Index);
538const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
539 __detail::is_same<half, T>::value,
554 __detail::HLSL_FIXED_VECTOR<half, L> I,
555 __detail::HLSL_FIXED_VECTOR<half, L> N) {
597const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
598 __detail::is_same<half, T>::value,
613 __detail::HLSL_FIXED_VECTOR<half, L> I,
614 __detail::HLSL_FIXED_VECTOR<half, L> N, half eta) {
642const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
643 __detail::is_same<half, T>::value,
658 __detail::HLSL_FIXED_VECTOR<half, N> Min,
659 __detail::HLSL_FIXED_VECTOR<half, N> Max,
660 __detail::HLSL_FIXED_VECTOR<half, N>
X) {
673 return static_cast<bool>(Status);
690const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
691 __detail::is_same<half, T>::value,
706 __detail::HLSL_FIXED_VECTOR<half, N> input) {
730const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
731 __detail::is_same<half, T>::value,
746 __detail::HLSL_FIXED_VECTOR<half, N> input) {
770const inline __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
771 __detail::is_same<half, T>::value,
786 __detail::HLSL_FIXED_VECTOR<half, N> input) {
833constexpr __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
834 __detail::is_same<half, T>::value,
849constexpr vector<half, N>
mul(half x, vector<half, N> y) {
853template <
typename T,
int N>
constexpr vector<T, N>
mul(T x, vector<T, N> y) {
858template <
int R,
int C>
860constexpr matrix<half,
R,
C>
mul(half x, matrix<half,
R,
C> y) {
864template <
typename T,
int R,
int C>
865constexpr matrix<T, R, C>
mul(T x, matrix<T, R, C> y) {
872constexpr vector<half, N>
mul(vector<half, N> x, half y) {
876template <
typename T,
int N>
constexpr vector<T, N>
mul(vector<T, N> x, T y) {
883half
mul(vector<half, N> x, vector<half, N> y) {
887template <
typename T,
int N> T
mul(vector<T, N> x, vector<T, N> y) {
892template <
int R,
int C>
894constexpr matrix<half,
R,
C>
mul(matrix<half,
R,
C> x, half y) {
898template <
typename T,
int R,
int C>
899constexpr matrix<T, R, C>
mul(matrix<T, R, C> x, T y) {
#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
constexpr T ddx_impl(T input)
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
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)
constexpr T ddy_impl(T input)
constexpr vector< T, 4 > lit_impl(T NDotL, T NDotH, T M)
constexpr enable_if_t<!is_same< double, T >::value, T > mul_vec_impl(vector< T, N > x, vector< T, N > y)
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mul) vector< half
unsigned int uint
An unsigned 32-bit integer.
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....
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,...
C mul(vector< half, R >, matrix< half, R, C >)
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,...
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...
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
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 __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > ddy(T input)
Computes the sum of the absolute values of the partial derivatives with regard to the y screen space ...
const __detail::enable_if_t< __detail::is_arithmetic< T >::Value &&__detail::is_same< half, T >::value, T > ddx(T input)
Computes the sum of the absolute values of the partial derivatives with regard to the x screen space ...
const float dot2add(half2 A, half2 B, float C)
Dot product of 2 vector of type half and add a float scalar value.