Skip to content

Commit d0dfbe1

Browse files
committed
Add Shadermodel 6.2 macro to hlsl_intrinsics.h
1 parent f8f20b8 commit d0dfbe1

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,20 @@ void asuint(double4, out uint4, out uint4);
9090
#ifdef __HLSL_ENABLE_16_BIT
9191

9292
template <typename T, int N>
93+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
9394
constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
9495
__detail::is_same<uint16_t, T>::value ||
9596
__detail::is_same<half, T>::value,
96-
vector<int16_t, N>>
97-
asint16(vector<T, N> V) {
97+
vector<int16_t, N>> asint16(vector<T, N> V) {
9898
return __detail::bit_cast<int16_t, T, N>(V);
9999
}
100100

101101
template <typename T>
102+
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
102103
constexpr __detail::enable_if_t<__detail::is_same<int16_t, T>::value ||
103104
__detail::is_same<uint16_t, T>::value ||
104105
__detail::is_same<half, T>::value,
105-
int16_t>
106-
asint16(T F) {
106+
int16_t> asint16(T F) {
107107
return __detail::bit_cast<int16_t, T>(F);
108108
}
109109
#endif

clang/test/CodeGenHLSL/builtins/asint16.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ int16_t4 fn(half4 p1)
5757
{
5858
return asint16(p1);
5959
}
60+

clang/test/SemaHLSL/BuiltIns/asint16-errors.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ int16_t4 test_asint16_vector_float(float4 p1)
4040
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float, N = 4]: no type named 'Type'}}
4141
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate template ignored: substitution failure [with T = float4]: no type named 'Type'}}
4242
}
43+

0 commit comments

Comments
 (0)