1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-14 22:29:15 +01:00

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.
This commit is contained in:
Philip Rebohle 2019-04-07 14:42:01 +02:00
parent 1da7b1e87c
commit 51f229530b
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 8 additions and 15 deletions

View File

@ -165,7 +165,7 @@ namespace dxvk {
// If necessary, create the mapped linear buffer // If necessary, create the mapped linear buffer
if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_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 // Create the image on a host-visible memory type
// in case it is going to be mapped directly. // in case it is going to be mapped directly.
@ -173,10 +173,8 @@ namespace dxvk {
if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) { if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) {
memoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT memoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
| VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
if (m_desc.CPUAccessFlags & D3D11_CPU_ACCESS_READ)
memoryProperties |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
} }
m_image = m_device->GetDXVKDevice()->createImage(imageInfo, memoryProperties); m_image = m_device->GetDXVKDevice()->createImage(imageInfo, memoryProperties);
@ -406,7 +404,7 @@ namespace dxvk {
} }
Rc<DxvkBuffer> D3D11CommonTexture::CreateMappedBuffer(UINT CPUAccessFlags) const { Rc<DxvkBuffer> D3D11CommonTexture::CreateMappedBuffer() const {
const DxvkFormatInfo* formatInfo = imageFormatInfo( const DxvkFormatInfo* formatInfo = imageFormatInfo(
m_device->LookupPackedFormat(m_desc.Format, GetFormatMode()).Format); m_device->LookupPackedFormat(m_desc.Format, GetFormatMode()).Format);
@ -426,13 +424,9 @@ namespace dxvk {
info.access = VK_ACCESS_TRANSFER_READ_BIT info.access = VK_ACCESS_TRANSFER_READ_BIT
| VK_ACCESS_TRANSFER_WRITE_BIT; | VK_ACCESS_TRANSFER_WRITE_BIT;
auto memoryType = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT return m_device->GetDXVKDevice()->createBuffer(info,
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; 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);
} }

View File

@ -198,8 +198,7 @@ namespace dxvk {
= { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0 }; = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0 };
D3D11_MAP m_mapType = D3D11_MAP_READ; D3D11_MAP m_mapType = D3D11_MAP_READ;
Rc<DxvkBuffer> CreateMappedBuffer( Rc<DxvkBuffer> CreateMappedBuffer() const;
UINT CPUAccessFlags) const;
BOOL CheckImageSupport( BOOL CheckImageSupport(
const DxvkImageCreateInfo* pImageInfo, const DxvkImageCreateInfo* pImageInfo,