From 51f229530bc9396d9b4da7ed234daee9717ab2f9 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 7 Apr 2019 14:42:01 +0200 Subject: [PATCH] Revert "[d3d11] Select memory type based on CPU access flags" This reverts commit 6c8042033e1552f84ee0f9c094623ceb8fc67870. Batman: Arkham City doesn't set the CPU access flags correctly for some images it maps for reading, and breaks on Nvidia as a result. --- src/d3d11/d3d11_texture.cpp | 20 +++++++------------- src/d3d11/d3d11_texture.h | 3 +-- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 9fad7bf8..d07ab1a7 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -165,7 +165,7 @@ namespace dxvk { // If necessary, create the mapped linear buffer if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER) - m_buffer = CreateMappedBuffer(m_desc.CPUAccessFlags); + m_buffer = CreateMappedBuffer(); // Create the image on a host-visible memory type // in case it is going to be mapped directly. @@ -173,10 +173,8 @@ namespace dxvk { if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) { memoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT - | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; - - if (m_desc.CPUAccessFlags & D3D11_CPU_ACCESS_READ) - memoryProperties |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT; + | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT + | VK_MEMORY_PROPERTY_HOST_CACHED_BIT; } m_image = m_device->GetDXVKDevice()->createImage(imageInfo, memoryProperties); @@ -406,7 +404,7 @@ namespace dxvk { } - Rc D3D11CommonTexture::CreateMappedBuffer(UINT CPUAccessFlags) const { + Rc D3D11CommonTexture::CreateMappedBuffer() const { const DxvkFormatInfo* formatInfo = imageFormatInfo( m_device->LookupPackedFormat(m_desc.Format, GetFormatMode()).Format); @@ -426,13 +424,9 @@ namespace dxvk { info.access = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT; - auto memoryType = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT - | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; - - if (CPUAccessFlags & D3D11_CPU_ACCESS_READ) - memoryType |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT; - - return m_device->GetDXVKDevice()->createBuffer(info, memoryType); + return m_device->GetDXVKDevice()->createBuffer(info, + VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); } diff --git a/src/d3d11/d3d11_texture.h b/src/d3d11/d3d11_texture.h index 3761aa0d..5e291da7 100644 --- a/src/d3d11/d3d11_texture.h +++ b/src/d3d11/d3d11_texture.h @@ -198,8 +198,7 @@ namespace dxvk { = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0 }; D3D11_MAP m_mapType = D3D11_MAP_READ; - Rc CreateMappedBuffer( - UINT CPUAccessFlags) const; + Rc CreateMappedBuffer() const; BOOL CheckImageSupport( const DxvkImageCreateInfo* pImageInfo,