summaryrefslogtreecommitdiff
path: root/src/compiler/Makefile.glsl.am
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-09-28 08:55:02 +1000
committerTimothy Arceri <timothy.arceri@collabora.com>2016-09-28 09:16:31 +1000
commit87ab26b2ab35a29d446ae66f1795d40c184c0739 (patch)
tree18db7f28e1cb85d6338c91f5df6087a587d70fd8 /src/compiler/Makefile.glsl.am
parent44bcf1ffcced04fd7f2b537a922ffa85dd1418e2 (diff)
downloadmesa-87ab26b2ab35a29d446ae66f1795d40c184c0739.tar.gz
mesa-87ab26b2ab35a29d446ae66f1795d40c184c0739.tar.bz2
mesa-87ab26b2ab35a29d446ae66f1795d40c184c0739.zip
glsl: Add initial functions to implement an on-disk cache
This code provides for an on-disk cache of objects. Objects are stored and retrieved via names that are arbitrary 20-byte sequences, (intended to be SHA-1 hashes of something identifying for the content). The directory used for the cache can be specified by means of environment variables in the following priority order: $MESA_GLSL_CACHE_DIR $XDG_CACHE_HOME/mesa <user-home-directory>/.cache/mesa By default the cache will be limited to a maximum size of 1GB. The environment variable: $MESA_GLSL_CACHE_MAX_SIZE can be set (at the time of GL context creation) to choose some other size. This variable is a number that can optionally be followed by 'K', 'M', or 'G' to select a size in kilobytes, megabytes, or gigabytes. By default, an unadorned value will be interpreted as gigabytes. The cache will be entirely disabled at runtime if the variable MESA_GLSL_CACHE_DISABLE is set at the time of GL context creation. Many thanks to Kristian Høgsberg <krh@bitplanet.net> for the initial implementation of code that led to this patch. In particular, the idea of using an mmapped file, (indexed by a portion of the SHA-1), for the efficent implementation of cache_has_key was entirely his idea. Kristian also provided some very helpful advice in discussions regarding various race conditions to be avoided in this code. Signed-off-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/compiler/Makefile.glsl.am')
-rw-r--r--src/compiler/Makefile.glsl.am10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/Makefile.glsl.am b/src/compiler/Makefile.glsl.am
index b8225cbe206..80dfb737fb2 100644
--- a/src/compiler/Makefile.glsl.am
+++ b/src/compiler/Makefile.glsl.am
@@ -33,6 +33,7 @@ EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README \
TESTS += glsl/glcpp/tests/glcpp-test \
glsl/glcpp/tests/glcpp-test-cr-lf \
glsl/tests/blob-test \
+ glsl/tests/cache-test \
glsl/tests/general-ir-test \
glsl/tests/optimization-test \
glsl/tests/sampler-types-test \
@@ -47,6 +48,7 @@ check_PROGRAMS += \
glsl/glcpp/glcpp \
glsl/glsl_test \
glsl/tests/blob-test \
+ glsl/tests/cache-test \
glsl/tests/general-ir-test \
glsl/tests/sampler-types-test \
glsl/tests/uniform-initializer-test
@@ -58,6 +60,11 @@ glsl_tests_blob_test_SOURCES = \
glsl_tests_blob_test_LDADD = \
glsl/libglsl.la
+glsl_tests_cache_test_SOURCES = \
+ glsl/tests/cache_test.c
+glsl_tests_cache_test_LDADD = \
+ glsl/libglsl.la
+
glsl_tests_general_ir_test_SOURCES = \
glsl/tests/builtin_variable_test.cpp \
glsl/tests/invalidate_locations_test.cpp \
@@ -120,6 +127,9 @@ glsl_libglsl_la_SOURCES = \
$(LIBGLSL_GENERATED_FILES) \
$(LIBGLSL_FILES)
+if ENABLE_SHADER_CACHE
+glsl_libglsl_la_SOURCES += $(LIBGLSL_SHADER_CACHE_FILES)
+endif
glsl_libstandalone_la_SOURCES = \
$(GLSL_COMPILER_CXX_FILES)