[Mesa-dev] [PATCH 3/6] mesa: Issue a warning when drawing with a program that needs re-linking.

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


Drawing with a program that hasn't been re-linked is legal, but likely
isn't what the application author intended.  Give a helpful warning.

(_mesa_shader_debug might be more appropriate than _mesa_warning...)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78700
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/main/context.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 860ae86..c428dbb 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -118,6 +118,7 @@
 #include "scissor.h"
 #include "shared.h"
 #include "shaderobj.h"
+#include "shaderapi.h"
 #include "simple_list.h"
 #include "state.h"
 #include "stencil.h"
@@ -1813,7 +1814,7 @@ _mesa_check_blend_func_error(struct gl_context *ctx)
 
 static bool
 shader_linked_or_absent(struct gl_context *ctx,
-                        const struct gl_shader_program *shProg,
+                        struct gl_shader_program *shProg,
                         bool *shader_present, const char *where)
 {
    if (shProg) {
@@ -1823,6 +1824,13 @@ shader_linked_or_absent(struct gl_context *ctx,
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(shader not linked)", where);
          return false;
       }
+
+      _mesa_check_for_recompiled_shaders(shProg);
+      if (shProg->NeedsRelink) {
+         _mesa_warning(ctx, "%s(shader program %u needs re-linking)",
+                       where, shProg->Name);
+      }
+
 #if 0 /* not normally enabled */
       {
          char errMsg[100];
-- 
1.9.2



More information about the mesa-dev mailing list