[Mesa-dev] [PATCH 1/2] mesa: call build_program_resource_list inside Driver.LinkShader
Marek Olšák
maraeo at gmail.com
Sat Jan 30 06:48:34 PST 2016
From: Marek Olšák <marek.olsak at amd.com>
to allow LinkShader to free the GLSL IR.
---
src/compiler/glsl/program.h | 5 ++++-
src/mesa/drivers/dri/i965/brw_link.cpp | 2 ++
src/mesa/program/ir_to_mesa.cpp | 4 ++--
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 +++
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/compiler/glsl/program.h b/src/compiler/glsl/program.h
index 64f5463..31bb9aa 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 db4ba88..66520a4 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"
@@ -282,5 +283,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 c9c3044..403803b 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"
@@ -2933,6 +2934,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;
}
@@ -2961,8 +2963,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 f5b8c33..d98627f 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"
@@ -5923,6 +5924,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;
--
2.1.4
More information about the mesa-dev
mailing list