Giovanni Mascellani (@giomasce) commented about libs/vkd3d/resource.c:
assert(!resource->map_count || heap->map_ptr);
+ if (was_unmapped) + *was_unmapped = !heap->map_ptr; + + if (heap->map_ptr) + d3d12_heap_update_mapping_locked(heap, offset + read_offset, read_size);
Reading again the Vulkan specs, I think you need to always call `d3d12_heap_update_mapping_locked()`, also when the memory just got mapped. The docs for `vkInvalidateMappedMemoryRanges()` say that "Mapping non-coherent memory does not implicitly invalidate that memory" (and I guess we're dealing with non-coherent memory; if not, we don't need the whole invalidation business at all). And the same thing for flushing, which I think must happen also when you're going to unmap. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/126#note_27149