mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
nir: add nir_function_impl_clone_remap_globals()
This will be use by the glsl nir linker when we are combining different shaders from the same shader stage that might have multiple declarations of global variables across the different shaders. Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31137>
This commit is contained in:
parent
7a1061e0dd
commit
1cb115abd2
2 changed files with 16 additions and 3 deletions
|
|
@ -5203,6 +5203,10 @@ nir_shader *nir_shader_clone(void *mem_ctx, const nir_shader *s);
|
|||
nir_function *nir_function_clone(nir_shader *ns, const nir_function *fxn);
|
||||
nir_function_impl *nir_function_impl_clone(nir_shader *shader,
|
||||
const nir_function_impl *fi);
|
||||
nir_function_impl *
|
||||
nir_function_impl_clone_remap_globals(nir_shader *shader,
|
||||
const nir_function_impl *fi,
|
||||
struct hash_table *remap_table);
|
||||
nir_constant *nir_constant_clone(const nir_constant *c, nir_variable *var);
|
||||
nir_variable *nir_variable_clone(const nir_variable *c, nir_shader *shader);
|
||||
|
||||
|
|
|
|||
|
|
@ -675,20 +675,29 @@ clone_function_impl(clone_state *state, const nir_function_impl *fi)
|
|||
}
|
||||
|
||||
nir_function_impl *
|
||||
nir_function_impl_clone(nir_shader *shader, const nir_function_impl *fi)
|
||||
nir_function_impl_clone_remap_globals(nir_shader *shader,
|
||||
const nir_function_impl *fi,
|
||||
struct hash_table *remap_table)
|
||||
{
|
||||
clone_state state;
|
||||
init_clone_state(&state, NULL, false, false);
|
||||
init_clone_state(&state, remap_table, !!remap_table, false);
|
||||
|
||||
state.ns = shader;
|
||||
|
||||
nir_function_impl *nfi = clone_function_impl(&state, fi);
|
||||
|
||||
free_clone_state(&state);
|
||||
if (!remap_table)
|
||||
free_clone_state(&state);
|
||||
|
||||
return nfi;
|
||||
}
|
||||
|
||||
nir_function_impl *
|
||||
nir_function_impl_clone(nir_shader *shader, const nir_function_impl *fi)
|
||||
{
|
||||
return nir_function_impl_clone_remap_globals(shader, fi, NULL);
|
||||
}
|
||||
|
||||
nir_function *
|
||||
nir_function_clone(nir_shader *ns, const nir_function *fxn)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue