Giovanni Mascellani (@giomasce) commented about include/vkd3d.h:
+ * \param cache The cache to close. + * + * \since 1.10 + */ +VKD3D_API void vkd3d_shader_cache_close(struct vkd3d_shader_cache *cache); + +/** + * Stores a key-value pair in a shader cache. + * + * \param cache The cache to store the value in. + * + * \param key An opaque key of key_size bytes. The cache does not parse the key in any way. If the key already + * exists, the existing value will be replaced. + * FIXME: For some users (e.g. the renderpass cache) it would be interesting to prevent replacement and get + * an error instead if the value already exists. Without this they need their own lock to have an atomic + * get() - create new object - put() sequence. Yeah, in general it seems sensible to allow for this in the API.
Conversely, if would be useful to have a way to destruct the current value (and possibly key too? Maybe not) when a `vkd3d_shader_cache_put()` call is replacing it. Maybe we could pass a destructor to `vkd3d_shader_cache_put()` to be used on the value that is getting replaced, if any. Or simply pass back the old value to the caller, so it is dealt with appropriately. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/541#note_57173