From c14f823ee5e109a0051225a24685e3fa015abb49 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Tue, 19 Mar 2019 20:24:35 +0000 Subject: [PATCH] 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 Reviewed-by: Connor Abbott Reviewed-by: Jason Ekstrand --- 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? -- 2.30.2