Skip to content

Commit 5b73b55

Browse files
committed
fix documentation
1 parent f1fc152 commit 5b73b55

File tree

1 file changed

+57
-9
lines changed

1 file changed

+57
-9
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7344,7 +7344,7 @@ where shaders must be compiled into a library and linked at runtime.
73447344

73457345
def HLSLLoopHintDocs : Documentation {
73467346
let Category = DocCatStmt;
7347-
let Heading = "#[loop]";
7347+
let Heading = "[loop]";
73487348
let Content = [{
73497349
The ``[loop]`` directive allows loop optimization hints to be
73507350
specified for the subsequent loop. The directive allows unrolling to
@@ -7360,15 +7360,28 @@ unroller to not unroll the loop.
73607360
...
73617361
}
73627362

7363-
See `hlsl loop extensions
7364-
<https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-for>`_
7363+
.. code-block:: hlsl
7364+
7365+
[loop]
7366+
while (...) {
7367+
...
7368+
}
7369+
7370+
.. code-block:: hlsl
7371+
7372+
[loop]
7373+
do {
7374+
...
7375+
} while (...)
7376+
7377+
See `hlsl loop extensions <https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-for>`_
73657378
for details.
73667379
}];
73677380
}
73687381

73697382
def HLSLUnrollHintDocs : Documentation {
73707383
let Category = DocCatStmt;
7371-
let Heading = "[unroll(x)]";
7384+
let Heading = "[unroll(x)], [unroll]";
73727385
let Content = [{
73737386
Loop unrolling optimization hints can be specified with ``[unroll(x)]``
73747387
. 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
73827395
for (...) {
73837396
...
73847397
}
7385-
See
7386-
`hlsl loop extensions
7387-
<https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-for>`_
7398+
7399+
.. code-block:: hlsl
7400+
7401+
[unroll]
7402+
for (...) {
7403+
...
7404+
}
7405+
7406+
.. code-block:: hlsl
7407+
7408+
[unroll(4)]
7409+
while (...) {
7410+
...
7411+
}
7412+
7413+
.. code-block:: hlsl
7414+
7415+
[unroll]
7416+
while (...) {
7417+
...
7418+
}
7419+
7420+
.. code-block:: hlsl
7421+
7422+
[unroll(4)]
7423+
do {
7424+
...
7425+
} while (...)
7426+
7427+
.. code-block:: hlsl
7428+
7429+
[unroll]
7430+
do {
7431+
...
7432+
} while (...)
7433+
7434+
See `hlsl loop extensions <https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-for>`_
73887435
for details.
73897436
}];
73907437
}
@@ -7448,7 +7495,8 @@ b for constant buffer views (CBV).
74487495

74497496
Register space is specified in the format ``space[number]`` and defaults to ``space0`` if omitted.
74507497
Here're resource binding examples with and without space:
7451-
.. code-block:: c++
7498+
7499+
.. code-block:: hlsl
74527500

74537501
RWBuffer<float> Uav : register(u3, space1);
74547502
Buffer<float> Buf : register(t1);
@@ -7466,7 +7514,7 @@ A subcomponent is a register number, which is an integer. A component is in the
74667514

74677515
Examples:
74687516

7469-
.. code-block:: c++
7517+
.. code-block:: hlsl
74707518

74717519
cbuffer A {
74727520
float3 a : packoffset(c0.y);

0 commit comments

Comments
 (0)