vkd3d: Prevent races between releasing a heap and releasing its resources
If you released a heap and the last resource on that heap at the same time, it was possible for both to see each other's refcount/resource_count as 0 and both try to destroy the heap.
Avoid that by converting resource_count to an internal_refcount, which holds an extra +1 if the main refcount is nonzero. The final release will then be synchronized between the two since both will operate on internal_refcount.
Edited by Evan Tang