i965: Delete linked GLSL IR when using NIR.
authorTapani Pälli <tapani.palli@intel.com>
Thu, 11 Jun 2015 07:41:53 +0000 (10:41 +0300)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 24 Jun 2015 19:03:41 +0000 (12:03 -0700)
This is based on Kenneth's patch to delete 'most of the IR'. Due to
linker changes to clone variables, we can now free all of IR.

Saves 58MB of memory when replaying a Dota 2 trace on Broadwell.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
src/mesa/drivers/dri/i965/brw_shader.cpp

index 32c401314341b8cc468389748797a6aa124f30cd..5653d6ba1e48ce19139b4903a3683970b6a16fe1 100644 (file)
@@ -387,8 +387,11 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
 
       brw_add_texrect_params(prog);
 
-      if (options->NirOptions)
+      if (options->NirOptions) {
          prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage);
+         ralloc_free(shader->ir);
+         shader->ir = NULL;
+      }
 
       _mesa_reference_program(ctx, &prog, NULL);
    }