[Mesa-dev] [PATCH] anv/pipeline: honor the pipeline_cache_enabled run-time flag
Iago Toral Quiroga
itoral at igalia.com
Wed Jul 4 08:44:27 UTC 2018
---
src/intel/vulkan/anv_pipeline_cache.c | 37 +++++++++++++++++++----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c
index d4c7262dc0..5825bf9f01 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -570,23 +570,26 @@ anv_device_search_for_kernel(struct anv_device *device,
}
#ifdef ENABLE_SHADER_CACHE
- struct disk_cache *disk_cache = device->instance->physicalDevice.disk_cache;
- if (disk_cache) {
- cache_key cache_key;
- disk_cache_compute_key(disk_cache, key_data, key_size, cache_key);
-
- size_t buffer_size;
- uint8_t *buffer = disk_cache_get(disk_cache, cache_key, &buffer_size);
- if (buffer) {
- struct blob_reader blob;
- blob_reader_init(&blob, buffer, buffer_size);
- bin = anv_shader_bin_create_from_blob(device, &blob);
- free(buffer);
-
- if (bin) {
- if (cache)
- anv_pipeline_cache_add_shader_bin(cache, bin);
- return bin;
+ if (device->instance->pipeline_cache_enabled) {
+ struct disk_cache *disk_cache =
+ device->instance->physicalDevice.disk_cache;
+ if (disk_cache) {
+ cache_key cache_key;
+ disk_cache_compute_key(disk_cache, key_data, key_size, cache_key);
+
+ size_t buffer_size;
+ uint8_t *buffer = disk_cache_get(disk_cache, cache_key, &buffer_size);
+ if (buffer) {
+ struct blob_reader blob;
+ blob_reader_init(&blob, buffer, buffer_size);
+ bin = anv_shader_bin_create_from_blob(device, &blob);
+ free(buffer);
+
+ if (bin) {
+ if (cache)
+ anv_pipeline_cache_add_shader_bin(cache, bin);
+ return bin;
+ }
}
}
}
--
2.14.1
More information about the mesa-dev
mailing list