glsl: Delete symbol table in post-link shaders
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 30 Sep 2011 21:21:10 +0000 (14:21 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 4 Oct 2011 19:33:28 +0000 (12:33 -0700)
The symbol table in the linked shaders may contain references to
variables that were removed (e.g., unused uniforms).  Since it may
contain junk, there is no possible valid use.  Delete it and set the
pointer to NULL.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/linker.cpp

index d802a0a9baeba04e230bceafaa5941f7e6ed2550..6d40dd2e39314286f8b541a5043facbacff78f78 100644 (file)
@@ -1831,6 +1831,14 @@ done:
 
       /* Retain any live IR, but trash the rest. */
       reparent_ir(prog->_LinkedShaders[i]->ir, prog->_LinkedShaders[i]->ir);
+
+      /* The symbol table in the linked shaders may contain references to
+       * variables that were removed (e.g., unused uniforms).  Since it may
+       * contain junk, there is no possible valid use.  Delete it and set the
+       * pointer to NULL.
+       */
+      delete prog->_LinkedShaders[i]->symbols;
+      prog->_LinkedShaders[i]->symbols = NULL;
    }
 
    ralloc_free(mem_ctx);