Debian Codegraph @

clang/test/SemaHLSL/Semantics/invalid_entry_parameter.hlsl

raw
1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -x hlsl -ast-dump -verify -o - %s
2
3 [numthreads(8,8,1)]
4 // expected-error@+1 {{attribute 'SV_DispatchThreadID' only applies to a field or parameter of type 'uint/uint2/uint3'}}
5 void CSMain(float ID : SV_DispatchThreadID) {
6
7 }
8
9 struct ST {
10 int a;
11 float b;
12 };
13 [numthreads(8,8,1)]
14 // expected-error@+1 {{attribute 'SV_DispatchThreadID' only applies to a field or parameter of type 'uint/uint2/uint3'}}
15 void CSMain2(ST ID : SV_DispatchThreadID) {
16
17 }
18
19 void foo() {
20 // expected-warning@+1 {{'SV_DispatchThreadID' attribute only applies to parameters, non-static data members, and functions}}
21 uint V : SV_DispatchThreadID;
22
23 }
24
25 struct ST2 {
26 // expected-warning@+1 {{'SV_DispatchThreadID' attribute only applies to parameters, non-static data members, and functions}}
27 static uint X : SV_DispatchThreadID;
28 uint s : SV_DispatchThreadID;
29 };
30
31 [numthreads(8,8,1)]
32 // expected-error@+1 {{attribute 'SV_GroupID' only applies to a field or parameter of type 'uint/uint2/uint3'}}
33 void CSMain_GID(float ID : SV_GroupID) {
34 }
35
36 [numthreads(8,8,1)]
37 // expected-error@+1 {{attribute 'SV_GroupID' only applies to a field or parameter of type 'uint/uint2/uint3'}}
38 void CSMain2_GID(ST GID : SV_GroupID) {
39
40 }
41
42 void foo_GID() {
43 // expected-warning@+1 {{'SV_GroupID' attribute only applies to parameters, non-static data members, and functions}}
44 uint GIS : SV_GroupID;
45 }
46
47 struct ST2_GID {
48 // expected-warning@+1 {{'SV_GroupID' attribute only applies to parameters, non-static data members, and functions}}
49 static uint GID : SV_GroupID;
50 uint s_gid : SV_GroupID;
51 };
52
53 [numthreads(8,8,1)]
54 // expected-error@+1 {{attribute 'SV_GroupThreadID' only applies to a field or parameter of type 'uint/uint2/uint3'}}
55 void CSMain_GThreadID(float ID : SV_GroupThreadID) {
56 }
57
58 [numthreads(8,8,1)]
59 // expected-error@+1 {{attribute 'SV_GroupThreadID' only applies to a field or parameter of type 'uint/uint2/uint3'}}
60 void CSMain2_GThreadID(ST GID : SV_GroupThreadID) {
61
62 }
63
64 void foo_GThreadID() {
65 // expected-warning@+1 {{'SV_GroupThreadID' attribute only applies to parameters, non-static data members, and functions}}
66 uint GThreadIS : SV_GroupThreadID;
67 }
68
69 struct ST2_GThreadID {
70 // expected-warning@+1 {{'SV_GroupThreadID' attribute only applies to parameters, non-static data members, and functions}}
71 static uint GThreadID : SV_GroupThreadID;
72 uint s_gthreadid : SV_GroupThreadID;
73 };
74
75
76 [shader("vertex")]
77 // expected-error@+4 {{attribute 'SV_GroupIndex' is unsupported in 'vertex' shaders, requires compute}}
78 // expected-error@+3 {{attribute 'SV_DispatchThreadID' is unsupported in 'vertex' shaders, requires compute}}
79 // expected-error@+2 {{attribute 'SV_GroupID' is unsupported in 'vertex' shaders, requires compute}}
80 // expected-error@+1 {{attribute 'SV_GroupThreadID' is unsupported in 'vertex' shaders, requires compute}}
81 void vs_main(int GI : SV_GroupIndex, uint ID : SV_DispatchThreadID, uint GID : SV_GroupID, uint GThreadID : SV_GroupThreadID) {}