mesa: call build_program_resource_list inside Driver.LinkShader
authorMarek Olšák <marek.olsak@amd.com>
Mon, 5 Oct 2015 21:15:59 +0000 (23:15 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 11 Feb 2016 15:56:28 +0000 (16:56 +0100)
to allow LinkShader to free the GLSL IR.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/glsl/program.h
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 64f54635f62486a4a1a42a98c7ce2a95d97a1dda..31bb9aa243530f79f18c0e2a316cf4bf7d5b5bd3 100644 (file)
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include "main/core.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+struct gl_context;
+struct gl_shader;
+struct gl_shader_program;
+
 extern void
 _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
                          bool dump_ast, bool dump_hir);
index f48c6fe12a124ef88f04af085caa5a7f09213b39..b512f8b6ee162ff41f9d61b2ff74c7a8a05c0be7 100644 (file)
@@ -27,6 +27,7 @@
 #include "brw_nir.h"
 #include "brw_program.h"
 #include "compiler/glsl/ir_optimization.h"
+#include "compiler/glsl/program.h"
 #include "program/program.h"
 #include "main/shaderapi.h"
 #include "main/uniforms.h"
@@ -259,5 +260,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
    if (brw->precompile && !brw_shader_precompile(ctx, shProg))
       return false;
 
+   build_program_resource_list(shProg);
    return true;
 }
index a5e32746362b80964b80fbcba4840aae5c4e98d7..bbc7a7d3b4e7203afdff1419f1e5f90817c23ee6 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <stdio.h>
 #include "main/compiler.h"
+#include "main/macros.h"
 #include "main/mtypes.h"
 #include "main/shaderapi.h"
 #include "main/shaderobj.h"
@@ -3007,6 +3008,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       _mesa_reference_program(ctx, &linked_prog, NULL);
    }
 
+   build_program_resource_list(prog);
    return prog->LinkStatus;
 }
 
@@ -3035,8 +3037,6 @@ _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(prog);
       }
    }
 
index ce93aec4e714ecee21b630a2e926f016e9afe56e..ff89be37cbbc7845d2033ee7e00fed6f44af484c 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "compiler/glsl/glsl_parser_extras.h"
 #include "compiler/glsl/ir_optimization.h"
+#include "compiler/glsl/program.h"
 
 #include "main/errors.h"
 #include "main/shaderobj.h"
@@ -6380,6 +6381,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       validate_ir_tree(ir);
    }
 
+   build_program_resource_list(prog);
+
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_program *linked_prog;