Skip to content

Commit 96d276e

Browse files
author
git apple-llvm automerger
committed
Merge commit '43a9b92d79ab' from llvm.org/main into next
2 parents 5b937e4 + 43a9b92 commit 96d276e

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4211,8 +4211,8 @@ def HLSLShader : InheritableAttr {
42114211
EnumArgument<"Type", "ShaderType",
42124212
[
42134213
"pixel", "vertex", "geometry", "hull", "domain", "compute",
4214-
"library", "raygeneration", "intersection", "anyHit",
4215-
"closestHit", "miss", "callable", "mesh", "amplification"
4214+
"library", "raygeneration", "intersection", "anyhit",
4215+
"closesthit", "miss", "callable", "mesh", "amplification"
42164216
],
42174217
[
42184218
"Pixel", "Vertex", "Geometry", "Hull", "Domain", "Compute",
@@ -4300,4 +4300,3 @@ def AvailableOnlyInDefaultEvalMethod : InheritableAttr {
43004300
let Subjects = SubjectList<[TypedefName], ErrorDiag>;
43014301
let Documentation = [Undocumented];
43024302
}
4303-

clang/test/SemaHLSL/entry_shader.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-compute -x hlsl -hlsl-entry foo -o - %s -DSHADER='"anyHit"' -verify
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-compute -x hlsl -hlsl-entry foo -o - %s -DSHADER='"mesh"' -verify
22
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-compute -x hlsl -hlsl-entry foo -o - %s -DSHADER='"compute"'
33

44
// expected-error@+1 {{'shader' attribute on entry function does not match the target profile}}

clang/test/SemaHLSL/shader_type_attr.hlsl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void oops() {}
2828
} // namespace spec
2929

3030
// expected-error@+1 {{'shader' attribute parameters do not match the previous declaration}}
31-
[shader("compute")]
31+
[shader("pixel")]
3232
// expected-note@+1 {{conflicting attribute is here}}
3333
[shader("vertex")]
3434
int doubledUp() {
@@ -40,7 +40,7 @@ int doubledUp() {
4040
int forwardDecl();
4141

4242
// expected-error@+1 {{'shader' attribute parameters do not match the previous declaration}}
43-
[shader("compute")]
43+
[shader("compute")][numthreads(8,1,1)]
4444
int forwardDecl() {
4545
return 1;
4646
}
@@ -57,19 +57,22 @@ int forwardDecl() {
5757
[shader("library")]
5858
#endif // END of FAIL
5959

60-
// CHECK:HLSLShaderAttr 0x{{[0-9a-fA-F]+}} <line:61:2, col:18> Compute
61-
[shader("compute")]
60+
// CHECK:HLSLShaderAttr 0x{{[0-9a-fA-F]+}} <line:62:2, col:18> Compute
61+
// CHECK:HLSLNumThreadsAttr 0x{{[0-9a-fA-F]+}} <col:21, col:37> 8 1 1
62+
[shader("compute")][numthreads(8,1,1)]
6263
int entry() {
6364
return 1;
6465
}
6566

6667
// Because these two attributes match, they should both appear in the AST
67-
[shader("compute")]
68-
// CHECK:HLSLShaderAttr 0x{{[0-9a-fA-F]+}} <line:67:2, col:18> Compute
68+
[shader("compute")][numthreads(8,1,1)]
69+
// CHECK:HLSLShaderAttr 0x{{[0-9a-fA-F]+}} <line:68:2, col:18> Compute
70+
// CHECK:HLSLNumThreadsAttr 0x{{[0-9a-fA-F]+}} <col:21, col:37> 8 1 1
6971
int secondFn();
7072

71-
[shader("compute")]
72-
// CHECK:HLSLShaderAttr 0x{{[0-9a-fA-F]+}} <line:71:2, col:18> Compute
73+
[shader("compute")][numthreads(8,1,1)]
74+
// CHECK:HLSLShaderAttr 0x{{[0-9a-fA-F]+}} <line:73:2, col:18> Compute
75+
// CHECK:HLSLNumThreadsAttr 0x{{[0-9a-fA-F]+}} <col:21, col:37> 8 1 1
7376
int secondFn() {
7477
return 1;
7578
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -finclude-default-header -o - %s -verify
2+
3+
// expected-no-diagnostics
4+
5+
[shader("pixel")] void pixel() {}
6+
[shader("vertex")] void vertex() {}
7+
[shader("raygeneration")] void raygeneration() {}
8+
[shader("intersection")] void intersection() {}
9+
10+
[numthreads(1,1,1)][shader("compute")] void compute() {}
11+
[numthreads(1,1,1)][shader("mesh")] void mesh() {}
12+
13+
// Note: the rest of these have additional constraints that aren't implemented
14+
// yet, so here we just declare them to make sure the spelling works and
15+
// whatnot.
16+
[shader("geometry")] void geometry();
17+
[shader("hull")] void hull();
18+
[shader("domain")] void domain();
19+
[shader("callable")] void callable();
20+
[shader("closesthit")] void closesthit();
21+
[shader("anyhit")] void anyhit();
22+
[shader("miss")] void miss();
23+
24+
[numthreads(1,1,1)][shader("amplification")] void amplification();

0 commit comments

Comments
 (0)