nir/inline_functions: Break inlining into a builder helper
This pulls the guts of function inlining into a builder helper so that it can be used elsewhere. The rest of the infrastructure is still needed for most inlining cases to ensure that everything gets inlined and only ever once. However, there are use-cases where you just want to inline one little thing. This new helper also has a neat trick where it can seamlessly inline a function from one nir_shader into another. Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
committed by
Jason Ekstrand
parent
0a6b1d0580
commit
de8d80f9cc
@@ -656,13 +656,12 @@ clone_function_impl(clone_state *state, const nir_function_impl *fi)
|
||||
}
|
||||
|
||||
nir_function_impl *
|
||||
nir_function_impl_clone(const nir_function_impl *fi)
|
||||
nir_function_impl_clone(nir_shader *shader, const nir_function_impl *fi)
|
||||
{
|
||||
clone_state state;
|
||||
init_clone_state(&state, NULL, false, false);
|
||||
|
||||
/* We use the same shader */
|
||||
state.ns = fi->function->shader;
|
||||
state.ns = shader;
|
||||
|
||||
nir_function_impl *nfi = clone_function_impl(&state, fi);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user