Giovanni Mascellani (@giomasce) commented about libs/vkd3d/cache.c:
- return VKD3D_ERROR_NOT_IMPLEMENTED;
- struct vkd3d_shader_cache *object;
- size_t size;
- TRACE("%s, %p, %p.\n", debugstr_a(name), desc, cache);
- if (!name || !desc)
- {
WARN("No name or description, returning VKD3D_ERROR_INVALID_ARGUMENT.\n");
return E_INVALIDARG;
- }
- /* FIXME: This isn't thread safe and cache_mutex_initialized might overflow. Do we have a
* something like DllMain or a platform-independent InitializeOnce? */
- if (InterlockedIncrement(&cache_mutex_initialized) == 1)
vkd3d_mutex_init(&cache_list_mutex);
Both the platforms we support have static mutex initializers, we can just define them in the header. We can also add support for `InitializeOnce()` and `pthread_once()`, of course, but the static initializer seems better to me.
Also notice that we have platform-independent functions `vkd3d_atomic_increment()` and similar.