#include "ac_nir_to_llvm.h"
struct cache_entry {
- unsigned char sha1[20];
+ union {
+ unsigned char sha1[20];
+ uint32_t sha1_dw[5];
+ };
uint32_t code_size;
struct ac_shader_variant_info variant_info;
struct ac_shader_config config;
if (cache->hash_table[i]->variant)
radv_shader_variant_destroy(cache->device,
cache->hash_table[i]->variant);
- radv_free(&cache->alloc, cache->hash_table[i]);
+ vk_free(&cache->alloc, cache->hash_table[i]);
}
pthread_mutex_destroy(&cache->mutex);
free(cache->hash_table);
struct cache_entry *entry)
{
const uint32_t mask = cache->table_size - 1;
- const uint32_t start = (*(uint32_t *) entry->sha1);
+ const uint32_t start = entry->sha1_dw[0];
/* We'll always be able to insert when we get here. */
assert(cache->kernel_count < cache->table_size / 2);
return variant;
}
- entry = radv_alloc(&cache->alloc, sizeof(*entry) + code_size, 8,
+ entry = vk_alloc(&cache->alloc, sizeof(*entry) + code_size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_CACHE);
if (!entry) {
pthread_mutex_unlock(&cache->mutex);
const void *data, size_t size)
{
struct radv_device *device = cache->device;
+ struct radv_physical_device *pdevice = &device->instance->physicalDevice;
struct cache_header header;
- uint8_t uuid[VK_UUID_SIZE];
if (size < sizeof(header))
return;
return;
if (header.device_id != device->instance->physicalDevice.rad_info.pci_id)
return;
- radv_device_get_cache_uuid(uuid);
- if (memcmp(header.uuid, uuid, VK_UUID_SIZE) != 0)
+ if (memcmp(header.uuid, pdevice->uuid, VK_UUID_SIZE) != 0)
return;
char *end = (void *) data + size;
if(end - p < sizeof(*entry) + entry->code_size)
break;
- dest_entry = radv_alloc(&cache->alloc, sizeof(*entry) + entry->code_size,
+ dest_entry = vk_alloc(&cache->alloc, sizeof(*entry) + entry->code_size,
8, VK_SYSTEM_ALLOCATION_SCOPE_CACHE);
if (dest_entry) {
memcpy(dest_entry, entry, sizeof(*entry) + entry->code_size);
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
assert(pCreateInfo->flags == 0);
- cache = radv_alloc2(&device->alloc, pAllocator,
+ cache = vk_alloc2(&device->alloc, pAllocator,
sizeof(*cache), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (cache == NULL)
return;
radv_pipeline_cache_finish(cache);
- radv_free2(&device->alloc, pAllocator, cache);
+ vk_free2(&device->alloc, pAllocator, cache);
}
VkResult radv_GetPipelineCacheData(
{
RADV_FROM_HANDLE(radv_device, device, _device);
RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache);
+ struct radv_physical_device *pdevice = &device->instance->physicalDevice;
struct cache_header *header;
VkResult result = VK_SUCCESS;
const size_t size = sizeof(*header) + cache->total_size;
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
header->vendor_id = 0x1002;
header->device_id = device->instance->physicalDevice.rad_info.pci_id;
- radv_device_get_cache_uuid(header->uuid);
+ memcpy(header->uuid, pdevice->uuid, VK_UUID_SIZE);
p += header->header_size;
struct cache_entry *entry;