[clang] [Doc][HLSL] Add documentation for root signature. (PR #83933)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 17:18:52 PST 2024


================
@@ -0,0 +1,210 @@
+====================
+HLSL Root Signatures
+====================
+
+.. contents::
+   :local:
+
+Usage
+=====
+
+In HLSL, the `root signature
+<https://learn.microsoft.com/en-us/windows/win32/direct3d12/root-signatures>`_ 
+defines what types of resources are bound to the graphics pipeline. 
+
+A root signature can be specified in HLSL as a `string
+<https://learn.microsoft.com/en-us/windows/win32/direct3d12/specifying-root-signatures-in-hlsl#an-example-hlsl-root-signature>`_. 
+The string contains a collection of comma-separated clauses that describe root 
+signature constituent components. 
+
+There are two mechanisms to compile an HLSL root signature. First, it is 
+possible to attach a root signature string to a particular shader via the 
+RootSignature attribute (in the following example, using the MyRS1 entry 
+point):
+
+.. code-block:: c++
+
+    [RootSignature(MyRS1)]
----------------
damyanp wrote:

It would be nice to see a more complete example in here that specifies a root signature.  I think that the `MyRS1` thing only works from the example in the docs because there's a `#define MyRS1 "..."` earlier on in the example.  Does `MyRS1` really mean anything special to the compiler?

It looks like there's some special rules around the `-T rootsig_1_1` case that applies special meaning to "Entry Point" and assumptions about preprocessor defines, but the `RootSignature` attribute itself in source code just takes a string.

https://github.com/llvm/llvm-project/pull/83933


More information about the cfe-commits mailing list