From: Marek Olšák Date: Mon, 5 Oct 2015 21:15:59 +0000 (+0200) Subject: mesa: call build_program_resource_list inside Driver.LinkShader X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=906ecab450e21cc0554a39f846d374aedb72b428;p=mesa.git mesa: call build_program_resource_list inside Driver.LinkShader to allow LinkShader to free the GLSL IR. Reviewed-by: Ian Romanick --- diff --git a/src/compiler/glsl/program.h b/src/compiler/glsl/program.h index 64f54635f62..31bb9aa2435 100644 --- a/src/compiler/glsl/program.h +++ b/src/compiler/glsl/program.h @@ -22,12 +22,15 @@ * 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); diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index f48c6fe12a1..b512f8b6ee1 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -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; } diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index a5e32746362..bbc7a7d3b4e 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -31,6 +31,7 @@ #include #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); } } diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index ce93aec4e71..ff89be37cbb 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -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;