diff options
Diffstat (limited to 'src/compiler/nir/nir_validate.c')
-rw-r--r-- | src/compiler/nir/nir_validate.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 5144886c926..ffee4b54621 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -547,6 +547,15 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state) unsigned dest_bit_size = 0; unsigned src_bit_sizes[NIR_INTRINSIC_MAX_INPUTS] = { 0, }; switch (instr->intrinsic) { + case nir_intrinsic_load_param: { + unsigned param_idx = nir_intrinsic_param_idx(instr); + validate_assert(state, param_idx < state->impl->function->num_params); + nir_parameter *param = &state->impl->function->params[param_idx]; + validate_assert(state, instr->num_components == param->num_components); + dest_bit_size = param->bit_size; + break; + } + case nir_intrinsic_load_deref: { nir_deref_instr *src = nir_src_as_deref(instr->src[0]); validate_assert(state, glsl_type_is_vector_or_scalar(src->type) || @@ -669,18 +678,12 @@ validate_tex_instr(nir_tex_instr *instr, validate_state *state) static void validate_call_instr(nir_call_instr *instr, validate_state *state) { - if (instr->return_deref == NULL) { - validate_assert(state, glsl_type_is_void(instr->callee->return_type)); - } else { - validate_assert(state, instr->return_deref->deref.type == instr->callee->return_type); - validate_deref_var(instr, instr->return_deref, state); - } - validate_assert(state, instr->num_params == instr->callee->num_params); for (unsigned i = 0; i < instr->num_params; i++) { - validate_assert(state, instr->callee->params[i].type == instr->params[i]->deref.type); - validate_deref_var(instr, instr->params[i], state); + validate_src(&instr->params[i], state, + instr->callee->params[i].bit_size, + instr->callee->params[i].num_components); } } @@ -1167,23 +1170,6 @@ validate_function_impl(nir_function_impl *impl, validate_state *state) validate_assert(state, impl->function->impl == impl); validate_assert(state, impl->cf_node.parent == NULL); - validate_assert(state, impl->num_params == impl->function->num_params); - for (unsigned i = 0; i < impl->num_params; i++) { - validate_assert(state, impl->params[i]->type == impl->function->params[i].type); - validate_assert(state, impl->params[i]->data.mode == nir_var_param); - validate_assert(state, impl->params[i]->data.location == i); - validate_var_decl(impl->params[i], false, state); - } - - if (glsl_type_is_void(impl->function->return_type)) { - validate_assert(state, impl->return_var == NULL); - } else { - validate_assert(state, impl->return_var->type == impl->function->return_type); - validate_assert(state, impl->return_var->data.mode == nir_var_param); - validate_assert(state, impl->return_var->data.location == -1); - validate_var_decl(impl->return_var, false, state); - } - validate_assert(state, exec_list_is_empty(&impl->end_block->instr_list)); validate_assert(state, impl->end_block->successors[0] == NULL); validate_assert(state, impl->end_block->successors[1] == NULL); |