Debian Codegraph @

clang/test/SemaHLSL/Availability/attr-availability-pixel.hlsl

raw
1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel5.0-pixel -fsyntax-only -verify %s
2
3 // Platform shader model, no environment parameter
4 __attribute__((availability(shadermodel, introduced = 6.0)))
5 unsigned f1(); // #f1
6
7 __attribute__((availability(shadermodel, introduced = 5.1)))
8 unsigned f2(); // #f2
9
10 __attribute__((availability(shadermodel, introduced = 5.0)))
11 unsigned f3();
12
13 // Platform shader model, environment parameter restricting earlier version,
14 // available in all environments in higher versions
15 __attribute__((availability(shadermodel, introduced = 2.0, environment = pixel)))
16 __attribute__((availability(shadermodel, introduced = 6.0)))
17 unsigned f4(); // #f4
18
19 __attribute__((availability(shadermodel, introduced = 2.0, environment = pixel)))
20 __attribute__((availability(shadermodel, introduced = 5.0)))
21 unsigned f5();
22
23 // Platform shader model, environment parameter restricting earlier version,
24 // never available in all environments in higher versions
25 __attribute__((availability(shadermodel, introduced = 2.0, environment = pixel)))
26 __attribute__((availability(shadermodel, introduced = 6.0, environment = compute)))
27 __attribute__((availability(shadermodel, introduced = 5.0, environment = mesh)))
28 unsigned f6(); // #f6
29
30 __attribute__((availability(shadermodel, introduced = 2.0, environment = pixel)))
31 __attribute__((availability(shadermodel, introduced = 6.0, environment = mesh)))
32 unsigned f7(); // #f7
33
34 __attribute__((availability(shadermodel, introduced = 2.0, environment = pixel)))
35 __attribute__((availability(shadermodel, introduced = 5.0, environment = compute)))
36 __attribute__((availability(shadermodel, introduced = 6.0, environment = mesh)))
37 unsigned f8();
38
39 int main() : A {
40 // expected-error@#f1_call {{'f1' is only available on Shader Model 6.0 or newer}}
41 // expected-note@#f1 {{'f1' has been marked as being introduced in Shader Model 6.0 here, but the deployment target is Shader Model 5.0}}
42 unsigned A = f1(); // #f1_call
43
44 // expected-error@#f2_call {{'f2' is only available on Shader Model 5.1 or newer}}
45 // expected-note@#f2 {{'f2' has been marked as being introduced in Shader Model 5.1 here, but the deployment target is Shader Model 5.0}}
46 unsigned B = f2(); // #f2_call
47
48 unsigned C = f3();
49
50 unsigned D = f4(); // #f4_call
51
52 unsigned E = f5();
53
54 unsigned F = f6(); // #f6_call
55
56 unsigned G = f7(); // #f7_call
57
58 unsigned H = f8();
59
60 return 0;
61 }