summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/shaderapi.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 55398131824..1c564d31704 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1130,21 +1130,24 @@ _mesa_compile_shader(struct gl_context *ctx, struct gl_shader *sh)
/**
* Link a program's shaders.
*/
-void
-_mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
+static ALWAYS_INLINE void
+link_program(struct gl_context *ctx, struct gl_shader_program *shProg,
+ bool no_error)
{
if (!shProg)
return;
- /* From the ARB_transform_feedback2 specification:
- * "The error INVALID_OPERATION is generated by LinkProgram if <program> is
- * the name of a program being used by one or more transform feedback
- * objects, even if the objects are not currently bound or are paused."
- */
- if (_mesa_transform_feedback_is_using_program(ctx, shProg)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glLinkProgram(transform feedback is using the program)");
- return;
+ if (!no_error) {
+ /* From the ARB_transform_feedback2 specification:
+ * "The error INVALID_OPERATION is generated by LinkProgram if <program>
+ * is the name of a program being used by one or more transform feedback
+ * objects, even if the objects are not currently bound or are paused."
+ */
+ if (_mesa_transform_feedback_is_using_program(ctx, shProg)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glLinkProgram(transform feedback is using the program)");
+ return;
+ }
}
unsigned programs_in_use = 0;
@@ -1232,6 +1235,20 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
}
+static void
+link_program_error(struct gl_context *ctx, struct gl_shader_program *shProg)
+{
+ link_program(ctx, shProg, false);
+}
+
+
+void
+_mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
+{
+ link_program_error(ctx, shProg);
+}
+
+
/**
* Print basic shader info (for debug).
*/
@@ -1689,10 +1706,13 @@ void GLAPIENTRY
_mesa_LinkProgram(GLuint programObj)
{
GET_CURRENT_CONTEXT(ctx);
+
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glLinkProgram %u\n", programObj);
- _mesa_link_program(ctx, _mesa_lookup_shader_program_err(ctx, programObj,
- "glLinkProgram"));
+
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, programObj, "glLinkProgram");
+ link_program_error(ctx, shProg);
}
#ifdef ENABLE_SHADER_CACHE