glsl: Slightly change the semantic of _LinkedShaders
Previously _LinkedShaders was a compact array of the linked shaders
for each shader stage. Now it is arranged such that each slot,
indexed by the MESA_SHADER_* defines, refers to a specific shader
stage. As a result, some slots will be NULL. This makes things a
little more complex in the linker, but it simplifies things in other
places.
As a side effect _NumLinkedShaders is removed.
NOTE: This may be a candidate for the 7.9 branch. If there are other
patches that get backported to 7.9 that use _LinkedShader, this patch
should be cherry picked also.
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 9350592..08a44c9 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -40,8 +40,19 @@
extern "C" struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
+extern "C" void
+_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
+ struct gl_shader *sh);
+
/* Copied from shader_api.c for the stand-alone compiler.
*/
+void
+_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
+ struct gl_shader *sh)
+{
+ *ptr = sh;
+}
+
struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
{
@@ -319,7 +330,7 @@
printf("Info log for linking:\n%s\n", whole_program->InfoLog);
}
- for (unsigned i = 0; i < whole_program->_NumLinkedShaders; i++)
+ for (unsigned i = 0; i < MESA_SHADER_TYPES; i++)
talloc_free(whole_program->_LinkedShaders[i]);
talloc_free(whole_program);