nir: Add a little more docs about NIR's constant_data.
authorEric Anholt <eric@anholt.net>
Tue, 7 Jul 2020 19:25:13 +0000 (12:25 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 5 Aug 2020 04:35:05 +0000 (04:35 +0000)
I think everyone trips over "how does this relate to nir_const", and I was
curious if I could redefine the units of the constant_data_size / indirect
offsets.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6179>

src/compiler/nir/nir.h

index edae673bfa6d1683a03e97a14d9a2f91c6d4cca7..0f3578e7f8a5748e321c895cac249f1c7f25aad2 100644 (file)
@@ -3246,10 +3246,14 @@ typedef struct nir_shader {
 
    /** Constant data associated with this shader.
     *
 
    /** Constant data associated with this shader.
     *
-    * Constant data is loaded through load_constant intrinsics.  See also
-    * nir_opt_large_constants.
+    * Constant data is loaded through load_constant intrinsics (as compared to
+    * the NIR load_const instructions which have the constant value inlined
+    * into them).  This is usually generated by nir_opt_large_constants (so
+    * shaders don't have to load_const into a temporary array when they want
+    * to indirect on a const array).
     */
    void *constant_data;
     */
    void *constant_data;
+   /** Size of the constant data associated with the shader, in bytes */
    unsigned constant_data_size;
 } nir_shader;
 
    unsigned constant_data_size;
 } nir_shader;