Skip to content

Commit

Permalink
fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
farzonl committed May 31, 2024
1 parent f1fc152 commit 5b73b55
Showing 1 changed file with 57 additions and 9 deletions.
66 changes: 57 additions & 9 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -7360,15 +7360,28 @@ unroller to not unroll the loop.
...
}

See `hlsl loop extensions
<https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-for>`_
.. code-block:: hlsl

[loop]
while (...) {
...
}

.. code-block:: hlsl

[loop]
do {
...
} while (...)

See `hlsl loop extensions <https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-for>`_
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,
Expand All @@ -7382,9 +7395,43 @@ unroller to unroll the loop ``_value_`` times. Note: [unroll(x)] is not compatib
for (...) {
...
}
See
`hlsl loop extensions
<https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-for>`_

.. 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 <https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-for>`_
for details.
}];
}
Expand Down Expand Up @@ -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<float> Uav : register(u3, space1);
Buffer<float> Buf : register(t1);
Expand All @@ -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);
Expand Down

0 comments on commit 5b73b55

Please sign in to comment.