From 5b73b55a7655ae26e2c88eb9b62863a204fe7937 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Fri, 31 May 2024 14:31:26 -0400 Subject: [PATCH] fix documentation --- clang/include/clang/Basic/AttrDocs.td | 66 +++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index d84af9402d6db..2776ae9ead55c 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -7344,7 +7344,7 @@ where shaders must be compiled into a library and linked at runtime. def HLSLLoopHintDocs : Documentation { let Category = DocCatStmt; - let Heading = "#[loop]"; + let Heading = "[loop]"; let Content = [{ The ``[loop]`` directive allows loop optimization hints to be specified for the subsequent loop. The directive allows unrolling to @@ -7360,15 +7360,28 @@ unroller to not unroll the loop. ... } -See `hlsl loop extensions -`_ +.. code-block:: hlsl + + [loop] + while (...) { + ... + } + +.. code-block:: hlsl + + [loop] + do { + ... + } while (...) + +See `hlsl loop extensions `_ for details. }]; } def HLSLUnrollHintDocs : Documentation { let Category = DocCatStmt; - let Heading = "[unroll(x)]"; + let Heading = "[unroll(x)], [unroll]"; let Content = [{ Loop unrolling optimization hints can be specified with ``[unroll(x)]`` . The attribute is placed immediately before a for, while, @@ -7382,9 +7395,43 @@ unroller to unroll the loop ``_value_`` times. Note: [unroll(x)] is not compatib for (...) { ... } -See -`hlsl loop extensions -`_ + +.. code-block:: hlsl + + [unroll] + for (...) { + ... + } + +.. code-block:: hlsl + + [unroll(4)] + while (...) { + ... + } + +.. code-block:: hlsl + + [unroll] + while (...) { + ... + } + +.. code-block:: hlsl + + [unroll(4)] + do { + ... + } while (...) + +.. code-block:: hlsl + + [unroll] + do { + ... + } while (...) + +See `hlsl loop extensions `_ for details. }]; } @@ -7448,7 +7495,8 @@ b for constant buffer views (CBV). Register space is specified in the format ``space[number]`` and defaults to ``space0`` if omitted. Here're resource binding examples with and without space: -.. code-block:: c++ + +.. code-block:: hlsl RWBuffer Uav : register(u3, space1); Buffer Buf : register(t1); @@ -7466,7 +7514,7 @@ A subcomponent is a register number, which is an integer. A component is in the Examples: -.. code-block:: c++ +.. code-block:: hlsl cbuffer A { float3 a : packoffset(c0.y);