82 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -x hlsl -ast-dump -verify -o - %s2 3[numthreads(8,8,1)]4// expected-error@+1 {{attribute 'SV_DispatchThreadID' only applies to a field or parameter of type 'uint/uint2/uint3'}}5void CSMain(float ID : SV_DispatchThreadID) {6 7}8 9struct 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'}}15void CSMain2(ST ID : SV_DispatchThreadID) {16 17}18 19void 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 25struct 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'}}33void 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'}}38void CSMain2_GID(ST GID : SV_GroupID) {39 40}41 42void 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 47struct 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'}}55void 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'}}60void CSMain2_GThreadID(ST GID : SV_GroupThreadID) {61 62}63 64void 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 69struct 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}}81void vs_main(int GI : SV_GroupIndex, uint ID : SV_DispatchThreadID, uint GID : SV_GroupID, uint GThreadID : SV_GroupThreadID) {}82