glsl: delay optimisations on individual shaders when cache is available

Due to a max limit of 65,536 entries on the index table that we use to
decide if we can skip compiling individual shaders, it is very likely
we will have collisions.

To avoid doing too much work when the linked program may be in the
cache this patch delays calling the optimisations until link time.

Improves cold cache start-up times on Deus Ex by ~20 seconds.

When deleting the cache index to simulate a worst case scenario
of collisions in the index, warm cache start-up time improves by
~45 seconds.

V2: fix indentation, make sure to call optimisations on cache
fallback, make sure optimisations get called for XFB.

Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Timothy Arceri
2017-04-10 11:48:48 +10:00
parent d2d6cf6c83
commit c2bc0aa7b1
4 changed files with 96 additions and 78 deletions
+1 -1
View File
@@ -1418,7 +1418,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
*/
char sha1_buf[41];
for (unsigned i = 0; i < prog->NumShaders; i++) {
if (prog->Shaders[i]->CompileStatus == compile_success) {
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);