From b607aad8e1a40c473176e31e11deaa26477c54c0 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 9 Mar 2017 22:58:38 +1100 Subject: [PATCH] glsl: don't recompile a shader on fallback unless needed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Because we optimistically skip compiling shaders if we have seen them before we may need to compile them later at link time if they haven't yet been use in a specific combination to create a program. Rather than always recompiling we take advantage of the gl_compile_status enum introduced in the previous patch to only compile when we have previously skipped compilation. This helps with regressions in app start-up times on cold cache runs, compared with no cache. Deus Ex: Mankind Divided start-up times: cache disabled: ~3m15s cold cache master: ~4m23s cold cache with this patch: ~3m33s Acked-by: Marek Olšák --- src/compiler/glsl/glsl_parser_extras.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 59114a7a48b..776636c03c9 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1952,6 +1952,13 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, shader->FallbackSource = NULL; return; } + } else { + /* We should only ever end up here if a re-compile has been forced by a + * shader cache miss. In which case we can skip the compile if its + * already be done by a previous fallback or the initial compile call. + */ + if (shader->CompileStatus == compile_success) + return; } if (!state->error) { -- 2.30.2