mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 15:48:36 +02:00
nir: Use STACK_ARRAY instead of NIR_VLA
The number of fields comes from the shader, so it could be a value large enough that using alloca would be problematic. Fixes:c11833ab24("nir,spirv: Rework function calls") Reviewed-by: Caio Oliveira <caio.oliveira@intel.com> Reviewed-by: Ryan Neph <ryanneph@google.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (cherry picked from commit9017d37e84) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
parent
978fd42b4b
commit
45ce75f3bc
2 changed files with 4 additions and 3 deletions
|
|
@ -4544,7 +4544,7 @@
|
|||
"description": "nir: Use STACK_ARRAY instead of NIR_VLA",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "c11833ab24dcba26de1b0a5805e35a5d6761514e",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
*/
|
||||
|
||||
#include "util/u_printf.h"
|
||||
#include "util/stack_array.h"
|
||||
#include "nir.h"
|
||||
#include "nir_builder.h"
|
||||
#include "nir_control_flow.h"
|
||||
#include "nir_vla.h"
|
||||
|
||||
/*
|
||||
* TODO: write a proper inliner for GPUs.
|
||||
|
|
@ -240,12 +240,13 @@ inline_functions_pass(nir_builder *b,
|
|||
* to an SSA value first.
|
||||
*/
|
||||
const unsigned num_params = call->num_params;
|
||||
NIR_VLA(nir_def *, params, num_params);
|
||||
STACK_ARRAY(nir_def *, params, num_params);
|
||||
for (unsigned i = 0; i < num_params; i++) {
|
||||
params[i] = call->params[i].ssa;
|
||||
}
|
||||
|
||||
nir_inline_function_impl(b, call->callee->impl, params, NULL);
|
||||
STACK_ARRAY_FINISH(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue