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

Timothy Arceri timothy.arceri at collabora.com
Mon Oct 3 06:05:06 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 02151d6..aa92321 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -211,7 +211,8 @@ brw_new_shader(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->screen->compiler;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index ba2404a..3fa0b59 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -279,7 +279,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_linked_shader *brw_new_shader(gl_shader_stage stage);
 
 unsigned tesslevel_outer_components(GLenum tes_primitive_mode);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 257dc10..2303d93 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -514,7 +514,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 9d4b20b..210cecc 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2963,7 +2963,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);
 
@@ -3078,7 +3079,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, is_cache_fallback)) {
 	 prog->LinkStatus = GL_FALSE;
       }
    }
diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h
index 54d98a8..7a8c9f0 100644
--- a/src/mesa/program/ir_to_mesa.h
+++ b/src/mesa/program/ir_to_mesa.h
@@ -37,7 +37,9 @@ void _mesa_glsl_link_shader(struct gl_context *ctx,
                             struct gl_shader_program *prog,
                             bool is_shader_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 81ea233..895a53a 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6846,7 +6846,8 @@ extern "C" {
  * 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 0f485fb..231ed1f 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.7.4



More information about the mesa-dev mailing list