[Mesa-dev] [PATCH 28/68] glsl: add support for skipping shader cache to compiler and linker
Timothy Arceri
timothy.arceri at collabora.com
Wed Jun 1 06:23:09 UTC 2016
---
src/compiler/glsl/linker.cpp | 5 +++--
src/compiler/glsl/program.h | 3 ++-
src/compiler/glsl/standalone.cpp | 2 +-
src/mesa/main/ff_fragment_shader.cpp | 2 +-
src/mesa/main/shaderapi.c | 2 +-
src/mesa/program/ir_to_mesa.cpp | 5 +++--
src/mesa/program/ir_to_mesa.h | 5 ++++-
7 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 4980984..da7f2ee 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4450,7 +4450,8 @@ disable_varying_optimizations_for_sso(struct gl_shader_program *prog)
}
void
-link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
+link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
+ bool is_cache_fallback)
{
prog->LinkStatus = true; /* All error paths will set this to false */
prog->Validated = false;
@@ -4482,7 +4483,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
tfeedback_decl *tfeedback_decls = NULL;
#ifdef ENABLE_SHADER_CACHE
- if (shader_cache_read_program_metadata(ctx, prog))
+ if (!is_cache_fallback && shader_cache_read_program_metadata(ctx, prog))
return;
#endif
diff --git a/src/compiler/glsl/program.h b/src/compiler/glsl/program.h
index 58a7069..bb9bbb0 100644
--- a/src/compiler/glsl/program.h
+++ b/src/compiler/glsl/program.h
@@ -40,7 +40,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
#endif
extern void
-link_shaders(struct gl_context *ctx, struct gl_shader_program *prog);
+link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
+ bool is_cache_fallback);
extern void
build_program_resource_list(struct gl_context *ctx,
diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp
index 0b5dde4..a5151f2 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -400,7 +400,7 @@ standalone_compile_shader(const struct standalone_options *_options,
if ((status == EXIT_SUCCESS) && options->do_link) {
_mesa_clear_shader_program_data(whole_program);
- link_shaders(ctx, whole_program);
+ link_shaders(ctx, whole_program, true);
status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
if (strlen(whole_program->InfoLog) > 0) {
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 26bf162..4967eb3 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -1262,7 +1262,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
p.shader_program->Shaders[0] = p.shader;
p.shader_program->NumShaders = 1;
- _mesa_glsl_link_shader(ctx, p.shader_program);
+ _mesa_glsl_link_shader(ctx, p.shader_program, false);
if (!p.shader_program->LinkStatus)
_mesa_problem(ctx, "Failed to link fixed function fragment shader: %s\n",
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index b319200..d212291 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1044,7 +1044,7 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- _mesa_glsl_link_shader(ctx, shProg);
+ _mesa_glsl_link_shader(ctx, shProg, false);
if (shProg->LinkStatus == GL_FALSE &&
(ctx->_Shader->Flags & GLSL_REPORT_ERRORS)) {
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 9799099..f99b6cf 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3048,7 +3048,8 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
* Link a GLSL shader program. Called via glLinkProgram().
*/
void
-_mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
+_mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog,
+ bool is_cache_fallback)
{
unsigned int i;
@@ -3063,7 +3064,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
}
if (prog->LinkStatus) {
- link_shaders(ctx, prog);
+ link_shaders(ctx, prog, is_cache_fallback);
}
/* FIXME: We look at prog->Version to determine whether we actually linked
diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h
index a70f575..e403e9b 100644
--- a/src/mesa/program/ir_to_mesa.h
+++ b/src/mesa/program/ir_to_mesa.h
@@ -33,7 +33,10 @@ struct gl_context;
struct gl_shader;
struct gl_shader_program;
-void _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
+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);
void
--
2.5.5
More information about the mesa-dev
mailing list