Mesa (main): nir_lower_io: propagate the "invariant" flag to outputs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 7 17:27:01 UTC 2022


Module: Mesa
Branch: main
Commit: 6f348d9c9902a6268bc54f5c7f0b0e090cee55d4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f348d9c9902a6268bc54f5c7f0b0e090cee55d4

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Tue Dec 14 12:22:48 2021 +0100

nir_lower_io: propagate the "invariant" flag to outputs

Ultimately this is consumed by nir-to-tgsi and needed by virglrenderer
to correctly declare output variables.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14423>

---

 src/compiler/nir/nir.h          | 3 ++-
 src/compiler/nir/nir_lower_io.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 44d62e8a228..7d79102576b 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1765,7 +1765,8 @@ typedef struct nir_io_semantics {
    unsigned medium_precision:1; /* GLSL mediump qualifier */
    unsigned per_view:1;
    unsigned high_16bits:1; /* whether accessing low or high half of the slot */
-   unsigned _pad:6;
+   unsigned invariant:1; /* The variable has the invariant flag set */
+   unsigned _pad:5;
 } nir_io_semantics;
 
 #define NIR_INTRINSIC_MAX_INPUTS 11
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 32cfbc2288c..1df82eb7f24 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -450,6 +450,7 @@ emit_store(struct lower_io_state *state, nir_ssa_def *data,
       var->data.precision == GLSL_PRECISION_MEDIUM ||
       var->data.precision == GLSL_PRECISION_LOW;
    semantics.per_view = var->data.per_view;
+   semantics.invariant = var->data.invariant;
 
    /* NV_mesh_shader: prevent assigning several slots to primitive indices. */
    if (b->shader->info.stage == MESA_SHADER_MESH &&



More information about the mesa-commit mailing list