[PATCH] D130033: [HLSL] Add resource binding attribute for HLSL.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 04:12:40 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, only nits left that can be fixed when landing (no need for additional review).



================
Comment at: clang/include/clang/Basic/AttrDocs.td:6557-6560
+.. code-block:: c++
+  RWBuffer<float> Uav : register(u3, space1);
+  Buffer<float> Buf : register(t1);
+The full documentation is available here: https://docs.microsoft.com/en-us/windows/win32/direct3d12/resource-binding-in-hlsl
----------------
RST is very picky about that whitespace.


================
Comment at: clang/test/SemaHLSL/resource_binding_attr_error.hlsl:15
+// expected-error at +1 {{invalid space specifier 's2' used; expected 'space' followed by an integer, like space1}}
+cbuffer a : register(b0, s2) {
+
----------------
python3kgae wrote:
> aaron.ballman wrote:
> > Isn't this a re-definition of `a` which would cause an error?
> The name for cbuffer is not used.
> And no error should be reported for re-definition.
> 
> Discussed with the team, have to keep it like this for back-compat reason.
Wow.

Please either add a comment explaining why this bizarre situation gets no diagnostic, or change the identifiers used so nobody else gets confused by this when reading the test file.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130033/new/

https://reviews.llvm.org/D130033



More information about the cfe-commits mailing list