mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
vk/dma: Initialize COW DMA block contents to avoid leaks
- It is possible to lose data when uploading since the result of map_dma can change types and handles. - Consider sync-on-exit for inherited spans Not a problem when using passthrough DMA, but this extension does not work properly on NVIDIA + windows
This commit is contained in:
parent
abd8bd6f36
commit
254ddcad51
1 changed files with 8 additions and 0 deletions
|
@ -70,6 +70,14 @@ namespace vk
|
|||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, 0,
|
||||
VMM_ALLOCATION_POOL_UNDEFINED);
|
||||
|
||||
// Initialize memory contents. This isn't something that happens often.
|
||||
// Pre-loading the contents helps to avoid leakage when mixed types of allocations are in use (NVIDIA)
|
||||
// TODO: Fix memory lost when old object goes out of use with in-flight data.
|
||||
auto dst = allocated_memory->map(0, size);
|
||||
auto src = vm::get_super_ptr(base_address);
|
||||
std::memcpy(dst, src, size);
|
||||
allocated_memory->unmap();
|
||||
|
||||
s_allocated_dma_pool_size += allocated_memory->size();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue