Mesa (glsl2): linker: Don't dynamically allocate slots for linked shaders

Ian Romanick idr at kemper.freedesktop.org
Wed Jun 30 13:50:12 PDT 2010


Module: Mesa
Branch: glsl2
Commit: ef5f1948316664055c1444d12076c7d86589a8b9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef5f1948316664055c1444d12076c7d86589a8b9

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Tue Jun 29 17:58:43 2010 -0700

linker: Don't dynamically allocate slots for linked shaders

The can be at most one shader per stage.  There are currently only two
stages.  There is zero reason to dynamically size this array.

---

 src/glsl/linker.cpp    |    2 --
 src/mesa/main/mtypes.h |    7 ++++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index a53e91d..11fccba 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -823,8 +823,6 @@ link_shaders(struct gl_shader_program *prog)
       goto done;
 
 
-   prog->_LinkedShaders = (struct gl_shader **)
-      calloc(2, sizeof(struct gl_shader *));
    prog->_NumLinkedShaders = 0;
 
    if (num_vert_shaders > 0) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index bc90b1e..9a36740 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2006,8 +2006,13 @@ struct gl_shader_program
    GLboolean _Used;        /**< Ever used for drawing? */
    GLchar *InfoLog;
 
+   /**
+    * Per-stage shaders resulting from the first stage of linking.
+    */
+   /*@{*/
    GLuint _NumLinkedShaders;
-   struct gl_shader **_LinkedShaders;
+   struct gl_shader *_LinkedShaders[2];
+   /*@}*/
 };   
 
 



More information about the mesa-commit mailing list