radv: Add more checking of cache sizes.

Hopefully prevents things.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13789>
This commit is contained in:
Bas Nieuwenhuizen 2021-11-14 23:59:41 +01:00 committed by Marge Bot
parent 9494c566c2
commit 6e3266709a

View file

@ -369,8 +369,12 @@ radv_create_shaders_from_pipeline_cache(
*stack_sizes = malloc(entry->num_stack_sizes * sizeof(**stack_sizes));
memcpy(*stack_sizes, p, entry->num_stack_sizes * sizeof(**stack_sizes));
}
} else {
assert(!entry->num_stack_sizes);
}
p += entry->num_stack_sizes * sizeof(**stack_sizes);
if (device->instance->debug_flags & RADV_DEBUG_NO_MEMORY_CACHE && cache == device->mem_cache)
vk_free(&cache->alloc, entry);
else {
@ -379,6 +383,7 @@ radv_create_shaders_from_pipeline_cache(
p_atomic_inc(&entry->shaders[i]->ref_count);
}
assert((uintptr_t)p <= (uintptr_t)entry + entry_size(entry));
radv_pipeline_cache_unlock(cache);
return true;
}