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

Timothy Arceri timothy.arceri at collabora.com
Wed Jun 1 06:23:40 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 340d49a5..33c39f4 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -205,7 +205,8 @@ brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type)
 }
 
 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 656dc89..4da1364 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -288,7 +288,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 de14943..5710a34 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 501a90d..dd8ae38 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2961,7 +2961,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);
 
@@ -3076,7 +3077,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 e403e9b..dc464bc 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 91a0a26..48bc1b1 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6747,7 +6747,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 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.5.5



More information about the mesa-dev mailing list