aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_pipeline_cache.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-10-12 14:24:41 +1000
committerSamuel Pitoiset <[email protected]>2017-10-12 14:14:43 +0200
commit6049fa454e4752a527cb8e13779082b27adcfb97 (patch)
tree5b1432551d563afc7019d3c241932b0ca5dd0de8 /src/amd/vulkan/radv_pipeline_cache.c
parent4f42ea4dcfd23a772ec6ea211b696e9b4b521ac7 (diff)
radv: don't crash if cache is disabled.
If you set MESA_GLSL_CACHE_DISABLE, radv crashed. Fixes: fd24be134f (radv: make use of on-disk cache) Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_pipeline_cache.c')
-rw-r--r--src/amd/vulkan/radv_pipeline_cache.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index 51fa3f1b31f..fabff9ed815 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -167,6 +167,8 @@ radv_create_shader_variant_from_pipeline_cache(struct radv_device *device,
entry = radv_pipeline_cache_search(device->mem_cache, sha1);
if (!entry) {
+ if (!device->physical_device->disk_cache)
+ return NULL;
uint8_t disk_sha1[20];
disk_cache_compute_key(device->physical_device->disk_cache,
sha1, 20, disk_sha1);
@@ -317,11 +319,13 @@ radv_pipeline_cache_insert_shader(struct radv_device *device,
* compiled shaders by third parties such as steam, even if the app
* implements its own pipeline cache.
*/
- uint8_t disk_sha1[20];
- disk_cache_compute_key(device->physical_device->disk_cache, sha1, 20,
- disk_sha1);
- disk_cache_put(device->physical_device->disk_cache,
- disk_sha1, entry, entry_size(entry), NULL);
+ if (device->physical_device->disk_cache) {
+ uint8_t disk_sha1[20];
+ disk_cache_compute_key(device->physical_device->disk_cache, sha1, 20,
+ disk_sha1);
+ disk_cache_put(device->physical_device->disk_cache,
+ disk_sha1, entry, entry_size(entry), NULL);
+ }
entry->variant = variant;
p_atomic_inc(&variant->ref_count);