aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-01-24 08:39:13 +1100
committerTimothy Arceri <[email protected]>2017-02-17 11:18:42 +1100
commit877194068208a9fb87f7b5513bca85d09be8a20f (patch)
treebddab5b55b75f3552e710ac6a8604e18ad5709d3 /src/compiler/glsl/linker.cpp
parent34ca0fce228224121d1a3b111c38325e731bace3 (diff)
glsl: make use of on disk shader cache
The hash key for glsl metadata is a hash of the hashes of each GLSL source string. This commit uses the put_key/get_key support in the cache put the SHA-1 hash of the source string for each successfully compiled shader into the cache. This allows for early, optimistic returns from glCompileShader (if the identical source string had been successfully compiled in the past), in the hope that the final, linked shader will be found in the cache. This is based on the intial patch by Carl. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl/linker.cpp')
-rw-r--r--src/compiler/glsl/linker.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index b3c7d2c1456..80d83141f9a 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -73,6 +73,7 @@
#include "program.h"
#include "program/prog_instruction.h"
#include "program/program.h"
+#include "util/mesa-sha1.h"
#include "util/set.h"
#include "util/string_to_uint_map.h"
#include "linker.h"
@@ -81,6 +82,7 @@
#include "ir_rvalue_visitor.h"
#include "ir_uniform.h"
#include "builtin_functions.h"
+#include "shader_cache.h"
#include "main/shaderobj.h"
#include "main/enums.h"
@@ -4619,6 +4621,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
return;
}
+ if (shader_cache_read_program_metadata(ctx, prog))
+ return;
+
void *mem_ctx = ralloc_context(NULL); // temporary linker context
prog->ARB_fragment_coord_conventions_enable = false;