[Mesa-dev] [PATCH v2] glsl: use non-null context when cloning variable

Ilia Mirkin imirkin at alum.mit.edu
Sun Jun 28 22:13:30 PDT 2015


ProgramResourceList might not yet have been initialized. In that case,
parent the var to the program.

Fixes: c2ff3485b3d (glsl: clone inputs and outputs during linking)
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: mesa-stable at lists.freedesktop.org
---

v1 -> v2: parent to prog only if the resource list doesn't exist

Perhaps it's not worth it to clone in the first place if the resource
list isn't there?

 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 5da9cad..c8cd858 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2639,7 +2639,9 @@ add_interface_variables(struct gl_shader_program *shProg,
 
       /* Clone ir_variable data so that backend is able to free memory. */
       if (!add_program_resource(shProg, programInterface,
-                                var->clone(shProg->ProgramResourceList, NULL),
+                                var->clone(shProg->ProgramResourceList ?
+                                           (void *)shProg->ProgramResourceList :
+                                           (void *)shProg, NULL),
                                 build_stageref(shProg, var->name) | mask))
          return false;
    }
-- 
2.3.6



More information about the mesa-dev mailing list