[HLSL] Add resource binding attribute for HLSL.
authorXiang Li <python3kgae@outlook.com>
Mon, 18 Jul 2022 18:50:25 +0000 (11:50 -0700)
committerXiang Li <python3kgae@outlook.com>
Thu, 22 Sep 2022 18:51:21 +0000 (11:51 -0700)
commite3fd0b20731f559ba90a9a32f6489499a63cf2b5
tree635e93f0f1cdde0c81a43235201770d0a9548f1e
parent91563c419e57e3e22de96122247ea27540b14659
[HLSL] Add resource binding attribute for HLSL.

The resource binding attribute is to set the virtual registers and logical register spaces resources in HLSL are bound to.
Format is ''register(ID,  space)'' like register(t3,  space1).
ID must be start with
t – for shader resource views (SRV),
s – for samplers,
u – for unordered access views (UAV),
b – for constant buffer views (CBV).

Register space is default to space0.

The full documentation is available here: https://docs.microsoft.com/en-us/windows/win32/direct3d12/resource-binding-in-hlsl

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D130033
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Parse/ParseHLSL.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/AST/HLSL/resource_binding_attr.hlsl [new file with mode: 0644]
clang/test/SemaHLSL/resource_binding_attr_error.hlsl [new file with mode: 0644]