OSDN Git Service

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 64f5463..31bb9aa 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 f48c6fe..b512f8b 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 a5e3274..bbc7a7d 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 ce93aec..ff89be3 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;