Mesa (7.9): linker: Reject shaders that have unresolved function calls

Ian Romanick idr at kemper.freedesktop.org
Tue Dec 14 21:13:03 UTC 2010


Module: Mesa
Branch: 7.9
Commit: 6fc544dd5028abf21d66f16dc562948a590adf19
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fc544dd5028abf21d66f16dc562948a590adf19

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Oct 13 15:13:02 2010 -0700

linker: Reject shaders that have unresolved function calls

This really amounts to just using the return value from
link_function_calls.  All the work was being done, but the result was
being ignored.

Fixes piglit test link-unresolved-funciton.

NOTE: this is a candidate for the 7.9 branch.
(cherry picked from commit 4a45595cf3d6a238bb4d528d30139392618b39df)

---

 src/glsl/linker.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 4bb4e2a..1f98750 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -780,7 +780,7 @@ link_intrastage_shaders(GLcontext *ctx,
       return NULL;
    }
 
-   gl_shader *const linked = ctx->Driver.NewShader(NULL, 0, main->Type);
+   gl_shader *linked = ctx->Driver.NewShader(NULL, 0, main->Type);
    linked->ir = new(linked) exec_list;
    clone_ir_list(linked, linked->ir, main->ir);
 
@@ -827,7 +827,11 @@ link_intrastage_shaders(GLcontext *ctx,
 
    assert(idx == num_linking_shaders);
 
-   link_function_calls(prog, linked, linking_shaders, num_linking_shaders);
+   if (!link_function_calls(prog, linked, linking_shaders,
+			    num_linking_shaders)) {
+      ctx->Driver.DeleteShader(ctx, linked);
+      linked = NULL;
+   }
 
    free(linking_shaders);
 




More information about the mesa-commit mailing list