Skip to content

Commit 321e54e

Browse files
committed
add >= hlsl202y primary template definition, add hlsl202y sema tests
1 parent 3f8e6a5 commit 321e54e

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ const inline float length(__detail::HLSL_FIXED_VECTOR<float, N> X) {
283283
/// This function returns a lighting coefficient vector (ambient, diffuse,
284284
/// specular, 1).
285285

286+
#if __HLSL_VERSION >= __HLSL_202y
287+
template <typename T> const inline vector<T, 4> lit(T, T, T) = delete;
288+
#endif
289+
286290
template <>
287291
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
288292
const inline vector<half, 4> lit<half>(half NDotL, half NDotH, half M) {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// RUN: %clang_cc1 -std=hlsl202y -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify
2+
3+
double4 test_double_inputs(double p0, double p1, double p2) {
4+
return lit(p0, p1, p2);
5+
// expected-error@-1 {{call to deleted function 'lit'}}
6+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function [with T = double] has been explicitly deleted}}
7+
}
8+
9+
int4 test_int_inputs(int p0, int p1, int p2) {
10+
return lit(p0, p1, p2);
11+
// expected-error@-1 {{call to deleted function 'lit'}}
12+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function [with T = int] has been explicitly deleted}}
13+
}
14+
15+
uint4 test_uint_inputs(uint p0, uint p1, uint p2) {
16+
return lit(p0, p1, p2);
17+
// expected-error@-1 {{call to deleted function 'lit'}}
18+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function [with T = unsigned int] has been explicitly deleted}}
19+
}
20+
21+
int64_t4 test_int64_t_inputs(int64_t p0, int64_t p1, int64_t p2) {
22+
return lit(p0, p1, p2);
23+
// expected-error@-1 {{call to deleted function 'lit'}}
24+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function [with T = long] has been explicitly deleted}}
25+
}
26+
27+
uint64_t4 test_uint64_t_inputs(uint64_t p0, uint64_t p1, uint64_t p2) {
28+
return lit(p0, p1, p2);
29+
// expected-error@-1 {{call to deleted function 'lit'}}
30+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function [with T = unsigned long] has been explicitly deleted}}
31+
}
32+
33+
bool4 test_bool_inputs(bool p0, bool p1, bool p2) {
34+
return lit(p0, p1, p2);
35+
// expected-error@-1 {{call to deleted function 'lit'}}
36+
// expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function [with T = bool] has been explicitly deleted}}
37+
}

0 commit comments

Comments
 (0)