cache->hash_table = malloc(byte_size);
/* We don't consider allocation failure fatal, we just start with a 0-sized
- * cache. */
+ * cache. Disable caching when we want to keep shader debug info, since
+ * we don't get the debug info on cached shaders. */
if (cache->hash_table == NULL ||
- (device->instance->debug_flags & RADV_DEBUG_NO_CACHE))
+ (device->instance->debug_flags & RADV_DEBUG_NO_CACHE) ||
+ device->keep_shader_info)
cache->table_size = 0;
else
memset(cache->hash_table, 0, byte_size);
radv_hash_shaders(unsigned char *hash,
const VkPipelineShaderStageCreateInfo **stages,
const struct radv_pipeline_layout *layout,
- const struct ac_shader_variant_key *keys,
+ const struct radv_pipeline_key *key,
uint32_t flags)
{
struct mesa_sha1 ctx;
_mesa_sha1_init(&ctx);
- if (keys)
- _mesa_sha1_update(&ctx, keys, sizeof(*keys) * MESA_SHADER_STAGES);
+ if (key)
+ _mesa_sha1_update(&ctx, key, sizeof(*key));
if (layout)
_mesa_sha1_update(&ctx, layout->sha1, sizeof(layout->sha1));
entry = radv_pipeline_cache_search_unlocked(cache, sha1);
if (!entry) {
+ /* Again, don't cache when we want debug info, since this isn't
+ * present in the cache. */
if (!device->physical_device->disk_cache ||
- (device->instance->debug_flags & RADV_DEBUG_NO_CACHE)) {
+ (device->instance->debug_flags & RADV_DEBUG_NO_CACHE) ||
+ device->keep_shader_info) {
pthread_mutex_unlock(&cache->mutex);
return false;
}
p += entry->code_sizes[i];
entry->variants[i] = variant;
+ } else if (entry->code_sizes[i]) {
+ p += sizeof(struct cache_entry_variant_info) + entry->code_sizes[i];
}
}