[Mesa-dev] [PATCH 4/6] mesa: Issue a performance warning for unnecessary LinkProgram calls.

Kenneth Graunke kenneth at whitecape.org
Wed May 14 17:28:15 PDT 2014


Now that we track whether a program needs re-linking, we can issue a
warning if it's called when a re-link isn't required.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/main/shaderapi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 3a4a2a9..290987a 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -941,6 +941,12 @@ link_program(struct gl_context *ctx, GLuint program)
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM);
 
+   _mesa_check_for_recompiled_shaders(shProg);
+   if (shProg->LinkStatus && !shProg->NeedsRelink) {
+      _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_LOW,
+                       "glLinkProgram(%d) called unnecessarily\n", program);
+   }
+
    _mesa_glsl_link_shader(ctx, shProg);
 
    if (shProg->LinkStatus == GL_TRUE)
-- 
1.9.2



More information about the mesa-dev mailing list