summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2014-12-03 14:47:17 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2014-12-17 21:08:10 -0800
commit589bfdc2311d2957d9e095160d50b26863f3b091 (patch)
tree6a5f43d72b441513e9482b030b894b45475660d8
parent9c78159b6142031c28ec2ffbe5e5f546c72ca3d3 (diff)
nir/validate: Ensure that outputs are write-only and inputs are read-only
-rw-r--r--src/glsl/nir/nir_validate.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c
index 5579870df9..45b71e0023 100644
--- a/src/glsl/nir/nir_validate.c
+++ b/src/glsl/nir/nir_validate.c
@@ -337,6 +337,29 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
validate_deref_var(instr->variables[i], state);
}
+ switch (instr->intrinsic) {
+ case nir_intrinsic_load_var_vec1:
+ case nir_intrinsic_load_var_vec2:
+ case nir_intrinsic_load_var_vec3:
+ case nir_intrinsic_load_var_vec4:
+ assert(instr->variables[0]->var->data.mode != nir_var_shader_out);
+ break;
+ case nir_intrinsic_store_var_vec1:
+ case nir_intrinsic_store_var_vec2:
+ case nir_intrinsic_store_var_vec3:
+ case nir_intrinsic_store_var_vec4:
+ assert(instr->variables[0]->var->data.mode != nir_var_shader_in &&
+ instr->variables[0]->var->data.mode != nir_var_uniform);
+ break;
+ case nir_intrinsic_copy_var:
+ assert(instr->variables[0]->var->data.mode != nir_var_shader_in &&
+ instr->variables[0]->var->data.mode != nir_var_uniform);
+ assert(instr->variables[1]->var->data.mode != nir_var_shader_out);
+ break;
+ default:
+ break;
+ }
+
if (instr->has_predicate)
validate_src(&instr->predicate, state);
}