[Mesa-dev] [PATCH 3/3] glsl: create program resource list after LinkShader

Tapani Pälli tapani.palli at intel.com
Mon Jun 29 05:35:45 PDT 2015


Resource list can be created properly  only after LinkShader hook
has been called to make sure all dead variables have been removed.

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
https://bugs.freedesktop.org/show_bug.cgi?id=90925
---
 src/glsl/linker.cpp             | 4 ----
 src/mesa/program/ir_to_mesa.cpp | 2 ++
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index abf7391..20eb34d 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -3162,10 +3162,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
       }
    }
 
-   build_program_resource_list(ctx, prog);
-   if (!prog->LinkStatus)
-      goto done;
-
    /* FINISHME: Assign fragment shader output locations. */
 
 done:
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 18e3bc5..0b2eb12 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2975,6 +2975,8 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
    if (prog->LinkStatus) {
       if (!ctx->Driver.LinkShader(ctx, prog)) {
 	 prog->LinkStatus = GL_FALSE;
+      } else {
+         build_program_resource_list(ctx, prog);
       }
    }
 
-- 
2.1.0



More information about the mesa-dev mailing list