Mesa (master): glsl: Delete symbol table in post-link shaders

Ian Romanick idr at kemper.freedesktop.org
Tue Oct 4 13:18:49 PDT 2011


Module: Mesa
Branch: master
Commit: 7bbcc0b832b02f9da6365ec6a86a0167cf75d8a8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7bbcc0b832b02f9da6365ec6a86a0167cf75d8a8

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Sep 30 14:21:10 2011 -0700

glsl: Delete symbol table in post-link shaders

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 at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/linker.cpp |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index d802a0a..6d40dd2 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -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);



More information about the mesa-commit mailing list