[PATCH] D123907: [HLSL] Add shader attribute

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 16 22:58:15 PDT 2022


python3kgae created this revision.
python3kgae added reviewers: aaron.ballman, rnk, jdoerfert, MaskRay, rsmith.
Herald added a subscriber: StephenFan.
Herald added a project: All.
python3kgae requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Shader attribute is for shader library identify entry functions.
Here's an example,

[shader("pixel")]
float ps_main() : SV_Target {

  return 1;

}

When compile this shader to library target like -E lib_6_3, compiler needs to know ps_main is an entry function for pixel shader. Shader attribute is to offer the information.

A new attribute HLSLShader is added to support shader attribute. It has an EnumArgument which included all possible shader stages.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123907

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/SemaHLSL/shader_attr.hlsl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123907.423279.patch
Type: text/x-patch
Size: 8227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220417/0475f35b/attachment.bin>


More information about the cfe-commits mailing list