[Mesa-dev] [PATCH 23/77] glsl: add support for skipping shader cache to compiler and linker
Timothy Arceri
timothy.arceri at collabora.com
Mon Oct 3 06:04:42 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 647ca45..ddc8390 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4597,7 +4597,8 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
}
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;
@@ -4625,7 +4626,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
unsigned int num_explicit_uniform_locs = 0;
#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 57a1502..e57da69 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -420,7 +420,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 db3736e..97ccc61 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -1264,7 +1264,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 5071e81..ecb7a33 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1097,7 +1097,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);
/* Capture .shader_test files. */
const char *capture_path = _mesa_get_shader_capture_path();
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index c298b62..f595e61 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3050,7 +3050,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;
@@ -3065,7 +3066,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 be45ba0..54d98a8 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.7.4
More information about the mesa-dev
mailing list