glsl: clone inputs and outputs during linking
authorTapani Pälli <tapani.palli@intel.com>
Thu, 11 Jun 2015 07:41:52 +0000 (10:41 +0300)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 24 Jun 2015 19:01:21 +0000 (12:01 -0700)
This increases memory pressure during linking but makes it easier
for backend to free IR after it is not needed anymore.

v2: use resource list as ralloc context in case of relink (Kenneth)

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

index 4a726d4..5da9cad 100644 (file)
@@ -2637,7 +2637,9 @@ add_interface_variables(struct gl_shader_program *shProg,
          continue;
       };
 
-      if (!add_program_resource(shProg, programInterface, var,
+      /* Clone ir_variable data so that backend is able to free memory. */
+      if (!add_program_resource(shProg, programInterface,
+                                var->clone(shProg->ProgramResourceList, NULL),
                                 build_stageref(shProg, var->name) | mask))
          return false;
    }