mesa: Add some missing clean-up to _mesa_clear_shader_program_data
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 20 Oct 2014 21:35:01 +0000 (14:35 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 25 Oct 2014 02:54:38 +0000 (19:54 -0700)
All of this is already done in link_shaders.  More clean-ups coming.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/shaderobj.c

index 693e9a259c208f2efcf1fdd2fbf0b70772ef8d22..785baa2b252459b1782b86196807032fe4ac3a84 100644 (file)
@@ -280,8 +280,9 @@ void
 _mesa_clear_shader_program_data(struct gl_context *ctx,
                                 struct gl_shader_program *shProg)
 {
+   unsigned i;
+
    if (shProg->UniformStorage) {
-      unsigned i;
       for (i = 0; i < shProg->NumUserUniformStorage; ++i)
          _mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
       ralloc_free(shProg->UniformStorage);
@@ -303,6 +304,18 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
    assert(shProg->InfoLog != NULL);
    ralloc_free(shProg->InfoLog);
    shProg->InfoLog = ralloc_strdup(shProg, "");
+
+   ralloc_free(shProg->UniformBlocks);
+   shProg->UniformBlocks = NULL;
+   shProg->NumUniformBlocks = 0;
+   for (i = 0; i < MESA_SHADER_STAGES; i++) {
+      ralloc_free(shProg->UniformBlockStageIndex[i]);
+      shProg->UniformBlockStageIndex[i] = NULL;
+   }
+
+   ralloc_free(shProg->AtomicBuffers);
+   shProg->AtomicBuffers = NULL;
+   shProg->NumAtomicBuffers = 0;
 }