From c9d7b0f18425f7c5acabb7cec6b877d5ee112543 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 17 Jan 2019 17:16:28 +1100 Subject: [PATCH] glsl: don't skip GLSL IR opts on first-time compiles MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This basically reverts c2bc0aa7b188. By running the opts we reduce memory using in Team Fortress 2 from 1.5GB -> 1.3GB from start-up to game menu. This will likely increase Deus Ex start up times as per commit c2bc0aa7b188. However currently 32bit games like Team Fortress 2 can run out of memory on low memory systems, so that seems more important. Reviewed-by: Marek Olšák --- src/compiler/glsl/glsl_parser_extras.cpp | 16 +--------------- src/compiler/glsl/shader_cache.cpp | 17 ----------------- src/mesa/main/mtypes.h | 3 +-- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 2048a7f9006..200df7759bb 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -2090,14 +2090,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, */ if (shader->CompileStatus == COMPILE_SUCCESS) return; - - if (shader->CompileStatus == COMPILED_NO_OPTS) { - opt_shader_and_create_symbol_table(ctx, - NULL, /* source_symbols */ - shader); - shader->CompileStatus = COMPILE_SUCCESS; - return; - } } struct _mesa_glsl_parse_state *state = @@ -2153,13 +2145,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, if (!state->error && !shader->ir->is_empty()) { assign_subroutine_indexes(state); lower_subroutine(shader->ir, state); - - if (!ctx->Cache || force_recompile) - opt_shader_and_create_symbol_table(ctx, state->symbols, shader); - else { - reparent_ir(shader->ir, shader->ir); - shader->CompileStatus = COMPILED_NO_OPTS; - } + opt_shader_and_create_symbol_table(ctx, state->symbols, shader); } if (!force_recompile) { diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp index 31d0aa62966..879511a9d7c 100644 --- a/src/compiler/glsl/shader_cache.cpp +++ b/src/compiler/glsl/shader_cache.cpp @@ -264,23 +264,6 @@ shader_cache_read_program_metadata(struct gl_context *ctx, /* This is used to flag a shader retrieved from cache */ prog->data->LinkStatus = LINKING_SKIPPED; - /* Since the program load was successful, CompileStatus of all shaders at - * this point should normally be compile_skipped. However because of how - * the eviction works, it may happen that some of the individual shader keys - * have been evicted, resulting in unnecessary recompiles on this load, so - * mark them again to skip such recompiles next time. - */ - char sha1_buf[41]; - for (unsigned i = 0; i < prog->NumShaders; i++) { - if (prog->Shaders[i]->CompileStatus == COMPILED_NO_OPTS) { - disk_cache_put_key(cache, prog->Shaders[i]->sha1); - if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { - _mesa_sha1_format(sha1_buf, prog->Shaders[i]->sha1); - fprintf(stderr, "re-marking shader: %s\n", sha1_buf); - } - } - } - free (buffer); return true; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 241c2b92f7a..0fdeba47329 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2576,8 +2576,7 @@ enum gl_compile_status { COMPILE_FAILURE = 0, COMPILE_SUCCESS, - COMPILE_SKIPPED, - COMPILED_NO_OPTS + COMPILE_SKIPPED }; /** -- 2.30.2