summaryrefslogtreecommitdiff
path: root/src/compiler/glsl/tests/cache_test.c
AgeCommit message (Collapse)AuthorFilesLines
2016-11-23compiler/glsl/tests: Fix print format when building 32-bit binaries on ↵Aaron Watry1-1/+3
64-bit host Avoids two warnings. Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2016-11-15util/disk_cache: use unambiguous namingMarek Olšák1-70/+70
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-15util: import cache.c/h from glslMarek Olšák1-21/+1
It's not dependent on GLSL and it can be useful for shader caches that don't deal with GLSL. v2: address review comments v3: keep the other 3 lines in configure.ac Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-07glsl: Let cache_test build when the shader cache is not enabledIan Romanick1-0/+4
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Tested-by: Aaron Watry <awatry@gmail.com>
2016-09-28glsl: Add initial functions to implement an on-disk cacheTimothy Arceri1-0/+416
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>