================
@@ -2,15 +2,18 @@
 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-mesh -hlsl-entry CSMain -x 
hlsl -finclude-default-header  -verify -o - %s
 
 [numthreads(8,8,1)]
-// expected-error@+3 {{attribute 'SV_GroupIndex' is unsupported in 'mesh' 
shaders, requires compute}}
-// expected-error@+2 {{attribute 'SV_DispatchThreadID' is unsupported in 
'mesh' shaders, requires compute}}
-// expected-error@+1 {{attribute 'SV_GroupID' is unsupported in 'mesh' 
shaders, requires compute}}
-void CSMain(int GI : SV_GroupIndex, uint ID : SV_DispatchThreadID, uint GID : 
SV_GroupID) {
-// CHECK: FunctionDecl 0x{{[0-9a-fA-F]+}} <{{.*}}> line:[[@LINE-1]]:6 CSMain 
'void (int, uint, uint)'
+// expected-error@+4 {{attribute 'SV_GroupIndex' is unsupported in 'mesh' 
shaders, requires compute}}
+// expected-error@+3 {{attribute 'SV_DispatchThreadID' is unsupported in 
'mesh' shaders, requires compute}}
+// expected-error@+2 {{attribute 'SV_GroupID' is unsupported in 'mesh' 
shaders, requires compute}}
+// expected-error@+1 {{attribute 'SV_GroupThreadID' is unsupported in 'mesh' 
shaders, requires compute}}
+void CSMain(int GI : SV_GroupIndex, uint ID : SV_DispatchThreadID, uint GID : 
SV_GroupID, uint GThreadID : SV_GroupThreadID) {
----------------
lizhengxing wrote:

@tex3d  Yes, you're right. I checked the spec 
https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html .  Those 4 
attributes are legal for the mesh shader.

I think that they are legal for the amplification shader as well.

It looks like that we did something wrong in 
`SemaHLSL::CheckSemanticAnnotation` function
```
  switch (AnnotationAttr->getKind()) {
  case attr::HLSLSV_DispatchThreadID:
  case attr::HLSLSV_GroupIndex:
  case attr::HLSLSV_GroupThreadID:
  case attr::HLSLSV_GroupID:
    if (ST == llvm::Triple::Compute)
      return;
    DiagnoseAttrStageMismatch(AnnotationAttr, ST, {llvm::Triple::Compute});
    break;
```
We only check `Compute Shader` triple. I think that we should add checks for  
`Mesh Shader` and `Amplification Shader` triples here. Right?

https://github.com/llvm/llvm-project/pull/117781
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to