aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-03-15 15:20:48 +1100
committerTimothy Arceri <[email protected]>2017-03-17 16:17:10 +1100
commit2845a108a9a8bd4b0e6e9b590c976452fb99eb10 (patch)
tree49b763e0603f874e1105cace3889d4a61ee74bc9 /src/amd/vulkan
parent315e8a9321bbd20e35d27f443c0541411ee682c2 (diff)
radv: fallback to an in-memory cache when no pipline cache is provided
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r--src/amd/vulkan/radv_pipeline.c9
-rw-r--r--src/amd/vulkan/radv_pipeline_cache.c7
-rw-r--r--src/amd/vulkan/radv_private.h3
3 files changed, 13 insertions, 6 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 13ae87c3c49..73a377657ba 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -559,7 +559,8 @@ radv_pipeline_compile(struct radv_pipeline *pipeline,
if (pipeline->gs_copy_shader) {
pipeline->gs_copy_shader =
- radv_pipeline_cache_insert_shader(cache,
+ radv_pipeline_cache_insert_shader(pipeline->device,
+ cache,
gs_copy_sha1,
pipeline->gs_copy_shader,
gs_copy_code,
@@ -570,8 +571,10 @@ radv_pipeline_compile(struct radv_pipeline *pipeline,
ralloc_free(nir);
if (variant)
- variant = radv_pipeline_cache_insert_shader(cache, sha1, variant,
- code, code_size);
+ variant = radv_pipeline_cache_insert_shader(pipeline->device,
+ cache, sha1,
+ variant, code,
+ code_size);
if (code)
free(code);
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index 5f6355f0d1a..1fb8450021b 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -156,6 +156,8 @@ radv_create_shader_variant_from_pipeline_cache(struct radv_device *device,
if (cache)
entry = radv_pipeline_cache_search(cache, sha1);
+ else
+ entry = radv_pipeline_cache_search(device->mem_cache, sha1);
if (!entry)
return NULL;
@@ -258,13 +260,14 @@ radv_pipeline_cache_add_entry(struct radv_pipeline_cache *cache,
}
struct radv_shader_variant *
-radv_pipeline_cache_insert_shader(struct radv_pipeline_cache *cache,
+radv_pipeline_cache_insert_shader(struct radv_device *device,
+ struct radv_pipeline_cache *cache,
const unsigned char *sha1,
struct radv_shader_variant *variant,
const void *code, unsigned code_size)
{
if (!cache)
- return variant;
+ cache = device->mem_cache;
pthread_mutex_lock(&cache->mutex);
struct cache_entry *entry = radv_pipeline_cache_search_unlocked(cache, sha1);
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index e4654bb4d4a..fd4edf665f2 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -316,7 +316,8 @@ radv_create_shader_variant_from_pipeline_cache(struct radv_device *device,
const unsigned char *sha1);
struct radv_shader_variant *
-radv_pipeline_cache_insert_shader(struct radv_pipeline_cache *cache,
+radv_pipeline_cache_insert_shader(struct radv_device *device,
+ struct radv_pipeline_cache *cache,
const unsigned char *sha1,
struct radv_shader_variant *variant,
const void *code, unsigned code_size);