1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-18 04:54:15 +01:00

[dxvk] Fix potential undesired host-visible buffer invalidation

We cannot invalidate mapped buffers in the backend because the frontend
may cache the mapped slice from its own invalidations, which would then
become invalid. Very unlikely to be an issue in practice.
This commit is contained in:
Philip Rebohle 2021-06-29 13:31:53 +02:00
parent cd8a2bcfcd
commit 45a6d5fb5b
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -1417,6 +1417,9 @@ namespace dxvk {
void DxvkContext::discardBuffer(
const Rc<DxvkBuffer>& buffer) {
if (buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
return;
if (m_execBarriers.isBufferDirty(buffer->getSliceHandle(), DxvkAccess::Write))
this->invalidateBuffer(buffer, buffer->allocSlice());
}
@ -2133,8 +2136,11 @@ namespace dxvk {
VkDeviceSize offset,
VkDeviceSize size,
const void* data) {
bool isHostVisible = buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
bool replaceBuffer = (size == buffer->info().size)
&& (size <= (1 << 20)); /* 1 MB */
&& (size <= (1 << 20))
&& !isHostVisible;
DxvkBufferSliceHandle bufferSlice;
DxvkCmdBuffer cmdBuffer;