diff options
author | Timothy Arceri <tarceri@itsqueeze.com> | 2022-02-16 14:41:45 +1100 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-02-24 01:10:49 +0000 |
commit | 6eec8fcbfa6e90431d47919479debf76fb04b8b0 (patch) | |
tree | 7c5b0d8a7eba6b79e078baebcba41b2be4680e20 | |
parent | 0fda2ac4f09b81bc0dcd63ba9dd1c7134ffdb511 (diff) |
glsl/nir: free GLSL IR right after we convert to NIR
Gives us memory back faster which is useful for pathalogical CTS
tests.
The GLSL IR was previously used after converting to NIR for things
like building the GL resource list but we have had a NIR version
for this for some time and I don't believe there are any other
use cases left for keeping the old IR hanging around this long.
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15127>
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 43abb35812f..bbc0aa93ad6 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -224,6 +224,10 @@ glsl_to_nir(const struct gl_constants *consts, v2.run(sh->ir); visit_exec_list(sh->ir, &v1); + /* The GLSL IR won't be needed anymore. */ + ralloc_free(sh->ir); + sh->ir = NULL; + nir_validate_shader(shader, "after glsl to nir, before function inline"); /* We have to lower away local constant initializers right before we diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 6b27e61b10e..a15f6605e90 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -855,10 +855,6 @@ st_link_nir(struct gl_context *ctx, st_release_variants(st, prog); st_finalize_program(st, prog); - - /* The GLSL IR won't be needed anymore. */ - ralloc_free(shader->ir); - shader->ir = NULL; } return true; |