Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
assert(!"nir_shader_add_variable cannot be used for local variables");
break;
+ case nir_var_param:
+ assert(!"nir_shader_add_variable cannot be used for function parameters");
+ break;
+
case nir_var_global:
exec_list_push_tail(&shader->globals, &var->node);
break;
nir_var_local,
nir_var_uniform,
nir_var_shader_storage,
- nir_var_system_value
+ nir_var_system_value,
+ nir_var_param,
} nir_variable_mode;
/**
#define nir_foreach_variable(var, var_list) \
foreach_list_typed(nir_variable, var, node, var_list)
+static inline bool
+nir_variable_is_global(const nir_variable *var)
+{
+ return var->data.mode != nir_var_local && var->data.mode != nir_var_param;
+}
+
typedef struct nir_register {
struct exec_node node;
static void
validate_var_decl(nir_variable *var, bool is_global, validate_state *state)
{
- assert(is_global != (var->data.mode == nir_var_local));
+ assert(is_global == nir_variable_is_global(var));
/*
* TODO validate some things ir_validate.cpp does (requires more GLSL type