summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/shader_cache.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-04-10 11:48:49 +1000
committerTimothy Arceri <[email protected]>2017-04-15 11:36:52 +1000
commit9f0dd85aa65b5eba783d6023b51deacd529cf918 (patch)
tree7955ebe7c7bc6d2cfa0dbbc4d402c939bcfd60f2 /src/compiler/glsl/shader_cache.cpp
parentc2bc0aa7b188708e702bc3eaac5389793cbb85a8 (diff)
glsl: don't run the GLSL pre-processor when we are skipping compilation
This moves the hashing of shader source for the cache lookup to before the preprocessor. In our experience, shaders are unlikely to hash the same after preprocessing if they didn't hash the same before, so we can skip preprocessing for cache hits. Improves Deus Ex start-up times with a warm cache from ~30 seconds to ~22 seconds. Also fixes the leaking of state. V2: fix indentation v3: add the value of MESA_EXTENSION_OVERRIDE to the hash of the shader. Tested-by (v2): Grazvydas Ignotas <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/glsl/shader_cache.cpp')
-rw-r--r--src/compiler/glsl/shader_cache.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index e51fecd6518..738e5488ac2 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1319,6 +1319,16 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
ctx->API, ctx->Const.GLSLVersion,
ctx->Const.ForceGLSLVersion);
+ /* We run the preprocessor on shaders after hashing them, so we need to
+ * add any extension override vars to the hash. If we don't do this the
+ * preprocessor could result in different output and we could load the
+ * wrong shader.
+ */
+ char *ext_override = getenv("MESA_EXTENSION_OVERRIDE");
+ if (ext_override) {
+ ralloc_asprintf_append(&buf, "ext:%s", ext_override);
+ }
+
/* DRI config options may also change the output from the compiler so
* include them as an input to sha1 creation.
*/