[Mesa-dev] [PATCH 1/2] glsl: clone inputs and outputs during linking

Tapani Pälli tapani.palli at intel.com
Thu Jun 11 00:41:52 PDT 2015


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 at intel.com>
---
 src/glsl/linker.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 9978380..faa4b2a 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2630,7 +2630,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;
    }
-- 
2.1.0



More information about the mesa-dev mailing list