{
switch (type->base_type) {
case vtn_base_type_array:
+ case vtn_base_type_matrix:
return type->length * vtn_type_count_function_params(type->array_element);
case vtn_base_type_struct: {
switch (type->base_type) {
case vtn_base_type_array:
+ case vtn_base_type_matrix:
for (unsigned i = 0; i < type->length; i++)
vtn_type_add_to_function_params(type->array_element, func, param_idx);
break;
{
switch (type->base_type) {
case vtn_base_type_array:
+ case vtn_base_type_matrix:
for (unsigned i = 0; i < type->length; i++) {
vtn_ssa_value_add_to_call_params(b, value->elems[i],
type->array_element,
{
switch (type->base_type) {
case vtn_base_type_array:
+ case vtn_base_type_matrix:
for (unsigned i = 0; i < type->length; i++) {
vtn_ssa_value_load_function_param(b, value->elems[i],
type->array_element, param_idx);
struct vtn_type *ret_type = vtn_callee->type->return_type;
if (ret_type->base_type != vtn_base_type_void) {
nir_variable *ret_tmp =
- nir_local_variable_create(b->nb.impl, ret_type->type, "return_tmp");
+ nir_local_variable_create(b->nb.impl,
+ glsl_get_bare_type(ret_type->type),
+ "return_tmp");
ret_deref = nir_build_deref_var(&b->nb, ret_tmp);
call->params[param_idx++] = nir_src_for_ssa(&ret_deref->dest.ssa);
}
vtn_base_type_void,
"Return with a value from a function returning void");
struct vtn_ssa_value *src = vtn_ssa_value(b, block->branch[1]);
+ const struct glsl_type *ret_type =
+ glsl_get_bare_type(b->func->type->return_type->type);
nir_deref_instr *ret_deref =
nir_build_deref_cast(&b->nb, nir_load_param(&b->nb, 0),
- nir_var_local, src->type);
+ nir_var_local, ret_type, 0);
vtn_local_store(b, src, ret_deref);
}
vtn_foreach_instruction(b, func->start_block->label, func->end,
vtn_handle_phi_second_pass);
+ nir_rematerialize_derefs_in_use_blocks_impl(func->impl);
+
/* Continue blocks for loops get inserted before the body of the loop
* but instructions in the continue may use SSA defs in the loop body.
* Therefore, we need to repair SSA to insert the needed phi nodes.