clang
24.0.0git
lib
Headers
hlsl
hlsl_detail.h
Go to the documentation of this file.
1
//===----- hlsl_detail.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_DETAILS_H_
10
#define _HLSL_HLSL_DETAILS_H_
11
12
namespace
hlsl
{
13
14
namespace
__detail
{
15
16
constexpr
double
Pi
= 3.14159265358979323846L;
17
18
template
<
typename
T,
typename
U>
struct
is_same
{
19
static
const
bool
value
=
false
;
20
};
21
22
template
<
typename
T>
struct
is_same
<T, T> {
23
static
const
bool
value
=
true
;
24
};
25
26
template
<
bool
B,
typename
T>
struct
enable_if
{};
27
28
template
<
typename
T>
struct
enable_if
<
true
, T> {
29
using
Type
= T;
30
};
31
32
template
<
bool
B,
class
T =
void
>
33
using
enable_if_t
=
typename
enable_if<B, T>::Type
;
34
35
template
<
typename
T>
struct
type_identity
{
36
using
Type
= T;
37
};
38
39
template
<
typename
T>
using
type_identity_t
=
typename
type_identity<T>::Type
;
40
41
template
<
typename
U,
typename
T,
int
R,
int
C>
42
constexpr
enable_if_t
<
sizeof
(
U
) ==
sizeof
(T), matrix<U, R, C>>
43
bit_cast
(matrix<T, R, C> M) {
44
return
__builtin_bit_cast(matrix<U, R, C>, M);
45
}
46
47
template
<
typename
U,
typename
T,
int
N>
48
constexpr
enable_if_t
<
sizeof
(
U
) ==
sizeof
(T), vector<U, N>>
49
bit_cast
(vector<T, N>
V
) {
50
return
__builtin_bit_cast(vector<U, N>,
V
);
51
}
52
53
template
<
typename
U,
typename
T>
54
constexpr
enable_if_t
<
sizeof
(
U
) ==
sizeof
(T),
U
>
bit_cast
(T F) {
55
return
__builtin_bit_cast(
U
, F);
56
}
57
58
template
<
typename
T>
struct
is_arithmetic
{
59
static
const
bool
Value
= __is_arithmetic(T);
60
};
61
62
template
<
typename
T>
struct
elem_type
{
63
using
Type
= T;
64
};
65
template
<
typename
T,
int
N>
struct
elem_type
<vector<T, N>> {
66
using
Type
= T;
67
};
68
template
<
typename
T,
int
R,
int
C>
struct
elem_type
<matrix<T,
R
,
C
>> {
69
using
Type
= T;
70
};
71
template
<
typename
T>
using
elem_type_t
=
typename
elem_type<T>::Type
;
72
73
}
// namespace __detail
74
}
// namespace hlsl
75
#endif
//_HLSL_HLSL_DETAILS_H_
V
#define V(N, I)
Definition
ASTContext.h:3807
U
hlsl::__detail
Definition
hlsl_detail.h:14
hlsl::__detail::Pi
constexpr double Pi
Definition
hlsl_detail.h:16
hlsl::__detail::type_identity_t
typename type_identity< T >::Type type_identity_t
Definition
hlsl_detail.h:39
hlsl::__detail::elem_type_t
typename elem_type< T >::Type elem_type_t
Definition
hlsl_detail.h:71
hlsl::__detail::enable_if_t
typename enable_if< B, T >::Type enable_if_t
Definition
hlsl_detail.h:33
hlsl::__detail::bit_cast
constexpr enable_if_t< sizeof(U)==sizeof(T), matrix< U, R, C > > bit_cast(matrix< T, R, C > M)
Definition
hlsl_detail.h:43
hlsl
Definition
hlsl_alias_intrinsics.h:12
hlsl::R
R
Definition
hlsl_alias_intrinsics.h:102
hlsl::C
C
Definition
hlsl_alias_intrinsics.h:119
true
#define true
Definition
stdbool.h:25
hlsl::__detail::elem_type< matrix< T, R, C > >::Type
T Type
Definition
hlsl_detail.h:69
hlsl::__detail::elem_type< vector< T, N > >::Type
T Type
Definition
hlsl_detail.h:66
hlsl::__detail::elem_type
Definition
hlsl_detail.h:62
hlsl::__detail::elem_type::Type
T Type
Definition
hlsl_detail.h:63
hlsl::__detail::enable_if< true, T >::Type
T Type
Definition
hlsl_detail.h:29
hlsl::__detail::enable_if
Definition
hlsl_detail.h:26
hlsl::__detail::is_arithmetic
Definition
hlsl_detail.h:58
hlsl::__detail::is_arithmetic::Value
static const bool Value
Definition
hlsl_detail.h:59
hlsl::__detail::is_same< T, T >::value
static const bool value
Definition
hlsl_detail.h:23
hlsl::__detail::is_same
Definition
hlsl_detail.h:18
hlsl::__detail::is_same::value
static const bool value
Definition
hlsl_detail.h:19
hlsl::__detail::type_identity
Definition
hlsl_detail.h:35
hlsl::__detail::type_identity::Type
T Type
Definition
hlsl_detail.h:36
Generated on
for clang by
1.14.0