linker: Rely on _mesa_clear_shader_program_data to clear link information
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 20 Oct 2014 21:40:34 +0000 (14:40 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 25 Oct 2014 02:54:38 +0000 (19:54 -0700)
_mesa_link_shader_program already calls _mesa_clear_shader_program_data
before calling link_shaders, so this is already done.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/linker.cpp
src/glsl/main.cpp
src/glsl/standalone_scaffolding.cpp
src/glsl/standalone_scaffolding.h

index 47a722d9d1e0bc67479cb92fa64afbebb5d61f1a..b0d2e6e54738995a4cc01d2aa7a56e229098a3e4 100644 (file)
@@ -2484,20 +2484,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
    prog->Validated = false;
    prog->_Used = false;
 
-   ralloc_free(prog->InfoLog);
-   prog->InfoLog = ralloc_strdup(NULL, "");
-
-   ralloc_free(prog->UniformBlocks);
-   prog->UniformBlocks = NULL;
-   prog->NumUniformBlocks = 0;
-   for (int i = 0; i < MESA_SHADER_STAGES; i++) {
-      ralloc_free(prog->UniformBlockStageIndex[i]);
-      prog->UniformBlockStageIndex[i] = NULL;
-   }
-
-   ralloc_free(prog->AtomicBuffers);
-   prog->AtomicBuffers = NULL;
-   prog->NumAtomicBuffers = 0;
    prog->ARB_fragment_coord_conventions_enable = false;
 
    /* Separate the shaders into groups based on their type.
index feed100822cfccdb53f0e83824d8fc1b2e8df774..96d39153066756837503e296bd053745c7b565c7 100644 (file)
@@ -403,6 +403,8 @@ main(int argc, char **argv)
    }
 
    if ((status == EXIT_SUCCESS) && do_link)  {
+      _mesa_clear_shader_program_data(ctx, whole_program);
+
       link_shaders(ctx, whole_program);
       status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
 
index 2b76dd17b2a503b58ed282c9d4a7c2c234edcdd5..a635c969515c7ad8891eaa773010b95dee6720c2 100644 (file)
@@ -83,6 +83,34 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
    return shader;
 }
 
+void
+_mesa_clear_shader_program_data(struct gl_context *ctx,
+                                struct gl_shader_program *shProg)
+{
+   unsigned i;
+
+   shProg->NumUserUniformStorage = 0;
+   shProg->UniformStorage = NULL;
+   shProg->NumUniformRemapTable = 0;
+   shProg->UniformRemapTable = NULL;
+   shProg->UniformHash = 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;
+}
+
 void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
 {
    memset(ctx, 0, sizeof(*ctx));
index df783afdb44bc5baf18de60dc9d1d57760b1e3b2..b805f4046f5825aebbc7c5672be38118b3d2407e 100644 (file)
@@ -44,6 +44,10 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
 extern "C" struct gl_shader *
 _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
 
+extern "C" void
+_mesa_clear_shader_program_data(struct gl_context *,
+                                struct gl_shader_program *);
+
 extern "C" void
 _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
                    const char *msg, int len);