Mesa (master): nir: add nir_num_variable_modes and nir_var_mem_push_const

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 25 14:42:36 UTC 2019


Module: Mesa
Branch: master
Commit: c14f823ee5e109a0051225a24685e3fa015abb49
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c14f823ee5e109a0051225a24685e3fa015abb49

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Mar 19 20:24:35 2019 +0000

nir: add nir_num_variable_modes and nir_var_mem_push_const

These will be useful in the upcoming load/store vectorizer.

v11: rebase

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/compiler/nir/nir.c | 5 +++++
 src/compiler/nir/nir.h | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 8a100e18dd8..552b42dd4e1 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -108,6 +108,7 @@ void
 nir_shader_add_variable(nir_shader *shader, nir_variable *var)
 {
    switch (var->data.mode) {
+   case nir_num_variable_modes:
    case nir_var_all:
       assert(!"invalid mode");
       break;
@@ -146,6 +147,10 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)
    case nir_var_system_value:
       exec_list_push_tail(&shader->system_values, &var->node);
       break;
+
+   case nir_var_mem_push_const:
+      assert(!"nir_var_push_constant is not supposed to be used for variables");
+      break;
    }
 }
 
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 1333a49c66f..d9f3034cfe4 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -107,7 +107,9 @@ typedef enum {
    nir_var_mem_ssbo        = (1 << 7),
    nir_var_mem_shared      = (1 << 8),
    nir_var_mem_global      = (1 << 9),
-   nir_var_all             = (1 << 10) - 1,
+   nir_var_mem_push_const  = (1 << 10), /* not actually used for variables */
+   nir_num_variable_modes  = 11,
+   nir_var_all             = (1 << nir_num_variable_modes) - 1,
 } nir_variable_mode;
 
 /**
@@ -314,7 +316,7 @@ typedef struct nir_variable {
        *
        * \sa nir_variable_mode
        */
-      nir_variable_mode mode:10;
+      nir_variable_mode mode:11;
 
       /**
        * Is the variable read-only?




More information about the mesa-commit mailing list