summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-10-05 23:15:59 +0200
committerMarek Olšák <[email protected]>2016-02-11 16:56:28 +0100
commit906ecab450e21cc0554a39f846d374aedb72b428 (patch)
tree241a332f9edbed5d72bf782424b6ad9326c0a593
parent0f235c960c8a564ff8817835716e8f377b2f5f16 (diff)
mesa: call build_program_resource_list inside Driver.LinkShader
to allow LinkShader to free the GLSL IR. Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/compiler/glsl/program.h5
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp2
-rw-r--r--src/mesa/program/ir_to_mesa.cpp4
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp3
4 files changed, 11 insertions, 3 deletions
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 <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);
}
}
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;