Commit d24c35c3 authored by Danylo Piliaiev's avatar Danylo Piliaiev Committed by Eric Anholt

st: Sweep NIR after linking phase to free held memory

After optimization passes and many trasfromations most of memory
NIR holds is a garbage which was being freed only after shader deletion.
Freeing it at the end of linking will save memory which would be useful
in case there are a lot of complex shaders being compiled.
The common case for this issue is 32bit game running under Wine.

The cost of the optimization is around ~3-5% of compilation speed
with complex shaders.
Signed-off-by: Danylo Piliaiev's avatarDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
parent 945524ba
......@@ -773,6 +773,8 @@ st_link_nir(struct gl_context *ctx,
_mesa_reference_program(ctx, &shader->Program, NULL);
return false;
}
nir_sweep(shader->Program->nir);
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment