mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
glsl_to_nir: support conversion of struct/array function params
This adds support for array and struct function params 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
7afce96b80
commit
fac9b1c594
2 changed files with 15 additions and 14 deletions
|
|
@ -664,9 +664,6 @@ nir_visitor::create_function(ir_function_signature *ir)
|
|||
}
|
||||
|
||||
foreach_in_list(ir_variable, param, &ir->parameters) {
|
||||
/* FINISHME: pass arrays, structs, etc by reference? */
|
||||
assert(glsl_type_is_vector(param->type) || glsl_type_is_scalar(param->type));
|
||||
|
||||
func->params[np].num_components = 1;
|
||||
func->params[np].bit_size = 32;
|
||||
np++;
|
||||
|
|
@ -1526,9 +1523,13 @@ nir_visitor::visit(ir_call *ir)
|
|||
|
||||
if (sig_param->data.mode == ir_var_function_in ||
|
||||
sig_param->data.mode == ir_var_function_inout) {
|
||||
nir_store_deref(&b, param_deref,
|
||||
evaluate_rvalue(param_rvalue),
|
||||
~0);
|
||||
if (glsl_type_is_vector_or_scalar(param->type)) {
|
||||
nir_store_deref(&b, param_deref,
|
||||
evaluate_rvalue(param_rvalue),
|
||||
~0);
|
||||
} else {
|
||||
nir_copy_deref(&b, param_deref, evaluate_deref(param_rvalue));
|
||||
}
|
||||
}
|
||||
|
||||
call->params[i] = nir_src_for_ssa(¶m_deref->def);
|
||||
|
|
@ -1549,9 +1550,14 @@ nir_visitor::visit(ir_call *ir)
|
|||
|
||||
if (sig_param->data.mode == ir_var_function_out ||
|
||||
sig_param->data.mode == ir_var_function_inout) {
|
||||
nir_store_deref(&b, evaluate_deref(param_rvalue),
|
||||
nir_load_deref(&b, nir_src_as_deref(call->params[i])),
|
||||
~0);
|
||||
if (glsl_type_is_vector_or_scalar(sig_param->type)) {
|
||||
nir_store_deref(&b, evaluate_deref(param_rvalue),
|
||||
nir_load_deref(&b, nir_src_as_deref(call->params[i])),
|
||||
~0);
|
||||
} else {
|
||||
nir_copy_deref(&b, evaluate_deref(param_rvalue),
|
||||
nir_src_as_deref(call->params[i]));
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
|
|
|
|||
|
|
@ -2601,11 +2601,6 @@ public:
|
|||
return visit_continue;
|
||||
|
||||
foreach_in_list(ir_variable, param, &ir->parameters) {
|
||||
if (!glsl_type_is_vector_or_scalar(param->type)) {
|
||||
unsupported = true;
|
||||
return visit_stop;
|
||||
}
|
||||
|
||||
if (param->data.mode != ir_var_function_in &&
|
||||
param->data.mode != ir_var_const_in)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue