1/* 2 * Copyright © 2021 Collabora Ltd. 3 * 4 * Derived from tu_pipeline_cache.c which is: 5 * Copyright © 2015 Intel Corporation 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * and/or sell copies of the Software, and to permit persons to whom the 12 * Software is furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the next 15 * paragraph) shall be included in all copies or substantial portions of the 16 * Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 * DEALINGS IN THE SOFTWARE. 25 */ 26 27#include "panvk_private.h" 28 29#include "util/debug.h" 30#include "util/disk_cache.h" 31#include "util/mesa-sha1.h" 32#include "util/u_atomic.h" 33 34VkResult 35panvk_CreatePipelineCache(VkDevice _device, 36 const VkPipelineCacheCreateInfo *pCreateInfo, 37 const VkAllocationCallbacks *pAllocator, 38 VkPipelineCache *pPipelineCache) 39{ 40 VK_FROM_HANDLE(panvk_device, device, _device); 41 struct panvk_pipeline_cache *cache; 42 43 cache = vk_object_alloc(&device->vk, pAllocator, sizeof(*cache), 44 VK_OBJECT_TYPE_PIPELINE_CACHE); 45 if (cache == NULL) 46 return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); 47 48 if (pAllocator) 49 cache->alloc = *pAllocator; 50 else 51 cache->alloc = device->vk.alloc; 52 53 *pPipelineCache = panvk_pipeline_cache_to_handle(cache); 54 return VK_SUCCESS; 55} 56 57void 58panvk_DestroyPipelineCache(VkDevice _device, 59 VkPipelineCache _cache, 60 const VkAllocationCallbacks *pAllocator) 61{ 62 VK_FROM_HANDLE(panvk_device, device, _device); 63 VK_FROM_HANDLE(panvk_pipeline_cache, cache, _cache); 64 65 vk_object_free(&device->vk, pAllocator, cache); 66} 67 68VkResult 69panvk_GetPipelineCacheData(VkDevice _device, 70 VkPipelineCache _cache, 71 size_t *pDataSize, 72 void *pData) 73{ 74 panvk_stub(); 75 return VK_SUCCESS; 76} 77 78VkResult 79panvk_MergePipelineCaches(VkDevice _device, 80 VkPipelineCache destCache, 81 uint32_t srcCacheCount, 82 const VkPipelineCache *pSrcCaches) 83{ 84 panvk_stub(); 85 return VK_SUCCESS; 86} 87