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@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Rhys Perry 2019-03-19 20:24:35 +00:00
parent 01eb6ef870
commit c14f823ee5
2 changed files with 9 additions and 2 deletions

View 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;
}
}

View 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?