Jelajahi Sumber

[spirv] Update doc for ByteAddressBuffer methods. (#652)

* [spirv] Update doc for ByteAddressBuffer methods.

* Better doc.
Ehsan 8 tahun lalu
induk
melakukan
746d8ea5ed
1 mengubah file dengan 32 tambahan dan 0 penghapusan
  1. 32 0
      docs/SPIR-V.rst

+ 32 - 0
docs/SPIR-V.rst

@@ -1211,6 +1211,17 @@ runtime array of unsigned integers, ``OpArrayLength`` is invoked on the runtime
 in order to find the number of unsigned integers. This is then multiplied by 4 to find
 in order to find the number of unsigned integers. This is then multiplied by 4 to find
 the number of bytes.
 the number of bytes.
 
 
+``.Load()``, ``.Load2()``, ``.Load3()``, ``.Load4()``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ByteAddressBuffers are represented as a struct with one member that is a runtime array of
+unsigned integers. The ``address`` argument passed to the function is first divided by 4
+in order to find the offset into the array (because each array element is 4 bytes). The
+SPIR-V ``OpAccessChain`` instruction is then used to access that offset, and ``OpLoad`` is
+used to load a 32-bit unsigned integer. For ``Load2``, ``Load3``, and ``Load4``, this is
+done 2, 3, and 4 times, respectively. Each time the word offset is incremented by 1 before
+performing ``OpAccessChain``. After all ``OpLoad`` operations are performed, a vector is
+constructed with all the resulting values.
+
 ``RWByteAddressBuffer``
 ``RWByteAddressBuffer``
 --------------------------
 --------------------------
 
 
@@ -1221,6 +1232,27 @@ runtime array of unsigned integers, ``OpArrayLength`` is invoked on the runtime
 in order to find the number of unsigned integers. This is then multiplied by 4 to find
 in order to find the number of unsigned integers. This is then multiplied by 4 to find
 the number of bytes.
 the number of bytes.
 
 
+``.Load()``, ``.Load2()``, ``.Load3()``, ``.Load4()``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+RWByteAddressBuffers are represented as a struct with one member that is a runtime array of
+unsigned integers. The ``address`` argument passed to the function is first divided by 4
+in order to find the offset into the array (because each array element is 4 bytes). The
+SPIR-V ``OpAccessChain`` instruction is then used to access that offset, and ``OpLoad`` is
+used to load a 32-bit unsigned integer. For ``Load2``, ``Load3``, and ``Load4``, this is
+done 2, 3, and 4 times, respectively. Each time the word offset is incremented by 1 before
+performing ``OpAccessChain``. After all ``OpLoad`` operations are performed, a vector is
+constructed with all the resulting values.
+
+``.Store()``, ``.Store2()``, ``.Store3()``, ``.Store4()``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+RWByteAddressBuffers are represented as a struct with one member that is a runtime array of
+unsigned integers. The ``address`` argument passed to the function is first divided by 4
+in order to find the offset into the array (because each array element is 4 bytes). The
+SPIR-V ``OpAccessChain`` instruction is then used to access that offset, and ``OpStore`` is
+used to store a 32-bit unsigned integer. For ``Store2``, ``Store3``, and ``Store4``, this is
+done 2, 3, and 4 times, respectively. Each time the word offset is incremented by 1 before
+performing ``OpAccessChain``.
+
 ``Texture1D``
 ``Texture1D``
 --------------------------
 --------------------------