diff options
author | Jason Ekstrand <[email protected]> | 2015-10-22 16:53:27 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-11-07 08:41:35 -0800 |
commit | c839174d55216cf1da5cdc4bf0f735ab8359d221 (patch) | |
tree | 0e65500fe49d05c348928b82401c65414e00d857 | |
parent | d57ede92b7832f01df2aa5755c8c34b4de4866d4 (diff) |
nir/validate: Add better validation of load/store types
Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r-- | src/glsl/nir/nir_validate.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c index c6fedf9b1ad..a42e830fd72 100644 --- a/src/glsl/nir/nir_validate.c +++ b/src/glsl/nir/nir_validate.c @@ -398,15 +398,27 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state) } switch (instr->intrinsic) { - case nir_intrinsic_load_var: + case nir_intrinsic_load_var: { + const struct glsl_type *type = + nir_deref_tail(&instr->variables[0]->deref)->type; + assert(glsl_type_is_vector_or_scalar(type)); + assert(instr->num_components == glsl_get_vector_elements(type)); assert(instr->variables[0]->var->data.mode != nir_var_shader_out); break; - case nir_intrinsic_store_var: + } + case nir_intrinsic_store_var: { + const struct glsl_type *type = + nir_deref_tail(&instr->variables[0]->deref)->type; + assert(glsl_type_is_vector_or_scalar(type)); + assert(instr->num_components == glsl_get_vector_elements(type)); assert(instr->variables[0]->var->data.mode != nir_var_shader_in && instr->variables[0]->var->data.mode != nir_var_uniform && instr->variables[0]->var->data.mode != nir_var_shader_storage); break; + } case nir_intrinsic_copy_var: + assert(nir_deref_tail(&instr->variables[0]->deref)->type == + nir_deref_tail(&instr->variables[1]->deref)->type); assert(instr->variables[0]->var->data.mode != nir_var_shader_in && instr->variables[0]->var->data.mode != nir_var_uniform && instr->variables[0]->var->data.mode != nir_var_shader_storage); |