mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 20:00:11 +01:00
glsl_to_nir: support conversion of struct/array function returns
This adds support for array and struct function returns in the glsl to nir pass allowing us to avoid extra calls to the glsl IR optimisation loop. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27108>
This commit is contained in:
parent
fac9b1c594
commit
de7574f70a
2 changed files with 13 additions and 10 deletions
|
|
@ -789,8 +789,11 @@ nir_visitor::visit(ir_return *ir)
|
|||
nir_build_deref_cast(&b, nir_load_param(&b, 0),
|
||||
nir_var_function_temp, ir->value->type, 0);
|
||||
|
||||
nir_def *val = evaluate_rvalue(ir->value);
|
||||
nir_store_deref(&b, ret_deref, val, ~0);
|
||||
if (glsl_type_is_vector_or_scalar(ir->value->type)) {
|
||||
nir_store_deref(&b, ret_deref, evaluate_rvalue(ir->value), ~0);
|
||||
} else {
|
||||
nir_copy_deref(&b, ret_deref, evaluate_deref(ir->value));
|
||||
}
|
||||
}
|
||||
|
||||
nir_jump_instr *instr = nir_jump_instr_create(this->shader, nir_jump_return);
|
||||
|
|
@ -1564,8 +1567,14 @@ nir_visitor::visit(ir_call *ir)
|
|||
}
|
||||
|
||||
|
||||
if (ir->return_deref)
|
||||
nir_store_deref(&b, evaluate_deref(ir->return_deref), nir_load_deref(&b, ret_deref), ~0);
|
||||
if (ir->return_deref) {
|
||||
if (glsl_type_is_vector_or_scalar(ir->return_deref->type)) {
|
||||
nir_store_deref(&b, evaluate_deref(ir->return_deref),
|
||||
nir_load_deref(&b, ret_deref), ~0);
|
||||
} else {
|
||||
nir_copy_deref(&b, evaluate_deref(ir->return_deref), ret_deref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -2633,12 +2633,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (!glsl_type_is_vector_or_scalar(ir->return_type) &&
|
||||
!glsl_type_is_void(ir->return_type)) {
|
||||
unsupported = true;
|
||||
return visit_stop;
|
||||
}
|
||||
|
||||
return visit_continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue