From faad82b4e7df536af360ad85d4ef261f9926b961 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 3 Dec 2014 14:47:17 -0800 Subject: [PATCH] nir/validate: Ensure that outputs are write-only and inputs are read-only Reviewed-by: Connor Abbott --- src/glsl/nir/nir_validate.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c index 0a015e43bba..73ca1b0e786 100644 --- a/src/glsl/nir/nir_validate.c +++ b/src/glsl/nir/nir_validate.c @@ -330,6 +330,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); } -- 2.30.2