[Mesa-dev] [PATCH 59/65] mesa: extend LinkShader function to include cache fallback param

Timothy Arceri timothy.arceri at collabora.com
Fri Apr 29 13:33:58 UTC 2016


This allows up to skip certain linking tasks such as building the
resource list when we are falling back to a full compile after a
cache miss.
---
 src/mesa/drivers/dri/i965/brw_link.cpp     | 3 ++-
 src/mesa/drivers/dri/i965/brw_shader.h     | 4 +++-
 src/mesa/main/dd.h                         | 3 ++-
 src/mesa/program/ir_to_mesa.cpp            | 5 +++--
 src/mesa/program/ir_to_mesa.h              | 4 +++-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 ++-
 src/mesa/state_tracker/st_glsl_to_tgsi.h   | 4 +++-
 7 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 7809b4c..97bee3b 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -186,7 +186,8 @@ process_glsl_ir(gl_shader_stage stage,
 }
 
 extern "C" GLboolean
-brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
+brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg,
+                bool is_cache_fallback)
 {
    struct brw_context *brw = brw_context(ctx);
    const struct brw_compiler *compiler = brw->intelScreen->compiler;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index fc228f6..e7d062e 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -285,7 +285,9 @@ bool brw_cs_precompile(struct gl_context *ctx,
                        struct gl_shader_program *shader_prog,
                        struct gl_program *prog);
 
-GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
+GLboolean
+brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog,
+                bool is_cache_fallback);
 struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
 
 int type_size_scalar(const struct glsl_type *type);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index d62fee6..625f898 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -513,7 +513,8 @@ struct dd_function_table {
     * own transformations on it for the purposes of code generation.
     */
    GLboolean (*LinkShader)(struct gl_context *ctx,
-                           struct gl_shader_program *shader);
+                           struct gl_shader_program *shader,
+                           bool is_cache_fallback);
    /*@}*/
 
    /**
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 4f4cbaf..62d647f 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2900,7 +2900,8 @@ extern "C" {
  * code lowering and other optimizations.
  */
 GLboolean
-_mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
+_mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog,
+                     bool is_cache_fallback)
 {
    assert(prog->LinkStatus);
 
@@ -3015,7 +3016,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog,
       return;
 
    if (prog->LinkStatus) {
-      if (!ctx->Driver.LinkShader(ctx, prog)) {
+      if (!ctx->Driver.LinkShader(ctx, prog, skip_cache)) {
 	 prog->LinkStatus = GL_FALSE;
       }
    }
diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h
index abc628a..6584bee 100644
--- a/src/mesa/program/ir_to_mesa.h
+++ b/src/mesa/program/ir_to_mesa.h
@@ -36,7 +36,9 @@ struct gl_shader_program;
 void _mesa_glsl_link_shader(struct gl_context *ctx,
                             struct gl_shader_program *prog,
                             bool skip_cache);
-GLboolean _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
+GLboolean
+_mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog,
+                     bool is_cache_fallback);
 
 void
 _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index ad818a8..cb71da6 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6738,7 +6738,8 @@ st_dump_program_for_shader_db(struct gl_context *ctx,
  * with code lowering and other optimizations.
  */
 GLboolean
-st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
+st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog,
+               bool is_cache_fallback)
 {
    struct pipe_screen *pscreen = ctx->st->pipe->screen;
    assert(prog->LinkStatus);
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.h b/src/mesa/state_tracker/st_glsl_to_tgsi.h
index 774588a..17ba6cf 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -56,7 +56,9 @@ enum pipe_error st_translate_program(
 
 void free_glsl_to_tgsi_visitor(struct glsl_to_tgsi_visitor *v);
 
-GLboolean st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
+GLboolean
+st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog,
+               bool is_cache_fallback);
 
 void
 st_translate_stream_output_info(struct glsl_to_tgsi_visitor *glsl_to_tgsi,
-- 
2.5.5



More information about the mesa-dev mailing list