nir: add nir_num_variable_modes and nir_var_mem_push_const
authorRhys Perry <pendingchaos02@gmail.com>
Tue, 19 Mar 2019 20:24:35 +0000 (20:24 +0000)
committerRhys Perry <pendingchaos02@gmail.com>
Mon, 25 Nov 2019 13:59:11 +0000 (13:59 +0000)
These will be useful in the upcoming load/store vectorizer.

v11: rebase

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir.c
src/compiler/nir/nir.h

index 8a100e18dd8e388ef6870953b7d15e08d910ce54..552b42dd4e12cdbb724afdd61b6fb4e1950df4a4 100644 (file)
@@ -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;
    }
 }
 
index 1333a49c66fc64240cf4d3d1b1e4222f5fcda6ba..d9f3034cfe4f9d337f5dab57c50b8f3a39f82ced 100644 (file)
@@ -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?