1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \
\r
2 // RUN: -fsyntax-only -verify %s
\r
4 __attribute__((availability(shadermodel, introduced = 6.5)))
\r
5 float fx(float); // #fx
\r
7 __attribute__((availability(shadermodel, introduced = 6.6)))
\r
8 half fx(half); // #fx_half
\r
10 __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
\r
11 __attribute__((availability(shadermodel, introduced = 6.5, environment = compute)))
\r
12 float fy(float); // #fy
\r
14 __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel)))
\r
15 __attribute__((availability(shadermodel, introduced = 6.5, environment = mesh)))
\r
16 float fz(float); // #fz
\r
18 float also_alive(float f) {
\r
19 // expected-error@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
\r
20 // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
\r
21 float A = fx(f); // #also_alive_fx_call
\r
22 // expected-error@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
\r
23 // expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
\r
24 float B = fy(f); // #also_alive_fy_call
\r
25 // expected-error@#also_alive_fz_call {{'fz' is unavailable}}
\r
26 // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
\r
27 float C = fz(f); // #also_alive_fz_call
\r
31 float alive(float f) {
\r
32 // expected-error@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
\r
33 // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
\r
34 float A = fx(f); // #alive_fx_call
\r
35 // expected-error@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
\r
36 // expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
\r
37 float B = fy(f); // #alive_fy_call
\r
38 // expected-error@#alive_fz_call {{'fz' is unavailable}}
\r
39 // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
\r
40 float C = fz(f); // #alive_fz_call
\r
42 return also_alive(f);
\r
45 float also_dead(float f) {
\r
46 // unreachable code - no errors expected
\r
53 float dead(float f) {
\r
54 // unreachable code - no errors expected
\r
59 return also_dead(f);
\r
62 template<typename T>
\r
64 // expected-error@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
\r
65 // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
\r
66 float A = fx(f); // #aliveTemp_fx_call
\r
67 // expected-error@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
\r
68 // expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
\r
69 float B = fy(f); // #aliveTemp_fy_call
\r
70 // expected-error@#aliveTemp_fz_call {{'fz' is unavailable}}
\r
71 // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
\r
72 float C = fz(f); // #aliveTemp_fz_call
\r
76 template<typename T> T aliveTemp2(T f) {
\r
77 // expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}}
\r
78 // expected-note@#fx_half {{'fx' has been marked as being introduced in Shader Model 6.6 here, but the deployment target is Shader Model 6.0}}
\r
79 // expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
\r
80 // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
\r
81 return fx(f); // #aliveTemp2_fx_call
\r
85 return aliveTemp2(x);
\r
88 float test(float x) {
\r
89 return aliveTemp2(x);
\r
96 // expected-error@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
\r
97 // expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
\r
98 float A = fx(F); // #MyClass_makeF_fx_call
\r
99 // expected-error@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
\r
100 // expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
\r
101 float B = fy(F); // #MyClass_makeF_fy_call
\r
102 // expected-error@#MyClass_makeF_fz_call {{'fz' is unavailable}}
\r
103 // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
\r
104 float C = fz(F); // #MyClass_makeF_fz_call
\r
109 [numthreads(4,1,1)]
\r
112 MyClass C = { 1.0f };
\r
113 float a = alive(f);
\r
114 float b = aliveTemp<float>(f); // #aliveTemp_inst
\r
115 float c = C.makeF();
\r
116 float d = test((float)1.0);
\r
117 float e = test((half)1.0);
\r