Giovanni Mascellani (@giomasce) commented about libs/vkd3d/state.c:
-void vkd3d_render_pass_cache_init(struct vkd3d_render_pass_cache *cache) +struct vkd3d_shader_cache *vkd3d_render_pass_cache_init(struct d3d12_device *device) {
- cache->render_passes = NULL;
- cache->render_pass_count = 0;
- cache->render_passes_size = 0;
- struct vkd3d_shader_cache_desc cache_desc = {0};
- struct vkd3d_shader_cache *cache;
- enum vkd3d_result ret;
- char cache_name[128];
- cache_desc.mem_size = ~0;
- cache_desc.max_entries = ~0;
- cache_desc.flags = VKD3D_SHADER_CACHE_FLAGS_NO_SERIALIZE;
- sprintf(cache_name, "memory:%p:renderpass", device);
I guess here `%p` is to make sure that each device has its own private cache. But that still requires iterating through all the available caches with a global lock and comparing strings. Wouldn't it be better to just make the cache private by default and have a flag to opt in sharing?