st/mesa: don't load cached TGSI shaders on demand
authorMarek Olšák <marek.olsak@amd.com>
Wed, 31 May 2017 11:07:04 +0000 (13:07 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 5 Jun 2017 16:25:57 +0000 (18:25 +0200)
This fixes a performance issue with the shader cache that delayed Gallium
shader create calls until draw calls.

I'd like this in stable, but it's not a showstopper.

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/state_tracker/st_shader_cache.c

index 31c3430aa4a1feb0bf1df4da0af1fde356940de4..305435ff5bb441f9d69cc8d8b6359ce0056dad15 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <stdio.h>
-
+#include "st_debug.h"
 #include "st_program.h"
 #include "st_shader_cache.h"
 #include "compiler/glsl/program.h"
@@ -367,6 +367,11 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
          _mesa_associate_uniform_storage(ctx, prog, glprog->Parameters,
                                          false);
 
+         /* Create Gallium shaders now instead of on demand. */
+         if (ST_DEBUG & DEBUG_PRECOMPILE ||
+             st->shader_has_one_variant[glprog->info.stage])
+            st_precompile_shader_variant(st, glprog);
+
          free(buffer);
       } else {
          /* Failed to find a matching cached shader so fallback to recompile.