9#ifndef _HLSL_HLSL_INTRINSICS_H_
10#define _HLSL_HLSL_INTRINSICS_H_
17#include "hlsl_inline_intrinsics_gen.inc"
27template <
typename T,
int R,
int C>
28constexpr matrix<float, R, C>
asfloat(matrix<T, R, C>
V) {
32template <
typename T,
int N>
33constexpr vector<float, N>
asfloat(vector<T, N>
V) {
37template <
typename T>
constexpr float asfloat(T F) {
49template <
typename T,
int R,
int C>
50constexpr matrix<int, R, C>
asint(matrix<T, R, C>
V) {
54template <
typename T,
int N>
constexpr vector<int, N>
asint(vector<T, N>
V) {
58template <
typename T>
constexpr int asint(T F) {
70#ifdef __HLSL_ENABLE_16_BIT
72template <
typename T,
int N>
74constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
75 __detail::is_same<uint16_t, T>::value ||
76 __detail::is_same<half, T>::value,
77 vector<int16_t, N>> asint16(vector<T, N>
V) {
84 __detail::is_same<uint16_t, T>::value ||
86 int16_t> asint16(T F) {
99template <
typename T,
int R,
int C>
100constexpr matrix<uint, R, C>
asuint(matrix<T, R, C>
V) {
104template <
typename T,
int N>
constexpr vector<uint, N>
asuint(vector<T, N>
V) {
138#ifdef __HLSL_ENABLE_16_BIT
140template <
typename T,
int N>
143 __detail::is_same<uint16_t, T>::value ||
145 vector<uint16_t, N>> asuint16(vector<T, N>
V) {
151constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
152 __detail::is_same<uint16_t, T>::value ||
153 __detail::is_same<half, T>::value,
154 uint16_t> asuint16(T F) {
168#ifdef __HLSL_ENABLE_16_BIT
173 __detail::is_same<uint16_t, T>::value,
178template <
typename T,
int N>
182 __detail::is_same<uint16_t, T>::value,
196template <
typename T,
int N>
197const inline __detail::enable_if_t<__detail::is_same<int, T>::value ||
205const inline __detail::enable_if_t<__detail::is_same<int64_t, T>::value ||
212template <
typename T,
int N>
213const inline __detail::enable_if_t<__detail::is_same<int64_t, T>::value ||
257constexpr __detail::enable_if_t<__detail::is_arithmetic<T>::
Value &&
258 __detail::is_same<half, T>::value,
273constexpr vector<half, N>
mul(half x, vector<half, N> y) {
277template <
typename T,
int N>
constexpr vector<T, N>
mul(T x, vector<T, N> y) {
282template <
int R,
int C>
284constexpr matrix<half,
R,
C>
mul(half x, matrix<half,
R,
C> y) {
288template <
typename T,
int R,
int C>
289constexpr matrix<T, R, C>
mul(T x, matrix<T, R, C> y) {
296constexpr vector<half, N>
mul(vector<half, N> x, half y) {
300template <
typename T,
int N>
constexpr vector<T, N>
mul(vector<T, N> x, T y) {
307half
mul(vector<half, N> x, vector<half, N> y) {
311template <
typename T,
int N> T
mul(vector<T, N> x, vector<T, N> y) {
316template <
int R,
int C>
318constexpr matrix<half,
R,
C>
mul(matrix<half,
R,
C> x, half y) {
322template <
typename T,
int R,
int C>
323constexpr 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(platform, version,...)
constexpr K firstbithigh_impl(T X)
typename enable_if< B, T >::Type enable_if_t
constexpr enable_if_t< sizeof(U)==sizeof(T), matrix< U, R, C > > bit_cast(matrix< T, R, C > 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.
C mul(vector< half, R >, matrix< half, R, C >)
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< double, 3 > double3
constexpr matrix< uint, R, C > asuint(matrix< T, R, C > V)
vector< double, 4 > double4
constexpr matrix< float, R, C > asfloat(matrix< T, R, C > V)
vector< double, 2 > double2
constexpr matrix< int, R, C > asint(matrix< T, R, C > V)