Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rebohle <philip.rebohle@tu-dortmund.de>2022-09-05 05:44:25 +0300
committerPhilip Rebohle <philip.rebohle@tu-dortmund.de>2022-09-05 06:52:55 +0300
commitbd912212b5f83eb190dc1ace85d5c0cb9a47d9a1 (patch)
tree8df5aaeab9a670ba68dfc82a7e04e3575c1a3ce4
parentfdcbdeb28f615f30e24ea19674a1a23dd60c5f2c (diff)
[d3d11] Adjust preferred mapping modes for default imagesd3d11-mapped-default-image
-rw-r--r--src/d3d11/d3d11_texture.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp
index fd05fd53..007d47f2 100644
--- a/src/d3d11/d3d11_texture.cpp
+++ b/src/d3d11/d3d11_texture.cpp
@@ -599,10 +599,18 @@ namespace dxvk {
// If supported and requested, create a linear image. Default images
// can be used for resolves and other operations regardless of bind
// flags, so we need to use a proper image for those.
- if (m_desc.TextureLayout == D3D11_TEXTURE_LAYOUT_ROW_MAJOR
- || m_desc.Usage == D3D11_USAGE_DEFAULT)
+ if (m_desc.TextureLayout == D3D11_TEXTURE_LAYOUT_ROW_MAJOR)
return D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT;
+ // For default images, prefer direct mapping if the image is CPU readable
+ // since mapping for reads would have to stall otherwise. If the image is
+ // only writable, prefer a write-through buffer.
+ if (m_desc.Usage == D3D11_USAGE_DEFAULT) {
+ return (m_desc.CPUAccessFlags & D3D11_CPU_ACCESS_READ)
+ ? D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT
+ : D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER;
+ }
+
// The overhead of frequently uploading large dynamic images may outweigh
// the benefit of linear tiling, so use a linear image in those cases.
VkDeviceSize threshold = m_device->GetOptions()->maxDynamicImageBufferSize;