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 4a726d4e2e7f2c06a77d3a236ca85f54eb58da0e..5da9cadcb0832756ada56eddff422b81bb2526d8 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;
    }