summaryrefslogtreecommitdiff
path: root/docs/nir
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2023-08-20 20:42:34 +0300
committerMarge Bot <emma+marge@anholt.net>2023-10-26 16:13:26 +0000
commiteabd93bba8e8bb2330412ae5997855e948b028a1 (patch)
treea9cca68791cca9254c3b282d9ce8ef23521d2f47 /docs/nir
parent082e7d23e7b6aee41f87ce3ad806a71fc0ef8fdf (diff)
docs/nir: use hawkmoth instead of doxygen
Use the hawkmoth c:auto* directives to incorporate nir documentation. Convert @param style parameter descriptions to rst info field lists. Add static stubs for generated headers. Fix a lot of references, in particular the symbols are now in the Sphinx C domain, not C++ domain. Tweak syntax here and there. Based on the earlier work by Erik Faye-Lund <kusmabite@gmail.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24507>
Diffstat (limited to 'docs/nir')
-rw-r--r--docs/nir/alu.rst17
-rw-r--r--docs/nir/tex.rst54
2 files changed, 44 insertions, 27 deletions
diff --git a/docs/nir/alu.rst b/docs/nir/alu.rst
index 4b1eb3c53e1..ad91c5bee3c 100644
--- a/docs/nir/alu.rst
+++ b/docs/nir/alu.rst
@@ -9,13 +9,13 @@ identical output. A good rule of thumb is that only things which can be
constant folded should be ALU operations. If it can't be constant folded, then
it should probably be an intrinsic instead.
-Each ALU instruction has an opcode, which is a member of the :cpp:enum:`nir_op`
+Each ALU instruction has an opcode, which is a member of the :c:enum:`nir_op`
enum, that describes what it does as well as how many arguments it takes.
Associated with each opcode is an metadata structure,
-:cpp:struct:`nir_op_info`, which shows how many arguments the opcode takes,
+:c:struct:`nir_op_info`, which shows how many arguments the opcode takes,
information about data types, and algebraic properties such as associativity
and commutativity. The info structure for each opcode may be accessed through
-a global :cpp:var:`nir_op_infos` array that’s indexed by the opcode.
+a global :c:var:`nir_op_infos` array that’s indexed by the opcode.
ALU operations are typeless, meaning that they're only defined to convert
a certain bit-pattern input to another bit-pattern output. The only concrete
@@ -48,21 +48,22 @@ components required by each source which is fixed by the opcode.
While most instruction types in NIR require vector sizes to perfectly match on
inputs and outputs, ALU instruction sources have an additional
-:cpp:member:`nir_alu_src::swizzle` field which allows them to act on vectors
+:c:member:`nir_alu_src.swizzle` field which allows them to act on vectors
which are not the native vector size of the instruction. This is ideal for
hardware with a native data type of `vec4` but also means that ALU
instructions are often used (and required) for packing/unpacking vectors for
use in other instruction types like intrinsics or texture ops.
-.. doxygenstruct:: nir_op_info
+.. c:autostruct:: nir_op_info
+ :file: src/compiler/nir/nir.h
:members:
-.. doxygenvariable:: nir_op_infos
+.. c:autovar:: nir_op_infos
-.. doxygenstruct:: nir_alu_instr
+.. c:autostruct:: nir_alu_instr
:members:
-.. doxygenstruct:: nir_alu_src
+.. c:autostruct:: nir_alu_src
:members:
NIR ALU Opcode Reference:
diff --git a/docs/nir/tex.rst b/docs/nir/tex.rst
index 492142ae18a..a21330fd682 100644
--- a/docs/nir/tex.rst
+++ b/docs/nir/tex.rst
@@ -5,14 +5,17 @@ Even though texture instructions *could* be supported as intrinsics, the vast
number of combinations mean that doing so is practically impossible. Instead,
NIR has a dedicated texture instruction. There are several texture operations:
-.. doxygenenum:: nir_texop
+.. c:autoenum:: nir_texop
+ :file: src/compiler/nir/nir.h
+ :members:
As with other instruction types, there is still an array of sources, except
that each source also has a *type* associated with it. There are various
source types, each corresponding to a piece of information that the different
texture operations require.
-.. doxygenenum:: nir_tex_src_type
+.. c:autoenum:: nir_tex_src_type
+ :members:
Of particular interest are the texture/sampler deref/index/handle source types.
First, note that textures and samplers are specified separately in NIR. While
@@ -28,12 +31,12 @@ Also, like a lot of other resources, there are multiple ways to represent a
texture in NIR. It can be referenced by a variable dereference, an index, or a
bindless handle. When using an index or a bindless handle, the texture type
information is generally not available. To handle this, various information
-from the type is redundantly stored in the :cpp:struct:`nir_tex_instr` itself.
+from the type is redundantly stored in the :c:struct:`nir_tex_instr` itself.
-.. doxygenstruct:: nir_tex_instr
+.. c:autostruct:: nir_tex_instr
:members:
-.. doxygenstruct:: nir_tex_src
+.. c:autostruct:: nir_tex_src
:members:
Texture instruction helpers
@@ -42,17 +45,27 @@ Texture instruction helpers
There are a number of helper functions for working with NIR texture
instructions. They are documented here in no particular order.
-.. doxygenfunction:: nir_tex_instr_create
-.. doxygenfunction:: nir_tex_instr_need_sampler
-.. doxygenfunction:: nir_tex_instr_result_size
-.. doxygenfunction:: nir_tex_instr_dest_size
-.. doxygenfunction:: nir_tex_instr_is_query
-.. doxygenfunction:: nir_tex_instr_has_implicit_derivative
-.. doxygenfunction:: nir_tex_instr_src_type
-.. doxygenfunction:: nir_tex_instr_src_size
-.. doxygenfunction:: nir_tex_instr_src_index
-.. doxygenfunction:: nir_tex_instr_add_src
-.. doxygenfunction:: nir_tex_instr_remove_src
+.. c:autofunction:: nir_tex_instr_create
+
+.. c:autofunction:: nir_tex_instr_need_sampler
+
+.. c:autofunction:: nir_tex_instr_result_size
+
+.. c:autofunction:: nir_tex_instr_dest_size
+
+.. c:autofunction:: nir_tex_instr_is_query
+
+.. c:autofunction:: nir_tex_instr_has_implicit_derivative
+
+.. c:autofunction:: nir_tex_instr_src_type
+
+.. c:autofunction:: nir_tex_instr_src_size
+
+.. c:autofunction:: nir_tex_instr_src_index
+
+.. c:autofunction:: nir_tex_instr_add_src
+
+.. c:autofunction:: nir_tex_instr_remove_src
Texture instruction lowering
----------------------------
@@ -61,7 +74,10 @@ Because most hardware only supports some subset of all possible GLSL/SPIR-V
texture operations, NIR provides a quite powerful lowering pass which is able
to implement more complex texture operations in terms of simpler ones.
-.. doxygenfunction:: nir_lower_tex
-.. doxygenstruct:: nir_lower_tex_options
+.. c:autofunction:: nir_lower_tex
+
+.. c:autostruct:: nir_lower_tex_options
+ :members:
+
+.. c:autoenum:: nir_lower_tex_packing
:members:
-.. doxygenenum:: nir_lower_tex_packing