#include "util/mesa-sha1.h"
#include "util/debug.h"
#include "util/u_atomic.h"
+#include "radv_debug.h"
#include "radv_private.h"
#include "ac_nir_to_llvm.h"
const char *entrypoint,
const VkSpecializationInfo *spec_info,
const struct radv_pipeline_layout *layout,
- const union ac_shader_variant_key *key,
+ const struct ac_shader_variant_key *key,
uint32_t is_geom_copy_shader)
{
struct mesa_sha1 ctx;
const uint32_t mask = cache->table_size - 1;
const uint32_t start = (*(uint32_t *) sha1);
+ if (cache->table_size == 0)
+ return NULL;
+
for (uint32_t i = 0; i < cache->table_size; i++) {
const uint32_t index = (start + i) & mask;
struct cache_entry *entry = cache->hash_table[index];
if (!variant)
return NULL;
+ variant->code_size = entry->code_size;
variant->config = entry->config;
variant->info = entry->variant_info;
variant->rsrc1 = entry->rsrc1;
variant->code_size = entry->code_size;
variant->ref_count = 1;
- variant->bo = device->ws->buffer_create(device->ws, entry->code_size, 256,
- RADEON_DOMAIN_VRAM, RADEON_FLAG_CPU_ACCESS);
-
- void *ptr = device->ws->buffer_map(variant->bo);
+ void *ptr = radv_alloc_shader_memory(device, variant);
memcpy(ptr, entry->code, entry->code_size);
- device->ws->buffer_unmap(variant->bo);
entry->variant = variant;
}
return;
if (header.device_id != device->physical_device->rad_info.pci_id)
return;
- if (memcmp(header.uuid, device->physical_device->uuid, VK_UUID_SIZE) != 0)
+ if (memcmp(header.uuid, device->physical_device->cache_uuid, VK_UUID_SIZE) != 0)
return;
char *end = (void *) data + size;
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
header->vendor_id = 0x1002;
header->device_id = device->physical_device->rad_info.pci_id;
- memcpy(header->uuid, device->physical_device->uuid, VK_UUID_SIZE);
+ memcpy(header->uuid, device->physical_device->cache_uuid, VK_UUID_SIZE);
p += header->header_size;
struct cache_entry *entry;