diff options
author | Rob Clark <[email protected]> | 2015-10-19 11:57:51 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-11-19 20:03:32 -0500 |
commit | 006e4f070f08ff1e1731863940bc51de9e97b865 (patch) | |
tree | b1b59e8001998e2b6dc5924e2b310bcf1a171304 /src | |
parent | 769b3ab6c5111f50502f9df0e8930c8d13f475c7 (diff) |
nir: add nir_var_all enum
Otherwise, passing -1 gets you:
error: invalid conversion from 'int' to 'nir_variable_mode' [-fpermissive]
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/nir/nir.c | 4 | ||||
-rw-r--r-- | src/glsl/nir/nir.h | 1 | ||||
-rw-r--r-- | src/glsl/nir/nir_lower_io.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_nir.c | 2 |
4 files changed, 7 insertions, 2 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index 93c18fbaea5..dba18c96a90 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -107,6 +107,10 @@ void nir_shader_add_variable(nir_shader *shader, nir_variable *var) { switch (var->data.mode) { + case nir_var_all: + assert(!"invalid mode"); + break; + case nir_var_local: assert(!"nir_shader_add_variable cannot be used for local variables"); break; diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index e9d722eed7e..09eb712c06a 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -82,6 +82,7 @@ typedef struct { } nir_state_slot; typedef enum { + nir_var_all = -1, nir_var_shader_in, nir_var_shader_out, nir_var_global, diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c index 00a31458310..5683e69d865 100644 --- a/src/glsl/nir/nir_lower_io.c +++ b/src/glsl/nir/nir_lower_io.c @@ -197,7 +197,7 @@ nir_lower_io_block(nir_block *block, void *void_state) nir_variable_mode mode = intrin->variables[0]->var->data.mode; - if (state->mode != -1 && state->mode != mode) + if (state->mode != nir_var_all && state->mode != mode) continue; if (mode != nir_var_shader_in && diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c index 7896f29803b..bd91254f5bf 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.c +++ b/src/mesa/drivers/dri/i965/brw_nir.c @@ -290,7 +290,7 @@ brw_create_nir(struct brw_context *brw, nir_assign_var_locations(&nir->uniforms, &nir->num_uniforms, is_scalar ? type_size_scalar : type_size_vec4); - OPT_V(nir_lower_io, -1, is_scalar ? type_size_scalar : type_size_vec4); + OPT_V(nir_lower_io, nir_var_all, is_scalar ? type_size_scalar : type_size_vec4); OPT(nir_remove_dead_variables); |