From 3e60c8f3161fb910fa22af6f7af8be7ee6f69a29 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 12 Mar 2018 12:54:05 +0100 Subject: [PATCH] [d3d11] Re-enable image mapping After more extensive testing, it looks like commit 4eacff21 actually fixed the issue in most (all?) cases. --- src/d3d11/d3d11_texture.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 9d332e5a..465edc2d 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -148,7 +148,7 @@ namespace dxvk { if (CPUAccessFlags & D3D11_CPU_ACCESS_READ) { pImageInfo->access |= VK_ACCESS_HOST_READ_BIT; -// pImageInfo->tiling = VK_IMAGE_TILING_LINEAR; + pImageInfo->tiling = VK_IMAGE_TILING_LINEAR; } } @@ -169,19 +169,17 @@ namespace dxvk { * \returns Image memory properties */ static VkMemoryPropertyFlags GetImageMemoryFlags(UINT CPUAccessFlags) { - // FIXME investigate why image mapping breaks games - return VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; -// if (CPUAccessFlags & D3D11_CPU_ACCESS_READ) { -// return VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT -// | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT -// | VK_MEMORY_PROPERTY_HOST_CACHED_BIT; -// } else { -// // If only write access is required, we will emulate -// // image mapping through a buffer. Some games ignore -// // the row pitch when mapping images, which leads to -// // incorrect rendering. -// return VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; -// } + if (CPUAccessFlags & D3D11_CPU_ACCESS_READ) { + return VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT + | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT + | VK_MEMORY_PROPERTY_HOST_CACHED_BIT; + } else { + // If only write access is required, we will emulate + // image mapping through a buffer. Some games ignore + // the row pitch when mapping images, which leads to + // incorrect rendering. + return VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + } }