st/nir: Free the GLSL IR after linking.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 28 Mar 2019 06:09:11 +0000 (23:09 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 28 Mar 2019 16:31:12 +0000 (09:31 -0700)
i965 does this, and st's tgsi path does this.  st/nir did not.

Cuts 138MB of memory from a DiRT Rally trace, which is about 44%
of the total GLSL IR memory.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 78ca83c76e7a63205e12fcd05cd001248038d6e3..96fc257032eab589a19c01b0d9452e2dd88f41ae 100644 (file)
@@ -839,6 +839,10 @@ st_link_nir(struct gl_context *ctx,
       }
 
       nir_sweep(shader->Program->nir);
+
+      /* The GLSL IR won't be needed anymore. */
+      ralloc_free(shader->ir);
+      shader->ir = NULL;
    }
 
    return true;