[all-commits] [llvm/llvm-project] b02d88: [HLSL] Add shader attribute

Xiang Li via All-commits all-commits at lists.llvm.org
Wed Apr 20 23:46:58 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b02d88d5afb58f53b30cde31990cd2d355d6c597
  Author: Xiang Li <xiagli at microsoft.com>
  Date:   2022-04-20 (Wed, 20 Apr 2022)

  Changed paths:
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    A clang/test/SemaHLSL/shader_type_attr.hlsl

  Log Message:
  [HLSL] Add shader attribute

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

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.

Reviewed By: aaron.ballman, MaskRay

Differential Revision: https://reviews.llvm.org/D123907

More information about the All-commits mailing list