void *data = NULL;
bool ret = false;
int fd = -1;
- VkResult result = VK_SUCCESS;
VkPipelineCacheCreateInfo create_info = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
};
+ struct vk_pipeline_cache_create_info info = {
+ .pCreateInfo = &create_info,
+ .internal = true,
+ };
if (!radv_builtin_cache_path(path))
goto fail;
create_info.pInitialData = data;
fail:
- result = vk_common_CreatePipelineCache(radv_device_to_handle(device), &create_info, NULL,
- &device->meta_state.cache);
- if (result == VK_SUCCESS) {
+ device->meta_state.cache =
+ vk_pipeline_cache_to_handle(vk_pipeline_cache_create(&device->vk, &info, NULL));
+
+ if (device->meta_state.cache) {
device->meta_state.initial_cache_entries = num_cache_entries(device->meta_state.cache);
ret = device->meta_state.initial_cache_entries > 0;
}
#include "util/hash_table.h"
#include "util/set.h"
+#define vk_pipeline_cache_log(cache, ...) \
+ if (cache->internal) \
+ vk_logw(VK_LOG_OBJS(cache->base.device), __VA_ARGS__); \
+ else \
+ vk_logw(VK_LOG_OBJS(cache), __VA_ARGS__)
+
static bool
vk_raw_data_cache_object_serialize(struct vk_pipeline_cache_object *object,
struct blob *blob)
}
if (!object->ops->serialize(object, blob)) {
- vk_logw(VK_LOG_OBJS(cache),
- "Failed to serialize pipeline cache object");
+ vk_pipeline_cache_log(cache, "Failed to serialize pipeline cache object");
return false;
}
size_t size = blob->size - start;
if (size > UINT32_MAX) {
- vk_logw(VK_LOG_OBJS(cache),
- "Skipping giant (4 GiB or larger) object");
+ vk_pipeline_cache_log(cache, "Skipping giant (4 GiB or larger) object");
return false;
}
if (blob->out_of_memory) {
- vk_logw(VK_LOG_OBJS(cache),
- "Insufficient memory for pipeline cache data");
+ vk_pipeline_cache_log(cache,
+ "Insufficient memory for pipeline cache data");
return false;
}
ops = &vk_raw_data_cache_object_ops;
if (unlikely(ops->deserialize == NULL)) {
- vk_logw(VK_LOG_OBJS(cache),
- "Pipeline cache object cannot be deserialized");
+ vk_pipeline_cache_log(cache,
+ "Pipeline cache object cannot be deserialized");
return NULL;
}
data_obj->data,
data_obj->data_size, ops);
if (real_object == NULL) {
- vk_logw(VK_LOG_OBJS(cache),
- "Deserializing pipeline cache object failed");
+ vk_pipeline_cache_log(cache,
+ "Deserializing pipeline cache object failed");
vk_pipeline_cache_remove_object(cache, hash, object);
return NULL;
nir_serialize(&blob, nir, false);
if (blob.out_of_memory) {
- vk_logw(VK_LOG_OBJS(cache), "Ran out of memory serializing NIR shader");
+ vk_pipeline_cache_log(cache, "Ran out of memory serializing NIR shader");
blob_finish(&blob);
return;
}
data, data_size, ops);
if (object == NULL) {
- vk_logw(VK_LOG_OBJS(cache),
- "Failed to load pipeline cache object");
+ vk_pipeline_cache_log(cache, "Failed to load pipeline cache object");
continue;
}
return NULL;
cache->flags = pCreateInfo->flags;
+ cache->internal = info->internal;
struct VkPhysicalDeviceProperties pdevice_props;
device->physical->dispatch_table.GetPhysicalDeviceProperties(